|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #44305 odbc_next_result - mysql procedure with multiple results
Submitted: 2008-03-01 17:04 UTC Modified: 2021-03-26 15:33 UTC
Avg. Score:3.4 ± 1.2
Reproduced:4 of 4 (100.0%)
Same Version:1 (25.0%)
Same OS:0 (0.0%)
From: martin dot dufka at atlas dot cz Assigned:
Status: Verified Package: ODBC related
PHP Version: 7.3 OS: WIN2000
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2008-03-01 17:04 UTC] martin dot dufka at atlas dot cz
problem with: odbc_next_result()
mysql-server: 5.0.51a (.45-the same problem)
odbc driver: Driver={MySQL ODBC 3.51 Driver}

when MySQL procedure returns 2 rowsets, after the second rowset odbc_next_result() returns true. 

Reproduce code:
CREATE PROCEDURE `multiplerowsets`()
  select 'rs1';
  select 'rs2';
  $dsn="Driver={MySQL ODBC 3.51 Driver};Server=localhost;Port=3306;Database=db_name;";

  $query="call multiplerowsets";

    $row=odbc_fetch_array ($result); var_dump(odbc_next_result($result));
    $row=odbc_fetch_array ($result); var_dump(odbc_next_result($result));
    $row=odbc_fetch_array ($result); var_dump(odbc_next_result($result));

Expected result:
bool(true) bool(false) bool(false)

Actual result:
bool(true) bool(true) 
Warning: odbc_fetch_array() [function.odbc-fetch-array]: No tuples available at this result index in D:\Apache2.2\htdocs\test\x.php on line 19


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2020-10-02 21:36 UTC]
-Status: Open +Status: Verified -PHP Version: 5.2.5 +PHP Version: 7.3
 [2020-10-02 21:36 UTC]
I can confirm the reported behavior for PHP-7.3 with the MySQL
ODBC 8.0 Unicode driver, while the ODBC driver 17 for SQL Server
behaves as expected.  PDO_ODBC shows basically the same behavior.

It seems to me that adding the additional result set is a quirk
of MySQL, but I don't see how that result set would be useful in
any way, since SQLNumResultCols() as well as SQLRowCount() yield
zero for it.
 [2021-03-26 15:33 UTC]
-Type: Bug +Type: Documentation Problem
 [2021-03-26 15:33 UTC]
This is indeed expected behavior with MySQL[1] (and maybe other

| This is because each CALL returns a result to indicate the call
| status, in addition to any result sets that might be returned by
| statements executed within the procedure.

I think we should document that the warning can be prevented by
checking for `odbc_num_fields($result) > 0` before fetching.

[1] <>
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Mar 04 19:01:32 2024 UTC