cvs: php4 /ext/pgsql pgsql.c
| From: | Yasuo Ohgaki | Date: | Thu, 24 Jan 2002 06:20:33 +0000 |
| Subject: | cvs: php4 /ext/pgsql pgsql.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-9144@lists.php.net to get a copy of this message | ||
yohgaki Thu Jan 24 01:20:33 2002 EDT
Modified files:
/php4/ext/pgsql pgsql.c
Log:
No more httpd restart is required when PostgreSQL is rebooted.
# Works for pg_query()/pg_send_query()
Index: php4/ext/pgsql/pgsql.c
diff -u php4/ext/pgsql/pgsql.c:1.142 php4/ext/pgsql/pgsql.c:1.143
--- php4/ext/pgsql/pgsql.c:1.142 Sun Jan 20 19:36:22 2002
+++ php4/ext/pgsql/pgsql.c Thu Jan 24 01:20:33 2002
@@ -19,7 +19,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: pgsql.c,v 1.142 2002/01/21 00:36:22 yohgaki Exp $ */
+/* $Id: pgsql.c,v 1.143 2002/01/24 06:20:33 yohgaki Exp $ */
#include <stdlib.h>
@@ -829,6 +829,9 @@
ZEND_FETCH_RESOURCE2(pgsql, PGconn *, pgsql_link, id, "PostgreSQL link", le_link,
le_plink);
+ if (PQstatus(pgsql) != CONNECTION_OK) {
+ PQreset(pgsql);
+ }
convert_to_string_ex(query);
PQsetnonblocking(pgsql, 0);
while ((pgsql_result = PQgetResult(pgsql))) {
@@ -2510,6 +2513,9 @@
ZEND_FETCH_RESOURCE2(pgsql, PGconn *, &pgsql_link, id, "PostgreSQL link", le_link,
le_plink);
+ if (PQstatus(pgsql) != CONNECTION_OK) {
+ PQreset(pgsql);
+ }
if (PQsetnonblocking(pgsql, 1)) {
php_error(E_NOTICE,"%s() cannot set connection to nonblocking mode",
get_active_function_name(TSRMLS_C));