Bug #23157 Preparing command object with multiple SQL Statements fails
Submitted: 10 Oct 2006 22:00 Modified: 12 Oct 2006 21:34
Reporter: Lee Stigile Email Updates:
Status: Unsupported Impact on me:
None 
Category:Connector / NET Severity:S4 (Feature request)
Version:1.0 OS:Windows (Windows)
Assigned to: CPU Architecture:Any
Tags: .net, multiple statements, prepare

[10 Oct 2006 22:00] Lee Stigile
Description:
If two SQL statements are prepared in a single command object, a syntax error is returned:  

"#42000You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near
'; select * from it_user' at line 1"      string

The same statement will execute perfectly.  Sample statement:
"SELECT p.projectid, p.name, p.description, u.name As ownername FROM
it_project p INNER JOIN it_user u ON p.userId=u.UserId Order By name asc
limit 0, 5; select * from it_user"

How to repeat:

myCommand.Connection = conn;
myCommand.CommandText = "SELECT * FROM users; SELECT * FROM usertypes";
conn.Open();
myCommand.Prepare()

The statement will execute fine, but a syntax error is returned on prepare.

Suggested fix:
unknown
[11 Oct 2006 8:55] Tonci Grgin
Hello Lee. Please add full c/NET, MySQL server and NET.Framework version to this report.
I did verify your problem but I'm not sure if this is supposed to work at all.
 - MySQL server 5.0.24BK on XP Pro SP2 (local)host
 - c/NET 5 SVN latest
 - NET framework 2.0
[11 Oct 2006 16:10] Lee Stigile
C#, Visual Studio .NET 2003, .NET Framework 1.1, MySQL server 5.0.17, XP Pro SP2
c/NET 1.0.7
[12 Oct 2006 21:34] Tonci Grgin
Hi Lee.
I will have to declare this report "unsupported" for now. In the future we *might* have the provider split the command text into multiple statements and prepare each one of them.