Bug #22416 MYSQL_OPTION_MULTI_STATEMENTS_ON not supported in DBD::mysql
Submitted: 16 Sep 2006 16:35 Modified: 7 Dec 2006 13:09
Reporter: Alvar Freude Email Updates:
Status: No Feedback Impact on me:
None 
Category:Connectors: DBD::mysql ( Perl ) Severity:S3 (Non-critical)
Version:3.0007_1 (latest from CPAN) OS:all / DBI
Assigned to: CPU Architecture:Any
Tags: DBD::MySQL, MULTI_STATEMENTS, perl

[16 Sep 2006 16:35] Alvar Freude
Description:
The MYSQL_OPTION_MULTI_STATEMENTS_ON option can not be used with DBD::mysql.
At least I did not find any documentation about it, tried several variants an all failed.

It should be easy to implement this feature.

This is important e.g. for installation scripts, which uses a lot of "CREATE TABLE" statements.

As first step it may be enough to implement the ability to use more then one "CREATE TABLE" oder "INSERT INTO" statements.

How to repeat:
   $db_h->do(
         qq{
           DROP TABLE IF EXISTS foobar;
           CREATE TABLE foobar(test text);
           INSERT INTO foobar VALUES ('Hahaha!');
           });

Suggested fix:
use the "MYSQL_OPTION_MULTI_STATEMENTS_ON" option on ->connect. Optionally!
[18 Sep 2006 11:10] Valeriy Kravchuk
Thank you for a problem report. Do you use server-side prepared statements (enabled by default)? Please, try to run your test script with them disabled, and inform about the results.
[27 Sep 2006 22:09] Alvar Freude
Hi,

> Do you use server-side prepared statements
> (enabled by default)? Please, try to run your test script with them disabled,
> and inform about the results.

thanks for the answer.

I tried this now with disabled prepared statements, accourding to the DBD::mysql docs using "DBI:mysql:database=test;mysql_emulated_prepare=1" as DSN.

It still fails with multiline statements; the error message is like this:

DBD::mysql::db do failed: 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 ';
           CREATE TABLE foobar(test text);
           INSERT INTO foobar VALUE' at line 1 at /XXXX/Install.pm line 164.

Ciao
  Alvar
[7 Nov 2006 13:09] Valeriy Kravchuk
Thank you for a problem report. Please, try to repeat with a newer version, 3.0008/3.0008_1, and inform about the results.
[8 Dec 2006 0:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".