cvs: php-src /ext/pgsql pgsql.c

From: Date: Tue, 05 Jul 2005 14:49:23 +0000
Subject: cvs: php-src /ext/pgsql pgsql.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-32692@lists.php.net to get a copy of this message
edink Tue Jul 5 10:49:23 2005 EDT Modified files: /php-src/ext/pgsql pgsql.c Log: Properly detect when the copy command fails http://cvs.php.net/diff.php/php-src/ext/pgsql/pgsql.c?r1=1.328&r2=1.329&ty=u Index: php-src/ext/pgsql/pgsql.c diff -u php-src/ext/pgsql/pgsql.c:1.328 php-src/ext/pgsql/pgsql.c:1.329 --- php-src/ext/pgsql/pgsql.c:1.328 Tue Jul 5 08:45:39 2005 +++ php-src/ext/pgsql/pgsql.c Tue Jul 5 10:49:22 2005 @@ -20,7 +20,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: pgsql.c,v 1.328 2005/07/05 12:45:39 derick Exp $ */ +/* $Id: pgsql.c,v 1.329 2005/07/05 14:49:22 edink Exp $ */ #include <stdlib.h> @@ -3327,6 +3327,7 @@ switch (status) { case PGRES_COPY_IN: if (pgsql_result) { + int command_failed = 0; PQclear(pgsql_result); zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(pg_rows), &pos); #if HAVE_PQPUTCOPYDATA @@ -3373,8 +3374,15 @@ } #endif while ((pgsql_result = PQgetResult(pgsql))) { + if (PGRES_COMMAND_OK != PQresultStatus(pgsql_result)) { + PHP_PQ_ERROR("Copy command failed: %s", pgsql); + command_failed = 1; + } PQclear(pgsql_result); } + if (command_failed) { + RETURN_FALSE; + } } else { PQclear(pgsql_result); RETURN_FALSE;

« previous php.cvs (#32692) next »