cvs: php4 /ext/interbase interbase.c
| From: | Daniela Mariaschi | Date: | Mon, 05 May 2003 22:25:29 +0000 |
| Subject: | cvs: php4 /ext/interbase interbase.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-20719@lists.php.net to get a copy of this message | ||
daniela Mon May 5 18:25:29 2003 EDT
Modified files:
/php4/ext/interbase interbase.c
Log:
- removed error message in dtor
(causing segfault when user doesn't free statement)
- removed erroneous controls as for bug #23436
Index: php4/ext/interbase/interbase.c
diff -u php4/ext/interbase/interbase.c:1.103 php4/ext/interbase/interbase.c:1.104
--- php4/ext/interbase/interbase.c:1.103 Sun Mar 16 00:00:50 2003
+++ php4/ext/interbase/interbase.c Mon May 5 18:25:29 2003
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: interbase.c,v 1.103 2003/03/16 05:00:50 sniper Exp $ */
+/* $Id: interbase.c,v 1.104 2003/05/05 22:25:29 daniela Exp $ */
/* TODO: Arrays, roles?
@@ -385,21 +385,14 @@
*/
static void _php_ibase_free_result(zend_rsrc_list_entry *rsrc TSRMLS_DC)
{
- char tr_items[] = {isc_info_tra_id };
- char tmp[32]; /* should be enough as on the Api doc */
-
ibase_result *ib_result = (ibase_result *) rsrc->ptr;
- IBDEBUG("Freeing result...");
+ IBDEBUG("Freeing result by dtor...");
if (ib_result) {
_php_ibase_free_xsqlda(ib_result->out_sqlda);
- isc_transaction_info(IB_STATUS, &ib_result->trans,sizeof(tr_items), tr_items, sizeof(tmp),
tmp);
- /* we have a transaction still open and we really want to drop the statement ? */
- if (!(IB_STATUS[0] && IB_STATUS[1]) && ib_result->drop_stmt &&
ib_result->stmt) {
- IBDEBUG("Dropping statement handle (free_result)...");
- if (isc_dsql_free_statement(IB_STATUS, &ib_result->stmt, DSQL_drop)) {
- _php_ibase_error(TSRMLS_C);
- }
+ if (ib_result->drop_stmt && ib_result->stmt) {
+ IBDEBUG("Dropping statement handle (free_result dtor)...");
+ isc_dsql_free_statement(IB_STATUS, &ib_result->stmt, DSQL_drop);
} else {
/* Shouldn't be here unless query was select and had parameter
placeholders, in which case ibase_execute handles this???
@@ -423,9 +416,6 @@
/* {{{ _php_ibase_free_query() */
static void _php_ibase_free_query(ibase_query *ib_query TSRMLS_DC)
{
- char tr_items[] = {isc_info_tra_id };
- char tmp[32] ; /* ...should be enough as on the Api doc */
-
IBDEBUG("Freeing query...");
if (ib_query) {
if (ib_query->in_sqlda) {
@@ -434,9 +424,7 @@
if (ib_query->out_sqlda) {
efree(ib_query->out_sqlda);
}
- isc_transaction_info(IB_STATUS, &ib_query->trans,sizeof(tr_items), tr_items, sizeof(tmp),
tmp);
- /* we have the trans still open and a statement to drop? */
- if (!(IB_STATUS[0] && IB_STATUS[1]) && ib_query->stmt) {
+ if (ib_query->stmt) {
IBDEBUG("Dropping statement handle (free_query)...");
if (isc_dsql_free_statement(IB_STATUS, &ib_query->stmt, DSQL_drop)) {
_php_ibase_error(TSRMLS_C);
@@ -453,12 +441,33 @@
}
/* }}} */
+/* {{{ php_ibase_free_query_rsrc() */
static void php_ibase_free_query_rsrc(zend_rsrc_list_entry *rsrc TSRMLS_DC)
{
- ibase_query *query = (ibase_query *)rsrc->ptr;
+ ibase_query *ib_query = (ibase_query *)rsrc->ptr;
- _php_ibase_free_query(query TSRMLS_CC);
+ IBDEBUG("Freeing query by dtor...");
+ if (ib_query) {
+ if (ib_query->in_sqlda) {
+ efree(ib_query->in_sqlda);
+ }
+ if (ib_query->out_sqlda) {
+ efree(ib_query->out_sqlda);
+ }
+ if (ib_query->stmt) {
+ IBDEBUG("Dropping statement handle (free_query dtor)...");
+ isc_dsql_free_statement(IB_STATUS, &ib_query->stmt, DSQL_drop);
+ }
+ if (ib_query->in_array) {
+ efree(ib_query->in_array);
+ }
+ if (ib_query->out_array) {
+ efree(ib_query->out_array);
+ }
+ efree(ib_query);
+ }
}
+/* }}} */
/* {{{ _php_ibase_free_blob() */
static void _php_ibase_free_blob(zend_rsrc_list_entry *rsrc TSRMLS_DC)
@@ -613,7 +622,7 @@
php_info_print_table_start();
php_info_print_table_row(2, "Interbase Support", "enabled");
- php_info_print_table_row(2, "Revision", "$Revision: 1.103 $");
+ php_info_print_table_row(2, "Revision", "$Revision: 1.104 $");
#ifdef COMPILE_DL_INTERBASE
php_info_print_table_row(2, "Dynamic Module", "yes");
#endif