Skip Menu |

This queue is for tickets about the DBD-mysql CPAN distribution.

Report information
The Basics
Id: 55627
Status: resolved
Priority: 0/
Queue: DBD-mysql

People
Owner: CAPTTOFU [...] cpan.org
Requestors: yves [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 4.013
Fixed in: (no value)



Subject: Tesing against strict mode database server leads to failing tests in t/76multi_statement.t
One of the tests in t/76mult_statement.t deliberately executes a statement that generates a warning, which when executed against a mysql server in whose SQL_MODE is something like "STRICT_ALL_TABLES" will result in test failures like this: ok 10 - Statement handle is Active DBD::mysql::st more_results failed: Data truncated for column 'a' at row 2 at t/76multi_statement.t line 50. DBD::mysql::st more_results failed: Data truncated for column 'a' at row 2 at t/76multi_statement.t line 50. Issuing rollback() due to DESTROY without explicit disconnect() of DBD::mysql::db handle test:mc01ppcmdb-03.corp.lhr1.booking.com at t/76multi_statement.t line 50. # Looks like you planned 24 tests but ran 10. # Looks like your test exited with 255 just after 10. This is a false-failure of course, as the strict mode causes the update that is *trying* to generate a warning to throw a fatal exception. Disabling the strict mode as is done in the attached patch allows the warnings to be successfully caught, and thus the test pass.
Subject: 76multi_statement.t.patch
--- t/76multi_statement.t.orig 2010-03-16 15:37:07.000000000 +0100 +++ t/76multi_statement.t 2010-03-16 15:39:32.000000000 +0100 @@ -19,15 +19,19 @@ if ($@) { plan skip_all => "ERROR: $@. Can't continue test"; } -plan tests => 24; +plan tests => 25; ok (defined $dbh, "Connected to database with multi statement support"); $dbh->{mysql_server_prepare}= 0; SKIP: { - skip "Server doesn't support multi statements", 23 - if $dbh->get_info($GetInfoType{SQL_DBMS_VER}) lt "4.1"; + my $v= $dbh->get_info($GetInfoType{SQL_DBMS_VER}); + diag "Testing multicall against SQL_DBMS_VER: $v"; + skip "Server doesn't support multi statements", 24 + if $v lt "4.1"; + + ok($dbh->do("SET SQL_MODE=''"),"init connection SQL_MODE non strict"); ok($dbh->do("DROP TABLE IF EXISTS $table"), "clean up");
Hi! Thank you very much! I am digging myself out of having been busy both with a product release at work and a newborn son, so your patch will go into the next release. I want to do a release this week! --Patrick n Tue Mar 16 10:58:19 2010, YVES wrote: Show quoted text
> One of the tests in t/76mult_statement.t deliberately executes a > statement that generates a warning, which when executed against a mysql > server in whose SQL_MODE is something like "STRICT_ALL_TABLES" will > result in test failures like this: > > ok 10 - Statement handle is Active > DBD::mysql::st more_results failed: Data truncated for column 'a' at row > 2 at t/76multi_statement.t line 50. > DBD::mysql::st more_results failed: Data truncated for column 'a' at row > 2 at t/76multi_statement.t line 50. > Issuing rollback() due to DESTROY without explicit disconnect() of > DBD::mysql::db handle test:mc01ppcmdb-03.corp.lhr1.booking.com at > t/76multi_statement.t line 50. > # Looks like you planned 24 tests but ran 10. > # Looks like your test exited with 255 just after 10. > > This is a false-failure of course, as the strict mode causes the update > that is *trying* to generate a warning to throw a fatal exception. > > Disabling the strict mode as is done in the attached patch allows the > warnings to be successfully caught, and thus the test pass.
Added patch. Release 4.013