Bug #45109 MySQLScript Delimiter appears to be ignored
Submitted: 26 May 2009 22:55 Modified: 6 Aug 2009 11:24
Reporter: Richard French Email Updates:
Status: Can't repeat Impact on me:
None 
Category:Connector / NET Severity:S3 (Non-critical)
Version:6.0.3.0 OS:Windows (Vista Home Premium)
Assigned to: CPU Architecture:Any
Tags: Connector/Net, DELIMITER, mysqlscript

[26 May 2009 22:55] Richard French
Description:
Setting the Delimiter property in MySQLScript seems to have no effect when the delimiter is used in the script:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '//

This behaviour was working from previous version 5.2.2

How to repeat:
C#

1.  Create file with the following SQL

SET NAMES utf8
//

DROP DATABASE IF EXISTS pvdb
//

CREATE DATABASE pvdb CHARACTER SET utf8
//

USE pvdb
//

CREATE TABLE sys
(
	db_version INTEGER NOT NULL,
	db_sys_eu BOOLEAN NOT NULL DEFAULT TRUE
) ENGINE = INNODB, MIN_ROWS = 0, MAX_ROWS = 1
//

2. run the following code (C#) 
// assumes 'connection' is open to mysql database
using (TextReader reader = new StreamReader(sqlScriptFilename))
{
    string script = reader.ReadToEnd();
    MySqlScript sqlScript = new MySqlScript(connection, script);
    sqlScript.Delimiter = "//";
    sqlScript.Execute();
}
[29 May 2009 19:37] Reggie Burnett
Can't repeat. I took your test case and tried it directly on 5.2, 6.0.3 and 6.0.4.  they all passed.  Are you sure that your connection has appropriate privs to create the database?  What is the exception being thrown?
[6 Aug 2009 10:36] Martin Packer
Not much to add to the original report apart from some exception details but I seem to be having exactly the same problem. I came across this while working around bug #46429, I was extracting the part of my script between the two DELIMITER commands and setting the delimiter explicitly. Maybe the fix to #46429 will fix this too?

Here's my exception details:

[MySql.Data.MySqlClient.MySqlException]	{"You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '//\nCREATE PROCEDURE ' at line 1"}	MySql.Data.MySqlClient.MySqlException

   at MySql.Data.MySqlClient.MySqlStream.ReadPacket()
   at MySql.Data.MySqlClient.NativeDriver.ReadResult(UInt64& affectedRows, Int64& lastInsertId)
   at MySql.Data.MySqlClient.MySqlDataReader.GetResultSet()
   at MySql.Data.MySqlClient.MySqlDataReader.NextResult()
   at MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior)
   at MySql.Data.MySqlClient.MySqlCommand.ExecuteReader()
   at MySql.Data.MySqlClient.MySqlCommand.ExecuteNonQuery()
   at MySql.Data.MySqlClient.MySqlScript.Execute()
[6 Aug 2009 11:23] Richard French
Sample C# Project of the bug in action

Attachment: mySQLScriptBrokenDelimiter.zip (application/octetstream, text), 125.97 KiB.

[6 Aug 2009 11:24] Richard French
Hi,

I have managed to recreate this bug.  

I have uploaded the entire C# (2005) project into the Files section.  (mySQLScriptBrokenDelimiter.zip)

Thanks,
Richard.