Bug #48675 [Opn->Wfx]: sybase_ct does not support multiple result sets returned by stored procedures

From: Date: Wed, 18 Feb 2015 07:44:46 +0000
Subject: Bug #48675 [Opn->Wfx]: sybase_ct does not support multiple result sets returned by stored procedures
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-190772@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=48675&edit=1 ID: 48675 Updated by: krakjoe@php.net Reported by: lo at readyon dot com Summary: sybase_ct does not support multiple result sets returned by stored procedures -Status: Open +Status: Wont fix Type: Bug Package: Sybase-ct (ctlib) related Operating System: Mac OS X 10.5.8 (9L31a) PHP Version: 5.2.10 Block user comment: N Private report: N New Comment: The sybase maintainer has backed away from the project, since nobody new has come forward it has been removed in version 7 of PHP. For this reason, I'm marking the bug as won't fix, it can still be found by any maintainer that might come along and revive sybase as a PECL project. Previous Comments: ------------------------------------------------------------------------ [2012-04-17 09:49:18] hexes at mail dot ru PLZ!!!! Add this patch to main branch!!!! ------------------------------------------------------------------------ [2012-04-13 12:24:13] jonas at bollden dot se When will this patch find its way into the main branch? ------------------------------------------------------------------------ [2011-06-09 06:56:06] hexes at mail dot ru Gentlemen developers! When??? There is a patch, i'm not so cleaver as you, and cant use it. Can you apply it to main branch? ------------------------------------------------------------------------ [2009-09-25 17:48:18] lo at readyon dot com I haven't looked at 5.3.0. However, the changes to php_sybase_ct.c are relatively straightforward: 1. Disable cancelling/closing after successful result php_sybase_finish_results() case CS_COMPUTE_RESULT: case CS_CURSOR_RESULT: case CS_PARAM_RESULT: case CS_ROW_RESULT: /* Unexpected results, cancel them. */ php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Sybase: Unexpected results, cancelling current"); // !!!:KLS:20090624 Do not cancel when there are additional // rows. THe command will be cancelled upon next query if // sybase_next_result() is not invoked. // { fail = 1; retcode = CS_END_RESULTS; // ct_cancel(NULL, result->sybase_ptr->cmd, CS_CANCEL_CURRENT); // } break; 2. Add a sybase_next_result() function and register these functions. /* {{{ proto int sybase_next_result(int conn) Fetch the next result set */ PHP_FUNCTION(sybase_next_result) { zval **db, **sybase_link_index; int id; char *cmdbuf; sybase_link *sybase_ptr; sybase_result *result; int retcode; int restype; switch(ZEND_NUM_ARGS()) { case 1: if (zend_get_parameters_ex(1, &db) == FAILURE) { RETURN_FALSE; } id = php_sybase_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU); CHECK_LINK(id); break; case 2: if (zend_get_parameters_ex(2, &db, &sybase_link_index) == FAILURE) { RETURN_FALSE; } id = -1; break; default: WRONG_PARAM_COUNT; break; } ZEND_FETCH_RESOURCE2(sybase_ptr, sybase_link *, sybase_link_index, id, "Sybase-Link", le_link, le_plink); /* Check to see if a previous sybase_unbuffered_query has read all rows */ if (sybase_ptr->active_result_index) { zval *tmp = NULL; php_error_docref(NULL TSRMLS_CC, E_NOTICE, "called without first fetching all rows from a previous unbuffered query"); if (sybase_ptr->cmd) { ct_cancel(NULL, sybase_ptr->cmd, CS_CANCEL_ALL); } /* Get the resultset and free it */ ALLOC_ZVAL(tmp); Z_LVAL_P(tmp)= sybase_ptr->active_result_index; Z_TYPE_P(tmp)= IS_RESOURCE; INIT_PZVAL(tmp); ZEND_FETCH_RESOURCE(result, sybase_result *, &tmp, -1, "Sybase result", le_result); if (result) { php_sybase_finish_results(result TSRMLS_CC); } zval_ptr_dtor(&tmp); zend_list_delete(sybase_ptr->active_result_index); sybase_ptr->active_result_index= 0; } retcode = ct_results(sybase_ptr->cmd, &restype); switch (retcode) { case CS_SUCCEED: result = php_sybase_fetch_result_set(sybase_ptr, 0, 1); if (result == NULL) { ct_cancel(NULL, sybase_ptr->cmd, CS_CANCEL_ALL); sybase_ptr->dead = 1; RETURN_FALSE; } /* Indicate we have data in case of buffered queries */ id= ZEND_REGISTER_RESOURCE(return_value, result, le_result); sybase_ptr->active_result_index= 0 ? id : 0; break; case CS_END_RESULTS: /* No more result sets */ RETURN_FALSE; case CS_FAIL: ct_cancel(NULL, sybase_ptr->cmd, CS_CANCEL_ALL); sybase_ptr->dead = 1; /* Fall through */ case CS_CANCELED: default: RETURN_FALSE; } } /* }}} */ ------------------------------------------------------------------------ [2009-09-25 03:26:25] murali_dharan_2000 at yahoo dot com The proposed solution did not work for me on PHP 5.3.0 on Linux x86-64. This functionality is really useful to have in PHP as the power of stored procedures in Sybase is the ability to return multiple result sets and PHP needs to be enhanced to handle the same. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=48675 -- Edit this bug report at https://bugs.php.net/bug.php?id=48675&edit=1

« previous php.bugs (#190772) next »