Bug #40802 Incorrect query splitting on Windows
Submitted: 17 Nov 2008 20:08 Modified: 9 Jan 2009 10:00
Reporter: Björn Voigt (OCA) Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Query Browser Severity:S3 (Non-critical)
Version:5.0r14 OS:Windows
Assigned to: Mike Lischke CPU Architecture:Any

[17 Nov 2008 20:08] Björn Voigt
Description:
The Windows version of MySQL query browser does not correctly handle queries with semicolons (";"). Here are some examples:

1) "SELECT now()" and "SELECT now();" work

2) "SELECT now();<ENTER>" does not work. I do not have the English error message. The German message says, that I tried to execute an empty string. 

3) "SELECT now(); SELECT user();" works, but only the second query is executed.

How to repeat:
Type in the above examples in the Windows version of MySQL query browser. The example should by typed in the query field, not in a script tab.

Suggested fix:
The Linux version seems to handle all 3 examples right. Examples (1) and (2) work as expected. Example (3) brings an error message on Linux about a syntax problem near "select user()". Error reporting is ok, because there is no way to handle the result sets of two queries at in one windows in the query browser. The Windows version should probably handle the the queries with semicolons like the Linux version.
[20 Nov 2008 23:57] Mark McAulay
This happens in 1.2.14 and is a real pain for pasted in queries. It would be good if it was fixed.
[21 Nov 2008 17:02] MySQL Verification Team
Thank you for the bug report. Select Now();Enters open a new line and Select Now();Select User(); gives a message of multiple statements that only the first one will be executed.
[8 Jan 2009 13:07] Mike Lischke
This implementation is by design. The query area allows to contain more than one query (separated by semikolon), only that no query must start on the same line where another one ends. The query where the cursor is in can be executed.

Thus, if your cursor is after the semicolon it tries to find a new query somewhere after that point. If there is none, you get the known error message.
[8 Jan 2009 13:12] Mike Lischke
I should add that this feature works by line, hence the limitation that you cannot have one query starting on a line where another one ends. However, it has also the useful consequence that you can have your cursor after a semicolon, if you stay on the same line as where the query ends and nothing but white spaces follow.

Btw: the currently active lines are visible (because the others are dimmed, using a light gray background). So you can see what is the active query and gets executed if you trigger that.
[9 Jan 2009 10:00] Björn Voigt
But again I want to point out, that the Linux version does not give an error on point 2) of the description of this bug and executes the query. 

If you want to have this bug marked as "Not a Bug", it remains an incompatibility between the Windows and Linux version. I know that the GUI of the Windows and Linux version are programmed in different programming languages. Anyway it's a bit unclear why the query parsing code is also incompatible.

I suggest to use a simple trim() function to remove trailing whitespace in the query. This would fix point 2).