CC: | oyama [...] module.jp |
Subject: | CALL procedure hangs at execute.... |
Date: | Sun, 02 Nov 2008 20:54:22 +0000 |
To: | bug-DBD-mysqlPP [...] rt.cpan.org |
From: | arrgee1991 <arrgee1991 [...] gmail.com> |
for some reason calling a procedure does not work. however the
procedure will run from my SQL monitor. is this a known issue?
on windows xp version 5.1 (Build 2600.xpsp_sp3_gdr.080814-1236:Service
Pack3)/active perl 5.10.0 build 1004/Pure Perl MySQL driver for the DBI
Version: 0.04
Released: 2003-01-24
Author: Hiroyuki OYAMA <oyama@module.jp>
CPAN: http://search.cpan.org/dist/DBD-mysqlPP-0.04/
*
sql2.pl*
#!/usr/bin/perl
use strict;
use DBI;
use IO::Handle;
STDOUT->autoflush(1);
# Connect to the database.
my $dbh =
DBI->connect("dbi:mysqlPP:database=test;host=localhost;mysql_multi_results=1;mysql_server_prepare=1",
"root", "password",
{'RaiseError' => 1, AutoCommit => 1});
$dbh->do("drop procedure if exists someproc") or print $DBI::errstr;
print "8\n";
$dbh->do("create procedure someproc() deterministic
begin
declare a,b,c,d int;
set a=1;
set b=2;
set c=3;
set d=4;
select a, b, c, d;
select d, c, b, a;
select b, a, c, d;
select c, b, d, a;
end") or print $DBI::errstr;
print "9\n";
my $sth=$dbh->prepare('call someproc();') || die $DBI::err.":
".$DBI::errstr;
print "10\n";
* $sth->execute || die DBI::err.": ".$DBI::errstr; ## stops here*
print "11\n";
my $rowset=0;
my $i=0;
my $colno;
do {
print "\nRowset ".++$i."\n---------------------------------------\n\n";
foreach $colno (0..$sth->{NUM_OF_FIELDS}) {
print $sth->{NAME}->[$colno]."\t";
}
print "\n";
while (my @row= $sth->fetchrow_array()) {
my $field;
foreach $field (0..$#row) {
print $row[$field]."\t";
}
print "\n";
}
} until (!$sth->more_results);
$dbh->disconnect() || die "$DBI::errstr";
*DOS*
C:\>perl sql2.pl
8
9
10
/<then hangs>/
*
MySQL Monitor*
Show quoted text
mysql> call someproc;
+------+------+------+------+
| a | b | c | d |
+------+------+------+------+
| 1 | 2 | 3 | 4 |
+------+------+------+------+
1 row in set (0.00 sec)
+------+------+------+------+
| d | c | b | a |
+------+------+------+------+
| 4 | 3 | 2 | 1 |
+------+------+------+------+
1 row in set (0.00 sec)
+------+------+------+------+
| b | a | c | d |
+------+------+------+------+
| 2 | 1 | 3 | 4 |
+------+------+------+------+
1 row in set (0.01 sec)
+------+------+------+------+
| c | b | d | a |
+------+------+------+------+
| 3 | 2 | 4 | 1 |
+------+------+------+------+
1 row in set (0.01 sec)
Query OK, 0 rows affected (0.03 sec)