"Run Current Query" doesn't work after semicolon

biao's profile image biao posted 3 years ago in Running SQL scripts Permalink

Hello

If I put cursor after ; and click "Run Current Query", the query won't run.

SHOW PROCESSLIST;|

If I put cursor before ; and click "Run Current Query", query is executed as expected.

SHOW PROCESSLIST|;

It's not convenient sometimes as I have to move the cursor to run the statement. Is it by design?

Thanks

Biao

ansgar's profile image ansgar posted 3 years ago Permalink

Placing the cursor behind the semicolon shifts the current query to the one behind it. This is intentionally.

biao's profile image biao posted 3 years ago Permalink

I prefer the query console to follow the convention of mysql cli :)

biao's profile image biao posted 3 years ago Permalink

select 1; | select 2;

select 1; select 2;|

both run the all statements

ansgar's profile image ansgar posted 3 years ago Permalink

both run the all statements

If you want to run all queries, just press F9, or click "Run".

maoanz's profile image maoanz posted 2 years ago Permalink

I just discovered HeidiSQL one week ago, it is just a great tool. But for I was also misunderstanding for me why the run current sql didn't work for me. It's less logical to cut the current sql after ; I think the best way is to test if the current selection is empty, then move to one ; before.

Because when we type many sql in the editor, people often type a ; and the end, if we want to run the short cut Ctrl + Shift + Enter, we have to type a back one or serveral time to move the cursor, and later we need to move the cursor again to the end. We need to press many time the cursor before and back.

@biao Now I just find a workaround, so every time I want to insert a new sql, I start the line with ; and don't end the line with ; something like this. And the shortcut Ctrl + Shift + Enter works wherever the cursor is, on this sql text.

1 attachment(s):
  • Image-713
maoanz's profile image maoanz posted 2 years ago Permalink

something wrong with the previous screenshot.

1 attachment(s):
  • Image-714
viacheslav's profile image viacheslav posted 2 years ago Permalink

I'm new in heidisql but after MySQL Workbench I really confused with the approach when the cursor is after semicolumn and it executes the sql in next line. please make it at least configurable if you don't like this approach

Please login to leave a reply, or register at first.