Bug #54347 mysql_server_prepare and mysql_use_result are mutually incompatible
Submitted: 8 Jun 2010 18:57 Modified: 15 Feb 2013 17:16
Reporter: Becca Turner Email Updates:
Status: Unsupported Impact on me:
None 
Category:Connectors: DBD::mysql ( Perl ) Severity:S3 (Non-critical)
Version:4.014 OS:Any
Assigned to: CPU Architecture:Any

[8 Jun 2010 18:57] Becca Turner
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";
[8 Jun 2010 19:00] Becca Turner
Example of the bug

Attachment: sp_and_ur_break.pl (text/x-perl-script), 567 bytes.

[8 Jun 2010 19:01] Becca Turner
Output from the example script on one of my machines

Attachment: sp_and_ur_break.txt (text/plain), 359 bytes.

[8 Jun 2010 21:58] Sveta Smirnova
Thank you for the report.

Verified as described.
[15 Feb 2013 17:16] Sveta Smirnova
Thank you for the report.

We don't work on DBD::mysql bugs anymore. All its bugs should go to CPAN: https://rt.cpan.org/Public/Dist/Display.html?Name=DBD-mysql

I re-submitted your report to https://rt.cpan.org/Public/Bug/Display.html?id=83357
Please subscribe to the new report on CPAN and work with DBD::mysql developers in case if they need additional details.