Skip Menu |
 

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

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

People
Owner: Nobody in particular
Requestors: m.ramnarine [...] hotmail.co.uk
Cc:
AdminCc:

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



Subject: DBD::mysql - multiple statements/more_results undefined behaviour
Date: Wed, 11 May 2011 16:07:23 +0100
To: <bug-dbd-mysql [...] rt.cpan.org>
From: Michael Ramnarine <m.ramnarine [...] hotmail.co.uk>
Download (untitled) / with headers
text/plain 1.9k
Hi guys, I've been using DBD::mysql recently and have come across an (as far as I can tell) undocumented use case:(Details of my system are listed below.) With multiple statements enabled a second execute, even from a separate statement handle, will overwrite any unfetched result sets. Is this intentional or desirable? Caching on a per handle basis would have an overhead, but would lead to more deterministic behaviour. Depending on what the best course of action is I may be in a position to aid with development. However, my current skill set would likely limit me to a pure Perl implementation; I've only read XS code and my C is a bit rusty. Any feedback or advice would be appreciated. Thanks in advance, Mike System: Red Hat Enterprise Linux Server v5.3 DBD::mysql v4.017 DBI v1.614 MySQL V5.1.42 Example: #! perl use Data::Dumper; use strict; use warnings; use DBI (); use vars qw($table $test_dsn $test_user $test_password); my $dbh; eval {$dbh= DBI->connect($test_dsn, $test_user, $test_password, { RaiseError => 1, PrintError => 1, AutoCommit => 0, mysql_multi_statements => 1 });}; if ($@) {die} my ($sth1, $sth2); $sth1 = $dbh->prepare('SELECT "First Set"; SELECT "Never Seen"'); $sth2 = $dbh->prepare('SELECT "First Set too";SELECT "Overwrites with impunity"'); $sth1->execute(); $sth2->execute(); print "sth1 1st:\n".Dumper $sth1->fetchrow_arrayref(); print "sth2 1st:\n".Dumper $sth2->fetchrow_arrayref(); $sth1->more_results(); $sth2->more_results(); print "sth1 2nd: replaced\n".Dumper $sth1->fetchrow_arrayref(); print "sth2 2nd: nothing left\n".Dumper $sth2->fetchrow_arrayref(); $sth1->finish();#still active $sth2->finish();#inactive $dbh->disconnect(); Output: sth1 1st: $VAR1 = [ 'First Set' ]; sth2 1st $VAR1 = [ 'First Set too' ]; sth1 2nd - replaced $VAR1 = [ 'Overwrites with impunity' ]; sth2 2nd - nothing left $VAR1 = undef;


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.