Skip Menu |
 

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

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

People
Owner: Nobody in particular
Requestors: sveta.smirnova [...] oracle.com
Cc:
AdminCc:

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



Subject: mysql_server_prepare and mysql_use_result are mutually incompatible Submitted: 8 Jun 2010 18:57
Download (untitled) / with headers
text/plain 1.2k
Originally reported by Becca Turner at http://bugs.mysql.com/bug.php?id=54347 Description: If you enable both mysql_server_prepare and mysql_use_result then all queries result in statement handles that give this error when you call fetchrow_* on them: Attempt to read a row while there is no result set associated with the statement How to repeat: The code below should print 'result=1' but instead generates the error 'DBD::mysql::st fetchrow_array failed: Attempt to read a row while there is no result set associated with the statement'. Disabling either server_prepare or use_result makes it work as expected. my $dbh = DBI->connect( 'dbi:mysql:', $user, $pass ); $dbh->{'mysql_server_prepare'} = 1; $dbh->{'mysql_use_result'} = 1; my $sth = $dbh->prepare( "SELECT 1" ); $sth->execute; my ($result) = $sth->fetchrow_array; print "result=$result\n"; Output of attached test: #Server version: 5.0.51a-24+lenny3 (Debian) DBI: 1.611 DBD::mysql 4.014 SQL: SELECT 1 server_prepare=0, use_result=0: 1 server_prepare=0, use_result=1: 1 server_prepare=1, use_result=0: 1 server_prepare=1, use_result=1: DBD::mysql::st fetchrow_array failed: Attempt to read a row while there is no result set associated with the statement at test.pl line 18.
Subject: sp_and_ur_break.pl
Download sp_and_ur_break.pl
text/x-perl 567b
use DBI; my $dbh = DBI->connect( 'dbi:mysql:', @ARGV ) or die "Could not connect.\n"; my $sql = "SELECT 1"; print "DBI: $DBI::VERSION\n"; print "DBD::mysql $DBD::mysql::VERSION\n"; print "SQL: $sql\n"; $|=1; for my $sp ( 0..1 ) { $dbh->{'mysql_server_prepare'} = $sp; for my $ur ( 0..1 ) { print "server_prepare=$sp, use_result=$ur: "; $dbh->{'mysql_use_result'} = $ur; my $sth = $dbh->prepare( $sql ); $sth->execute; my ($result) = $sth->fetchrow_array; $sth->finish; print "$result\n"; } }


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.