cvs: /php3/functions interbase.c
| From: | Jouni Ahto | Date: | Thu, 04 May 2000 12:29:34 +0000 |
| Subject: | cvs: /php3/functions interbase.c | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-18410@lists.php.net to get a copy of this message | ||
jah Thu May 4 05:29:34 2000 EDT
Modified files:
/php3/functions interbase.c
Log:
If using a persistent connection, check if it's still there and reopen if
needed.
Index: php3/functions/interbase.c
diff -u php3/functions/interbase.c:1.29 php3/functions/interbase.c:1.30
--- php3/functions/interbase.c:1.29 Mon Mar 13 10:50:55 2000
+++ php3/functions/interbase.c Thu May 4 05:29:34 2000
@@ -28,7 +28,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: interbase.c,v 1.29 2000/03/13 18:50:55 jah Exp $ */
+/* $Id: interbase.c,v 1.30 2000/05/04 12:29:34 jah Exp $ */
/* TODO: Arrays, roles?
A lot... */
@@ -531,7 +531,7 @@
php3_printf(
"<table>"
- "<tr><td>Revision:</td><td>$Revision: 1.29
$</td></tr>\n"
+ "<tr><td>Revision:</td><td>$Revision: 1.30
$</td></tr>\n"
#ifdef COMPILE_DL
"<tr><td>Dynamic
module:</td><td>Yes</td></tr>\n"
#endif
@@ -679,8 +679,24 @@
if (persistent) {
list_entry *le;
+ int open_new_connection = 1;
- if (_php3_hash_find(plist, hashed_details, hashed_details_length+1, (void **) &le)==FAILURE)
{
+ if (_php3_hash_find(plist, 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 != IBASE_GLOBAL(php3_ibase_module).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 (IBASE_GLOBAL(php3_ibase_module).max_links!=-1 &&
IBASE_GLOBAL(php3_ibase_module).num_links>=IBASE_GLOBAL(php3_ibase_module).max_links) {
@@ -716,12 +732,6 @@
}
IBASE_GLOBAL(php3_ibase_module).num_links++;
IBASE_GLOBAL(php3_ibase_module).num_persistent++;
- } else {
- if (le->type != IBASE_GLOBAL(php3_ibase_module).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 *
php3_list_insert(ib_link, IBASE_GLOBAL(php3_ibase_module).le_plink);