php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #29316 Executing Stored Procedure with more than one Resultset
Submitted: 2004-07-22 10:35 UTC Modified: 2005-11-18 22:25 UTC
Votes:2
Avg. Score:4.0 ± 1.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: patrick dot schutte at gmx dot de Assigned: fmk (profile)
Status: Closed Package: MSSQL related
PHP Version: 5CVS-2005-03-08 OS: Suse8.2
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: patrick dot schutte at gmx dot de
New email:
PHP Version: OS:

 

 [2004-07-22 10:35 UTC] 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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-03-06 20:51 UTC] 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


 [2005-03-08 13:51 UTC] 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-08-09 11:23 UTC] freddyz77 at tin dot it
Using FreeTDS 0.63 with post fix and current version works correctly. Tried also 0.64 (current developing version)

freddy77
 [2005-11-18 22:25 UTC] fmk@php.net
This works with the development version of FreeTDS
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 26 19:01:30 2024 UTC