Hi,

I found a bug in DBD::mysql 2.1026. I didn't try 2.1027 because, 
according to the ChangeLog, it doesn't fix it. My DBI version is 1.30, 
MySQL is 4.0.13.

With ShowErrorStatement => 1 the statement in the error message belongs
to the last executed statement, if the actual SQL command is executed 
with DBI->do.

This small script reproduces the error:

--snip--

#!/usr/bin/perl

use strict;
use DBI;

main: {
        my $dbh = DBI->connect (
                "dbi:mysql:test",
                "****", "****",
                { ShowErrorStatement => 1 }
        ) or die "can't connect";

        my $sth = $dbh->prepare ("show variables like 'version'");
        $sth->execute;
        $sth->finish;

        $dbh->do ("this is an error");

        END { $dbh->disconnect if $dbh }
}

--snip--

This prints:

  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 'this is an error' at line 1
  [for statement ``show variables like 'version''']) at ...
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                   Should be: ``this is an error''

I checked the same script with DBD::Oracle: everything fine here, so the
bug is most probably in DBD::mysql.

Regards,

Joern

-- 
Joern Reder -- Software Development,  dimedis GmbH, 50672 Koeln
               http://www.dimedis.de/
supporting:    http://www.zyn.de/ http://www.exit1.org/
CPAN:          http://www.perl.com/CPAN/modules/by-module/CIPP/JRED/

Attachment: pgp00000.pgp
Description: PGP signature

Reply via email to