cvs: /php4/ext/interbase interbase.c

From: Date: Thu, 04 May 2000 12:28:01 +0000
Subject: cvs: /php4/ext/interbase interbase.c
Groups: php.version4 
Request: Send a blank email to php-version4+get-14463@lists.php.net to get a copy of this message
jah Thu May 4 05:28:01 2000 EDT Modified files: /php4/ext/interbase interbase.c Log: If using a persistent connection, check if it's still there and reopen if needed. Index: php4/ext/interbase/interbase.c diff -u php4/ext/interbase/interbase.c:1.24 php4/ext/interbase/interbase.c:1.25 --- php4/ext/interbase/interbase.c:1.24 Mon May 1 17:44:23 2000 +++ php4/ext/interbase/interbase.c Thu May 4 05:28:00 2000 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: interbase.c,v 1.24 2000/05/02 00:44:23 sas Exp $ */ +/* $Id: interbase.c,v 1.25 2000/05/04 12:28:00 jah Exp $ */ /* TODO: Arrays, roles? @@ -508,7 +508,7 @@ php_info_print_table_start(); php_info_print_table_row(2, "Interbase Support", "enabled"); - php_info_print_table_row(2, "Revision", "$Revision: 1.24 $"); + php_info_print_table_row(2, "Revision", "$Revision: 1.25 $"); #if defined(COMPILE_DL) || defined(COMPILE_DL_INTERBASE) php_info_print_table_row(2, "Dynamic Module", "yes"); #endif @@ -672,8 +672,24 @@ if (persistent) { list_entry *le; + int open_new_connection = 1; - if (zend_hash_find(&EG(persistent_list), hashed_details, hashed_details_length+1, (void **) &le)==FAILURE) { + if (zend_hash_find(&EG(persistent_list), hashed_details, hashed_details_length+1, (void **) &le) != FAILURE) { + char tmp_1[] = {isc_info_base_level, isc_info_end}; + char tmp_2[8]; /* Enough? Hope so... */ + + if (le->type != IBG(le_plink)) { + RETURN_FALSE; + } + /* Check if connection has timed out */ + ib_link = (ibase_db_link *) le->ptr; + if (!isc_database_info(IB_STATUS, &ib_link->link, sizeof(tmp_1), tmp_1, sizeof(tmp_2), tmp_2)) { + open_new_connection = 0; + } + } + + /* There was no previous connection to use or it has timed out */ + if (open_new_connection) { list_entry new_le; if ((IBG(max_links) != -1) && (IBG(num_links) >= IBG(max_links))) { @@ -712,12 +728,6 @@ } IBG(num_links)++; IBG(num_persistent)++; - } else { - if (le->type != IBG(le_plink)) { - RETURN_FALSE; - } - /* TODO: ensure that the ib_link did not die */ - ib_link = (ibase_db_link *) le->ptr; } return_value->value.lval = IBASE_TRANS_ON_LINK * zend_list_insert(ib_link, IBG(le_plink));

« previous php.version4 (#14463) next »