From: aspen dot olmsted at alliance dot biz
Operating system: Windows XP SP2
PHP version: 5CVS-2006-10-12 (snap)
PHP Bug Type: PDO related
Bug description: Calling a stored procedure that creates temp table
Description:
------------
If I call a stored proced that creates a temp table and inserts values and
returns a record set then pdo_odbc gets confused by the multiple record
sets unless I set nocount to on.
I am doing this against a MS_SQL 2000 sp4 database
Reproduce code:
---------------
Here is a sample sql sp:
alter procedure pdo_test as
CREATE TABLE #tmptbl
(
ItemId int
)
insert into #tmptbl VALUES (1)
select 'Hello' msg
Here is sample php:
$stmt = $dbh->prepare("exec pdo_test");
$stmt->execute();
echo "Number of columns: " . $stmt->columnCount() . "<br>";
$row = $stmt->fetch();
echo "Value of column: " . var_dump($row) . "<br>";
$stmt->nextRowset();
echo "Number of columns: " . $stmt->columnCount() . "<br>";
$row = $stmt->fetch();
echo "Value of column: " . var_dump($row) . "<br>";
Expected result:
----------------
with the other db layers it is ignoring the first record set. I think it
is proper that pdo_odbc sees the number of records modified but it does
not return any data and I can not navigate to the actual dataset
Actual result:
--------------
empty dataset
If I add 'set nocount on' to the SP then everything works fine
alter procedure pdo_test as
set nocount on
CREATE TABLE #tmptbl
(
ItemId int
)
insert into #tmptbl VALUES (1)
select 'Hello' msg
--
Edit bug report at http://bugs.php.net/?id=39136&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=39136&r=trysnapshot44
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=39136&r=trysnapshot52
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=39136&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=39136&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=39136&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=39136&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=39136&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=39136&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=39136&r=support
Expected behavior: http://bugs.php.net/fix.php?id=39136&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=39136&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=39136&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=39136&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=39136&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=39136&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=39136&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=39136&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=39136&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=39136&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=39136&r=mysqlcfg