php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #39136 Calling a stored procedure that creates temp table
Submitted: 2006-10-12 13:44 UTC Modified: 2009-05-03 01:00 UTC
Votes:3
Avg. Score:3.3 ± 0.5
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:0 (0.0%)
From: aspen dot olmsted at alliance dot biz Assigned: wez (profile)
Status: No Feedback Package: PDO related
PHP Version: 5CVS-2006-10-12 (snap) OS: Windows XP SP2
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2006-10-12 13:44 UTC] 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


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-04-25 14:39 UTC] jani@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/


 [2009-05-03 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2023-03-08 21:23 UTC] tbare83 at gmail dot com
PHP 7.4 on ubuntu 20.04 - bug is still present.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Apr 29 19:01:30 2024 UTC