#29316 [Com]: Executing Stored Procedure with more than one Resultset
ID: 29316
Comment by: freddyz77 at tin dot it
Reported By: patrick dot schutte at gmx dot de
Status: Assigned
Bug Type: MSSQL related
Operating System: Suse8.2
PHP Version: 5CVS-2005-03-08
Assigned To: fmk
New Comment:
Using FreeTDS 0.63 with post fix and current version works correctly.
Tried also 0.64 (current developing version)
freddy77
Previous Comments:
------------------------------------------------------------------------
[2005-03-08 13:51:30] patrick dot schutte at gmx dot de
nope, Im using php 5.1.0-dev 200508030930 with freetds 0.62.4.
The stored procedure executes 2 Select-Statements. The frist with no
result, the second with 5 lines.
On tsql-console from freetds:
1> use php
2> go
1> exec dbo.dt_mehrfach
2> go
id produktname tagesbedarf kvnr
id produktname tagesbedarf kvnr
17 Schnecken 1 Tüten / Tag 2135860009
18 Colorado 1 Tüte / Monat NULL
19 Gummibärchen 2 Tüten / tgl. NULL
20 Test NULL
16 Phantasia 12 Tüten / Woche NULL
(return status = 0)
the first line "id produktname tagesbedarf kvnr" show no
matches for the first select.
PHP:
echo "Select1: ".mssql_num_rows($rs);
mssql_next_result($rs);
echo "Select2: ".mssql_num_rows($rs);
Returns
5
5
instead 0,5 still after updating php with latetst snap.
The Problem still exists.
------------------------------------------------------------------------
[2005-03-06 20:51:38] sniper@php.net
Please try using this CVS snapshot:
http://snaps.php.net/php5-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php5-win32-latest.zip
------------------------------------------------------------------------
[2004-07-22 10:35:13] patrick dot schutte at gmx dot de
Description:
------------
I've written stored Procedures that returns 2 and more Resultsets
(Select-Querys). If one of theese Results doesn't have any Matches I
get the next one instead.
System: Suse8.2, freetds 0.62.3 ./configure ... --with-mssql
freetds with TDS-Version 7.0 and MSSQL-Server2000. Same Code works fine
with WindowsNT4.0
Reproduce code:
---------------
CREATE PROCEDURE [dbo].[dt_mehrfach] AS
-- first Query: no match
SELECT * FROM tbl_haribo
WHERE id=10000
-- second Query: 15 matches
SELECT * FROM tbl_haribo
PHP:
$p=mssql_init("dt_mehrfach);
$result=mssql_execute($p);
echo mssql_num_rows($result)."<br />\n";
mssql_next_result($result);
echo mssql_num_rows($result);
Expected result:
----------------
0
15
would be ok
Actual result:
--------------
but I get
15
15
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=29316&edit=1
Thread (6 messages)