|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2003-05-18 11:26 UTC] uk at dataway dot ch
Between php 4.3.0 and php 4.3.2RC2, the behaviour of sybase_query was changed; now, it only looks at the very first result from the server, whereas before it returned the first result set which contained any data.
<p>
I know that similar issues have come up before, and that you comment in the source code that applications shouldn't be doing stuff that returns multiple result sets. The problem is that we have many stored procedures which, although they only return one *data* result set (CS_ROW_RESULT), this is preceded by several dummy results (CS_CMD_SUCCEED or CS_CMD_DONE) due to other commands in the stored procedure.
<p>
I would like to submit that the correct behaviour is in fact the one exhibited by php 4.3.0: if several result sets are returned from the server, then sybase_query should return the first one which actually contains data.
I urge you to consider this, as I can't imagine anyone being more interested in a CS_CMD_DONE than in a following CS_ROW_RESULT.
<p>
Anyway this is the patch I used to get everything working again:
<p>
<pre>
*** php_sybase_ct.c.orig Sun May 18 17:49:26 2003
--- php_sybase_ct.c Sun May 18 17:58:02 2003
***************
*** 1386,1394 ****
case CS_CURSOR_RESULT:
case CS_PARAM_RESULT:
case CS_ROW_RESULT:
- /* Unexpected results, cancel them. */
case CS_STATUS_RESULT:
! ct_cancel(NULL, sybase_ptr->cmd, CS_CANCEL_CURRENT);
break;
default:
--- 1386,1405 ----
case CS_CURSOR_RESULT:
case CS_PARAM_RESULT:
case CS_ROW_RESULT:
case CS_STATUS_RESULT:
! if (status != Q_RESULT) {
! result = php_sybase_fetch_result_set(sybase_ptr, buffered, store);
! if (result == NULL) {
! ct_cancel(NULL, sybase_ptr->cmd, CS_CANCEL_ALL);
! sybase_ptr->dead = 1;
! RETURN_FALSE;
! }
! status = Q_RESULT;
! }
! else {
! /* Unexpected results, cancel them. */
! ct_cancel(NULL, sybase_ptr->cmd, CS_CANCEL_CURRENT);
! }
break;
default:
</pre>
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 01 00:00:01 2025 UTC |
Here (with a slight correction, CS_STATUS_RESULT doesn't return a result set) --- ext/sybase_ct/php_sybase_ct.c.orig Sun May 18 17:49:26 2003 +++ ext/sybase_ct/php_sybase_ct.c Sun May 18 18:37:11 2003 @@ -1386,8 +1386,22 @@ case CS_CURSOR_RESULT: case CS_PARAM_RESULT: case CS_ROW_RESULT: - /* Unexpected results, cancel them. */ + if (status != Q_RESULT) { + result = php_sybase_fetch_result_set(sybase_ptr, buffered, store); + if (result == NULL) { + ct_cancel(NULL, sybase_ptr->cmd, CS_CANCEL_ALL); + sybase_ptr->dead = 1; + RETURN_FALSE; + } + status = Q_RESULT; + } + else { + /* Unexpected results, cancel them. */ + ct_cancel(NULL, sybase_ptr->cmd, CS_CANCEL_CURRENT); + } + break; case CS_STATUS_RESULT: + /* Unexpected results, cancel them. */ ct_cancel(NULL, sybase_ptr->cmd, CS_CANCEL_CURRENT); break;