cvs: php4 / NEWS /ext/pgsql pgsql.c php_pgsql.h

From: Date: Wed, 26 Sep 2001 21:44:49 +0000
Subject: cvs: php4 / NEWS /ext/pgsql pgsql.c php_pgsql.h
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-7576@lists.php.net to get a copy of this message
zeev Wed Sep 26 17:44:49 2001 EDT Modified files: /php4 NEWS /php4/ext/pgsql pgsql.c php_pgsql.h Log: Fix pg_last_notice() Index: php4/NEWS diff -u php4/NEWS:1.762 php4/NEWS:1.763 --- php4/NEWS:1.762 Wed Sep 26 03:59:04 2001 +++ php4/NEWS Wed Sep 26 17:44:48 2001 @@ -24,6 +24,7 @@ - Improved support for autoconf-2.50+/libtool 1.4b+. (Jan Kneschke, Sascha) ?? ??? 200?, Version 4.0.7 +- Fixed pg_last_notice() (Zeev) - Fixed DOM-XML's error reporting, so E_WARNING errors are given instead of E_ERROR error's, this allows you to trap errors thrown by DOMXML functions. (Sterling) Index: php4/ext/pgsql/pgsql.c diff -u php4/ext/pgsql/pgsql.c:1.128 php4/ext/pgsql/pgsql.c:1.129 --- php4/ext/pgsql/pgsql.c:1.128 Tue Sep 25 17:58:16 2001 +++ php4/ext/pgsql/pgsql.c Wed Sep 26 17:44:48 2001 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: pgsql.c,v 1.128 2001/09/25 21:58:16 jeroen Exp $ */ +/* $Id: pgsql.c,v 1.129 2001/09/26 21:44:48 zeev Exp $ */ #include <stdlib.h> @@ -160,25 +160,22 @@ PQfinish(link); PGG(num_persistent)--; PGG(num_links)--; - if(PGG(last_notice) != NULL) { - efree(PGG(last_notice)); - } } /* }}} */ /* {{{ _notice_handler */ -static void -_notice_handler(void *arg, const char *message) +static void _notice_handler(void *arg, const char *message) { TSRMLS_FETCH(); if (! PGG(ignore_notices)) { php_log_err((char *) message TSRMLS_CC); - if (PGG(last_notice) != NULL) { + if (PGG(last_notice)) { efree(PGG(last_notice)); } - PGG(last_notice) = estrdup(message); + PGG(last_notice_len) = strlen(message); + PGG(last_notice) = estrndup(message, PGG(last_notice_len)); } } /* }}} */ @@ -237,7 +234,6 @@ { PGG(num_persistent) = 0; PGG(ignore_notices) = 0; - PGG(last_notice) = NULL; } /* }}} */ @@ -283,6 +279,7 @@ { PGG(default_link)=-1; PGG(num_links) = PGG(num_persistent); + PGG(last_notice) = NULL; return SUCCESS; } /* }}} */ @@ -291,6 +288,9 @@ */ PHP_RSHUTDOWN_FUNCTION(pgsql) { + if (PGG(last_notice)) { + efree(PGG(last_notice)); + } zend_hash_apply(&EG(persistent_list), (apply_func_t) _rollback_transactions TSRMLS_CC); return SUCCESS; } @@ -923,10 +923,10 @@ Returns the last notice set by the backend */ PHP_FUNCTION(pg_last_notice) { - if (PGG(last_notice) == NULL) { - RETURN_FALSE; + if (PGG(last_notice)) { + RETURN_STRINGL(PGG(last_notice), PGG(last_notice_len), 0); } else { - RETURN_STRING(PGG(last_notice),0); + RETURN_FALSE; } } /* }}} */ Index: php4/ext/pgsql/php_pgsql.h diff -u php4/ext/pgsql/php_pgsql.h:1.32 php4/ext/pgsql/php_pgsql.h:1.33 --- php4/ext/pgsql/php_pgsql.h:1.32 Sat Jul 28 07:36:09 2001 +++ php4/ext/pgsql/php_pgsql.h Wed Sep 26 17:44:48 2001 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_pgsql.h,v 1.32 2001/07/28 11:36:09 zeev Exp $ */ +/* $Id: php_pgsql.h,v 1.33 2001/09/26 21:44:48 zeev Exp $ */ #ifndef PHP_PGSQL_H #define PHP_PGSQL_H @@ -123,6 +123,7 @@ int le_lofp,le_string; int ignore_notices; char *last_notice; + uint last_notice_len; } php_pgsql_globals;

« previous php.cvs (#7576) next »