#39141 [Asn->Bgs]: Only one prepared statement allowed per pdo object
| From: | wez@php.net | Date: | Sun, 15 Oct 2006 18:11:02 +0000 |
| Subject: | #39141 [Asn->Bgs]: Only one prepared statement allowed per pdo object | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-103574@lists.php.net to get a copy of this message | ||
ID: 39141
Updated by: wez@php.net
Reported By: aspen dot olmsted at alliance dot biz
-Status: Assigned
+Status: Bogus
Bug Type: PDO related
Operating System: Windows XP SP2
PHP Version: 5CVS-2006-10-12 (snap)
Assigned To: wez
New Comment:
Expected behavior. You must consume all the rows from the first
statement handle before kicking off a second query.
You can do this more conveniently using fetchAll().
Previous Comments:
------------------------------------------------------------------------
[2006-10-12 19:53:36] aspen dot olmsted at alliance dot biz
Description:
------------
If I try to open a 2nd statement handle against prepared statement on
SQL 2000 and windows the 2nd attempt will fail.
I can create a new object per statement and it is fine.
The problem is only happening on prepared stored procedures. If I
prepare a sql statement it seems fine.
Reproduce code:
---------------
$stmt = $dbh->prepare("exec pdo_test");
$stmt->execute();
echo $x . " " . var_dump($stmt->fetch()) . "<br>";
// $stmt = null;
$stmt2 = $dbh->prepare("exec pdo_test");
$stmt2->execute();
echo $x . " " . var_dump($stmt2->fetch()) . "<br>";
Here is the sql to create SP:
create procedure pdo_test as
select 'Hello' msg
Expected result:
----------------
Hoping both statements would print the array with Hello in it
Actual result:
--------------
The second result will print false. If I uncomment the $stmt = null;
then everything works great.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=39141&edit=1