#33877 [Fbk-Opn]: When multiple result sets are not freed subsequent queries fail
ID: 33877 User updated by: Jeffrey dot Rodriguez at gmail dot com Reported By: Jeffrey dot Rodriguez at gmail dot com -Status: Feedback +Status: Open Bug Type: MSSQL related Operating System: Windows XP / 2000 PHP Version: 5.0.4 New Comment: Issue still occurs with the latest CVS snapshot. Previous Comments: [2005-07-27 13:52:45] [EMAIL PROTECTED] 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-07-27 01:16:38] Jeffrey dot Rodriguez at gmail dot com Typo: Failure to do so will cause subsequent mssql_next_query() or mssql_select_db() calls to fail. Should read: Failure to do so will cause subsequent mssql_query() or mssql_select_db() calls to fail. [2005-07-27 00:53:09] Jeffrey dot Rodriguez at gmail dot com Description: NOTE: This issue seems to occur in versions (atleast) 4.3.4 - 5.0.4 WORKAROUND: Be sure to call mssql_free_result() on every result that has the potential to return multiple result sets. PROBLEM: When a query (stored procedure for example) returns multiple result sets, you have to call mssql_next_result() OR mssql_free_result() on the result of an mssql_query(). Failure to do so will cause subsequent mssql_next_query() or mssql_select_db() calls to fail. ADDITIONAL NOTES: The docs should be updated if this functionality is intended. Sorry about the 'excessive' length of code, I figure you can handle 8 extra lines. Reproduce code: --- ?php /* -- Stored procedure CREATE PROCEDURE bug_proofOfConcept_sp AS SELECT 'Result set one' AS 'Result Set'; SELECT 'Result set two' AS 'Result Set'; GO */ $link = mssql_connect(server, user, pass); mssql_select_db(database, $link); $rs = mssql_query(EXECUTE bug_proofOfConcept_sp); /* Note, it doesn't matter if you fetch from $rs */ /* This is where things bomb out */ if (!mssql_select_db(database, $link)) { echo Broken, as expected.\n; } /* If we free the result things work fine again. Alternatively, you could call mssql_next_result($rs) */ mssql_free_result($rs); // Select the database (3rd, and last time) if (!mssql_select_db(database, $link)) { echo Everything should be working here; wtf?\n; } ? Expected result: No output Actual result: -- Warning: mssql_select_db(): Unable to select database: database in H:\proofOfConcept.php on line 16 Broken, as expected. -- Edit this bug report at http://bugs.php.net/?id=33877edit=1
#33877 [Bgs-Opn]: When multiple result sets are not freed subsequent queries fail
ID: 33877 User updated by: Jeffrey dot Rodriguez at gmail dot com Reported By: Jeffrey dot Rodriguez at gmail dot com -Status: Bogus +Status: Open Bug Type: MSSQL related Operating System: Windows XP / 2000 PHP Version: 5.0.4 Assigned To: fmk New Comment: PHP documentation does not reflect that this is the case. Since it is PHP or the libraries that PHP uses to interface with MSSQL that are bombing out, the docs should mention this. A meaningful warning should also be thrown. Potentially freeing the result automatically in the background before issuing a new query since it will fail otherwise anyway. Previous Comments: [2005-07-27 19:20:43] [EMAIL PROTECTED] SQL Server does not allow new queries when results are pending. The client must fetch all results or free unwanted results before new queries can be executed. [2005-07-27 17:46:57] Jeffrey dot Rodriguez at gmail dot com Issue still occurs with the latest CVS snapshot. [2005-07-27 13:52:45] [EMAIL PROTECTED] 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-07-27 01:16:38] Jeffrey dot Rodriguez at gmail dot com Typo: Failure to do so will cause subsequent mssql_next_query() or mssql_select_db() calls to fail. Should read: Failure to do so will cause subsequent mssql_query() or mssql_select_db() calls to fail. [2005-07-27 00:53:09] Jeffrey dot Rodriguez at gmail dot com Description: NOTE: This issue seems to occur in versions (atleast) 4.3.4 - 5.0.4 WORKAROUND: Be sure to call mssql_free_result() on every result that has the potential to return multiple result sets. PROBLEM: When a query (stored procedure for example) returns multiple result sets, you have to call mssql_next_result() OR mssql_free_result() on the result of an mssql_query(). Failure to do so will cause subsequent mssql_next_query() or mssql_select_db() calls to fail. ADDITIONAL NOTES: The docs should be updated if this functionality is intended. Sorry about the 'excessive' length of code, I figure you can handle 8 extra lines. Reproduce code: --- ?php /* -- Stored procedure CREATE PROCEDURE bug_proofOfConcept_sp AS SELECT 'Result set one' AS 'Result Set'; SELECT 'Result set two' AS 'Result Set'; GO */ $link = mssql_connect(server, user, pass); mssql_select_db(database, $link); $rs = mssql_query(EXECUTE bug_proofOfConcept_sp); /* Note, it doesn't matter if you fetch from $rs */ /* This is where things bomb out */ if (!mssql_select_db(database, $link)) { echo Broken, as expected.\n; } /* If we free the result things work fine again. Alternatively, you could call mssql_next_result($rs) */ mssql_free_result($rs); // Select the database (3rd, and last time) if (!mssql_select_db(database, $link)) { echo Everything should be working here; wtf?\n; } ? Expected result: No output Actual result: -- Warning: mssql_select_db(): Unable to select database: database in H:\proofOfConcept.php on line 16 Broken, as expected. -- Edit this bug report at http://bugs.php.net/?id=33877edit=1
#33877 [NEW]: When multiple result sets are not freed subsequent queries fail
From: Jeffrey dot Rodriguez at gmail dot com Operating system: Windows XP / 2000 PHP version: 5.0.4 PHP Bug Type: MSSQL related Bug description: When multiple result sets are not freed subsequent queries fail Description: NOTE: This issue seems to occur in versions (atleast) 4.3.4 - 5.0.4 WORKAROUND: Be sure to call mssql_free_result() on every result that has the potential to return multiple result sets. PROBLEM: When a query (stored procedure for example) returns multiple result sets, you have to call mssql_next_result() OR mssql_free_result() on the result of an mssql_query(). Failure to do so will cause subsequent mssql_next_query() or mssql_select_db() calls to fail. ADDITIONAL NOTES: The docs should be updated if this functionality is intended. Sorry about the 'excessive' length of code, I figure you can handle 8 extra lines. Reproduce code: --- ?php /* -- Stored procedure CREATE PROCEDURE bug_proofOfConcept_sp AS SELECT 'Result set one' AS 'Result Set'; SELECT 'Result set two' AS 'Result Set'; GO */ $link = mssql_connect(server, user, pass); mssql_select_db(database, $link); $rs = mssql_query(EXECUTE bug_proofOfConcept_sp); /* Note, it doesn't matter if you fetch from $rs */ /* This is where things bomb out */ if (!mssql_select_db(database, $link)) { echo Broken, as expected.\n; } /* If we free the result things work fine again. Alternatively, you could call mssql_next_result($rs) */ mssql_free_result($rs); // Select the database (3rd, and last time) if (!mssql_select_db(database, $link)) { echo Everything should be working here; wtf?\n; } ? Expected result: No output Actual result: -- Warning: mssql_select_db(): Unable to select database: database in H:\proofOfConcept.php on line 16 Broken, as expected. -- Edit bug report at http://bugs.php.net/?id=33877edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=33877r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=33877r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=33877r=trysnapshot51 Fixed in CVS:http://bugs.php.net/fix.php?id=33877r=fixedcvs Fixed in release:http://bugs.php.net/fix.php?id=33877r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=33877r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=33877r=needscript Try newer version: http://bugs.php.net/fix.php?id=33877r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=33877r=support Expected behavior: http://bugs.php.net/fix.php?id=33877r=notwrong Not enough info: http://bugs.php.net/fix.php?id=33877r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=33877r=submittedtwice register_globals:http://bugs.php.net/fix.php?id=33877r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=33877r=php3 Daylight Savings:http://bugs.php.net/fix.php?id=33877r=dst IIS Stability: http://bugs.php.net/fix.php?id=33877r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=33877r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=33877r=float No Zend Extensions: http://bugs.php.net/fix.php?id=33877r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=33877r=mysqlcfg
#33877 [Opn]: When multiple result sets are not freed subsequent queries fail
ID: 33877 User updated by: Jeffrey dot Rodriguez at gmail dot com Reported By: Jeffrey dot Rodriguez at gmail dot com Status: Open Bug Type: MSSQL related Operating System: Windows XP / 2000 PHP Version: 5.0.4 New Comment: Typo: Failure to do so will cause subsequent mssql_next_query() or mssql_select_db() calls to fail. Should read: Failure to do so will cause subsequent mssql_query() or mssql_select_db() calls to fail. Previous Comments: [2005-07-27 00:53:09] Jeffrey dot Rodriguez at gmail dot com Description: NOTE: This issue seems to occur in versions (atleast) 4.3.4 - 5.0.4 WORKAROUND: Be sure to call mssql_free_result() on every result that has the potential to return multiple result sets. PROBLEM: When a query (stored procedure for example) returns multiple result sets, you have to call mssql_next_result() OR mssql_free_result() on the result of an mssql_query(). Failure to do so will cause subsequent mssql_next_query() or mssql_select_db() calls to fail. ADDITIONAL NOTES: The docs should be updated if this functionality is intended. Sorry about the 'excessive' length of code, I figure you can handle 8 extra lines. Reproduce code: --- ?php /* -- Stored procedure CREATE PROCEDURE bug_proofOfConcept_sp AS SELECT 'Result set one' AS 'Result Set'; SELECT 'Result set two' AS 'Result Set'; GO */ $link = mssql_connect(server, user, pass); mssql_select_db(database, $link); $rs = mssql_query(EXECUTE bug_proofOfConcept_sp); /* Note, it doesn't matter if you fetch from $rs */ /* This is where things bomb out */ if (!mssql_select_db(database, $link)) { echo Broken, as expected.\n; } /* If we free the result things work fine again. Alternatively, you could call mssql_next_result($rs) */ mssql_free_result($rs); // Select the database (3rd, and last time) if (!mssql_select_db(database, $link)) { echo Everything should be working here; wtf?\n; } ? Expected result: No output Actual result: -- Warning: mssql_select_db(): Unable to select database: database in H:\proofOfConcept.php on line 16 Broken, as expected. -- Edit this bug report at http://bugs.php.net/?id=33877edit=1