Bug #25583 Only first of multiple statements on single line is executed
Submitted: 12 Jan 2007 12:47 Modified: 16 Jan 2007 14:10
Reporter: Yahoo Serious (Silver Quality Contributor) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Query Browser Severity:S3 (Non-critical)
Version:1.2.8 OS:Windows (Windows 2000 SP4, XP SP2)
Assigned to: Mike Lischke CPU Architecture:Any

[12 Jan 2007 12:47] Yahoo Serious
Description:
When multiple statements are on one line, only the first one is executed, independent of the cursor-position.  

I think a warning should always be shown and maybe the highlighting should be adjusted (grey out everything after the first semicolon ";").

How to repeat:
# Create table
CREATE TABLE  `test`.`t1` (
  `a` tinyint(4) NOT NULL,
  `b` char(4) collate latin1_bin default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_bin;

# Execute this line with cursor in first statement
INSERT INTO test.t1 VALUES (1,'a'); INSERT INTO test.t1 VALUES (2,'b');
# Execute this line with cursor in second statement
INSERT INTO test.t1 VALUES (1,'a'); INSERT INTO test.t1 VALUES (2,'b');

# Watch the results
SELECT * FROM test.t1;

Suggested fix:
Show a warning:
  "Warning: only the first of multiple statements on a single line is executed."
or an error:
  "Error: multiple statements on a single line."

Grey out everything after the first semicolon, or grey out a line with multiple statements.
[12 Jan 2007 13:08] Valeriy Kravchuk
Thank you for a bug report. Verified just as described on Windows XP SP2.
[16 Jan 2007 14:10] Mike Lischke
Thank you for your bug report. This issue has been committed to our source repository of that product and will be incorporated into the next release.

If necessary, you can access the source repository and build the latest available version, including the bug fix. More information about accessing the source trees is available at

    http://dev.mysql.com/doc/en/installing-source.html