cvs: php4 /ext/informix ifx.ec
| From: | Danny Heijl | Date: | Fri, 11 Aug 2000 16:37:47 +0000 |
| Subject: | cvs: php4 /ext/informix ifx.ec | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-1146@lists.php.net to get a copy of this message | ||
danny Fri Aug 11 09:37:47 2000 EDT
Modified files:
/php4/ext/informix ifx.ec
Log:
- restore ifx_close() to PHP3 behaviour for non-persistent connections
by silently reconnecting the existing link if closed earlier (danny)
Index: php4/ext/informix/ifx.ec
diff -u php4/ext/informix/ifx.ec:1.45 php4/ext/informix/ifx.ec:1.46
--- php4/ext/informix/ifx.ec:1.45 Mon Aug 7 13:45:56 2000
+++ php4/ext/informix/ifx.ec Fri Aug 11 09:37:46 2000
@@ -20,7 +20,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: ifx.ec,v 1.45 2000/08/07 20:45:56 danny Exp $ */
+/* $Id: ifx.ec,v 1.46 2000/08/11 16:37:46 danny Exp $ */
/* -------------------------------------------------------------------
* if you want a function reference : "grep '^\*\*' ifx.ec" will give
@@ -694,8 +694,26 @@
RETURN_FALSE;
}
link = (int) index_ptr->ptr;
- ptr = zend_list_find(link,&type); /* check if the link is still there */
+ ptr = zend_list_find(link, &type); /* check if the link is still there */
if (ptr && (type==IFXL(le_link) || type==IFXL(le_plink))) {
+ /* ensure that the link is not closed */
+ ifx = ptr;
+ EXEC SQL SET CONNECTION :ifx;
+ if (ifx_check() == IFX_ERROR) {
+ /* the link is closed */
+ ifx = ptr; /* reconnect silently */
+ EXEC SQL CONNECT TO :host AS :ifx
+ USER :user USING :passwd
+ WITH CONCURRENT TRANSACTION;
+
+ if (ifx_check() == IFX_ERROR) {
+ IFXG(sv_sqlcode) = SQLCODE;
+ php_error(E_WARNING,"Informix: unable to connect (%s)",
ifx_error(ifx));
+ zend_hash_del(&EG(regular_list), hashed_details, hashed_details_length+1);
+ efree(hashed_details);
+ RETURN_FALSE;
+ }
+ }
zend_list_addref(link);
return_value->value.lval = link;
php3_ifx_set_default_link(link);
@@ -822,9 +840,9 @@
ZEND_FETCH_RESOURCE2(ifx, char *, ifx_link, id, "IFX link", IFXL(le_link),
IFXL(le_plink));
- /* EXEC SQL SET CONNECTION :ifx; */
- /* EXEC SQL close database; */
- /* EXEC SQL DISCONNECT CURRENT; */
+ EXEC SQL SET CONNECTION :ifx;
+ EXEC SQL close database;
+ EXEC SQL DISCONNECT CURRENT;
zend_list_delete(id);
RETURN_TRUE;