#39136 [Asn->Fbk]: Calling a stored procedure that creates temp table
| From: | jani@php.net | Date: | Sat, 25 Apr 2009 14:39:15 +0000 |
| Subject: | #39136 [Asn->Fbk]: Calling a stored procedure that creates temp table | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-136244@lists.php.net to get a copy of this message | ||
ID: 39136
Updated by: jani@php.net
Reported By: aspen dot olmsted at alliance dot biz
-Status: Assigned
+Status: Feedback
Bug Type: PDO related
Operating System: Windows XP SP2
PHP Version: 5CVS-2006-10-12 (snap)
Assigned To: wez
New Comment:
Please try using this CVS snapshot:
http://snaps.php.net/php5.2-latest.tar.gz
For Windows:
http://windows.php.net/snapshots/
Previous Comments:
------------------------------------------------------------------------
[2006-10-12 13:44:54] aspen dot olmsted at alliance dot biz
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 this bug report at http://bugs.php.net/?id=39136&edit=1