DBD-mysql icon indicating copy to clipboard operation
DBD-mysql copied to clipboard

mysql_server_prepare and mysql_use_result are mutually incompatible Submitted: 8 Jun 2010 18:57 [rt.cpan.org #83357]

Open mbeijen opened this issue 8 years ago • 0 comments
trafficstars

Migrated from rt.cpan.org#83357 (status was 'new')

Requestors:

Attachments:

From [email protected] on 2013-02-15 17:15:59:

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.

mbeijen avatar Nov 14 '17 19:11 mbeijen