Skip Menu |
 

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

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

People
Owner: Nobody in particular
Requestors: YKAR [...] cpan.org
Cc:
AdminCc:

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



Subject: more_results is wrong for stored procedure calls
Download (untitled) / with headers
text/plain 419b
When executing call to stored procedure (which returns single result set) DBD::st::more_results returns true, but actually where is no more results (next fetch would complain that fetch was called without execute). Other consequence is that no implicit dbd_st_finish is called (since mysql_more_results() is true) and statement handle never finalized when selectall_... methods is used. Please see attached test case.
Subject: dbd-mysql-testcase.pl
Download dbd-mysql-testcase.pl
text/x-perl 1013b
#! /usr/bin/perl use strict; use warnings; use DBI; use Data::Dump; my $dbh = DBI->connect('DBI:mysql:database=test', 'root', '', { RaiseError => 1, PrintError => 0 }); $dbh->do('DROP PROCEDURE IF EXISTS test_sproc'); $dbh->do(<<END_SQL); CREATE PROCEDURE test_sproc() BEGIN SHOW VARIABLES LIKE 'dummy'; END END_SQL test_case_2(); test_case_1(); sub test_case_1 { my $sth = $dbh->prepare('CALL test_sproc()'); $sth->execute; dd($sth->fetchrow_hashref); dd($sth->more_results); # reports that more results are available dd($sth->fetchrow_hashref); # but actually no more results (dies here) } sub test_case_2 { for (1 .. 2) { my $sth = $dbh->prepare_cached('CALL test_sproc()'); $dbh->selectall_arrayref($sth); # mysql_more_results() returns 1 and dbd_st_finish is not called # # On next iteration prepare_cached would emit warning: # prepare_cached(CALL test_sproc()) statement handle # DBI::st=HASH(0x1234567) still Active } }


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.