Bug #26804 Execute query with only single statement inconsistent
Submitted: 2 Mar 2007 19:37 Modified: 27 Apr 2007 8:57
Reporter: Anthony Willard (Basic Quality Contributor) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Query Browser Severity:S3 (Non-critical)
Version:1.2.10 OS:Windows (WinXP, SP2)
Assigned to: CPU Architecture:Any
Tags: qc

[2 Mar 2007 19:37] Anthony Willard
Description:
Executing a single line query when not on the last line reports "You tried to execute an empty string. ..."  If performed after the delimiter (ie ";" ), it works.

How to repeat:
1) Open Query Browser.
2) Enter a simple statement like "SELECT * FROM information_schema.tables;"
-- leave cursor immediately after the ";"
3) Execute query - by Ctrl+Enter or clicking button
4) Query runs
5) Press enter after the ";"
6) Execute query
-- receive error "You tried to execute an empty string. ..."

Whitespace at the end of the statement does not operate the same following a newline.  Adding additional white space following the ";" does not affect the operation.  The line shading seems to follow the logic of execute.

Suggested fix:
Treat all whitespace following the only or last statement as "nothing" run the statement.
[2 Mar 2007 19:40] Anthony Willard
Behavior is also present when blank lines precede the only statement in the window.
[4 Mar 2007 8:44] Valeriy Kravchuk
Thank you for a bug report. I think that new lines should be ignored in Resultset tab, similar to whitespaces.
[27 Apr 2007 8:57] Michael G. Zinner
This is the expected behavior. You can enter several SQL commands into the query area.

SELECT * FROM test.t1;

SELECT * FROM test.t2;

By placing the cursor on the statement you want to want to execute, this statement will be chosen. To make this work ";" is used as the delimiter. That means, if you place the cursor into a new line after the ";", this is treated as a new statement.

If you do not want to work with multiple statements, simple omit the ";". Then you can place the cursor anywhere you like.