Skip Menu |
 

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

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

People
Owner: Nobody in particular
Requestors: melezhik [...] gmail.com
Cc:
AdminCc:

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



Subject: bug in more_results method
Date: Mon, 4 May 2009 11:55:28 +0400
To: bug-DBD-mysql [...] rt.cpan.org
From: Alexey Melezhik <melezhik [...] gmail.com>
Download (untitled) / with headers
text/plain 1.4k
it seems more_results method work incorrectly on the emd of multiple results sets. DESCRIPTION MySQL driver for DBI CPAN_USERID CAPTTOFU (Patrick Galbraith <patg@patg.net>) CPAN_VERSION 4.011 CPAN_FILE C/CA/CAPTTOFU/DBD-mysql-4.011.tar.gz UPLOAD_DATE 2009-04-14 DSLIP_STATUS RmcO? (released,mailing-list,C,object-oriented,) MANPAGE DBD::mysql - MySQL driver for the Perl5 Database Interface (DBI) INST_FILE /usr/lib/perl5/vendor_perl/5.8.8/i686-linux-thread-multi/DBD/mysql.pm INST_VERSION 4.005 ---- I have the test attached test. The test was made by original DBD::mysql regression test by adding just one line in the end test: melezhik DBD-mysql-4.011-MidmLk # make test TEST_FILES=t/81procs.t PERL_DL_NONLAZY=1 /usr/bin/perl5.8.8 "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/81procs.t t/81procs....NOK 28 # Failed test 'more results should give undef' # at t/81procs.t line 125. # got: '1' # expected: undef # Looks like you failed 1 test of 30. t/81procs....dubious Test returned status 1 (wstat 256, 0x100) DIED. FAILED test 28 Failed 1/30 tests, 96.67% okay Failed Test Stat Wstat Total Fail Failed List of Failed ------------------------------------------------------------------------------- t/81procs.t 1 256 30 1 3.33% 28 Failed 1/1 test scripts, 0.00% okay. 1/30 subtests failed, 96.67% okay. make: *** [test_dynamic] Error 1
Download 81procs.t
text/x-perl 2.5k

Message body is not shown because sender requested not to inline it.

Download 81procs.t
text/x-perl 2.5k

Message body is not shown because sender requested not to inline it.

From: chrishammond [...] ymail.com
Download (untitled) / with headers
text/plain 1.9k
When executing stored procedures via CALL, mysqld returns an additional, empty result set, to show that the procedure has completed. "... each CALL returns a result to indicate the call status, in addition to any result sets that might be returned by statements executed within the procedure." http://dev.mysql.com/doc/refman/5.0/en/call.html It's valid for more_results() to return a result set here, with no fields and no rows, but the NUM_OF_FIELDS is currently not getting reset from the previous value. The below patch resets the NUM_OF_FIELDS value to 0, and adds two tests to t/80procs.t to check that this has occured. --- DBD-mysql-4.020/dbdimp.c 2012-01-03 11:11:15.000000000 -0500 +++ DBD-mysql-4.020/dbdimp.c 2012-01-03 11:11:15.000000000 -0500 @@ -3024,7 +3024,16 @@ if (imp_sth->result == NULL) { - /* No "real" rowset*/ + /* No "real" rowset, but reset NUM_OF_FIELDS, executing a stored program + returns an empty rowset: "... each CALL returns a result to indicate + the call status, in addition to any result sets that might be returned + by statements executed within the procedure." + http://dev.mysql.com/doc/refman/5.0/en/call.html */ + DBIc_NUM_FIELDS(imp_sth)= 0; /* for DBI <= 1.53 */ + DBIS->set_attr_k(sth, sv_2mortal(newSVpvn("NUM_OF_FIELDS",13)), 0, + sv_2mortal(newSViv(0)) + ); + return 1; } else --- DBD-mysql-4.020/t/80procs.t 2012-01-03 11:11:15.000000000 -0500 +++ DBD-mysql-4.020/t/80procs.t 2012-01-03 11:11:15.000000000 - 0500 @@ -27,7 +27,7 @@ plan skip_all => "SKIP TEST: You must have MySQL version 5.0 and greater for this test to run"; } -plan tests => 29; +plan tests => 31; $dbh->disconnect(); @@ -122,6 +122,10 @@ is @$resultset, 3, "3 Rows in resultset"; +ok $sth->more_results(); + +is $sth->{NUM_OF_FIELDS}, 0, "NUM_OF_FIELDS == 0"; + local $SIG{__WARN__} = sub { die @_ }; ok $sth->finish; Regards, Chris
Download (untitled) / with headers
text/plain 253b
Hi Chris, Thanks for the bug report. I've added your test code to DBD::mysql here: https://github.com/perl5-dbi/DBD-mysql/commit/cca32f11db54ccb3644b964b73bede84a7facc5e After this, tests still pass, so your issue was fixed in the mean time. -- Mike


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.