]> granicus.if.org Git - php/commitdiff
Fixed bug #37870 (pgo_pgsql tries to de-allocate unused statements).
authorIlia Alshanetsky <iliaa@php.net>
Tue, 19 Sep 2006 15:45:22 +0000 (15:45 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Tue, 19 Sep 2006 15:45:22 +0000 (15:45 +0000)
Fixed bug #36681 (pdo_pgsql driver incorrectly ignored some errors).
Fixed test for bug #38253 not to use faulty SQL that generates errors in
PostgreSQL

NEWS
ext/pdo/tests/bug_38253.phpt
ext/pdo_pgsql/pgsql_driver.c
ext/pdo_pgsql/pgsql_statement.c

diff --git a/NEWS b/NEWS
index 5637b432eceab2d4b076fdedee26d23c956b3d0e..6f2be7ae6b56fa9b4a7c7ce56de159d9583e8178 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,10 @@ PHP                                                                        NEWS
   (Tony)
 - Fixed bug #38574 (missing curl constants and improper constant detection).
   (Ilia)
+- Fixed bug #37870 (pgo_pgsql tries to de-allocate unused statements).
+  (Ilia, ce at netage dot bg)
+- Fixed bug #36681 (pdo_pgsql driver incorrectly ignored some errors). (Wez,
+  Ilia)
 - Fixed bug #34066 (recursive array_walk causes segfault). (Tony)
 
 14 Sep 2006, PHP 5.2.0RC4
index 713eefb701f103a73851874088b4e7a161f8fb18..6dfdab8df1146099bc39ef66d9a7dbf5becaea80 100644 (file)
@@ -15,7 +15,7 @@ require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc';
 $pdo = PDOTest::factory();
 
 $pdo->exec ("create table test (id integer primary key, n text)");
-$pdo->exec ("INSERT INTO test (n) VALUES ('hi')");
+$pdo->exec ("INSERT INTO test (id, n) VALUES (1, 'hi')");
 
 $pdo->setAttribute (PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_CLASS);
 $stmt = $pdo->prepare ("SELECT * FROM test");
@@ -25,7 +25,7 @@ var_dump($stmt->fetchAll());
 $pdo = PDOTest::factory();
 
 $pdo->exec ("create table test2 (id integer primary key, n text)");
-$pdo->exec ("INSERT INTO test2 (n) VALUES ('hi')");
+$pdo->exec ("INSERT INTO test2 (id, n) VALUES (1,'hi')");
 
 $pdo->setAttribute (PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_FUNC);
 $stmt = $pdo->prepare ("SELECT * FROM test2");
index ed28052d2c2f7716a09ddd924043200a880d9e46..11f320e4167221e76bf33d622a1ff15a6293774e 100644 (file)
@@ -472,6 +472,7 @@ static int pdo_pgsql_transaction_cmd(const char *cmd, pdo_dbh_t *dbh TSRMLS_DC)
        res = PQexec(H->server, cmd);
 
        if (PQresultStatus(res) != PGRES_COMMAND_OK) {
+               pdo_pgsql_error(dbh, PQresultStatus(res), pdo_pgsql_sqlstate(res));
                ret = 0;
        }
 
index a1488b5a39293afc3115338c22839ac0d5a4f6e6..2821fe880bd8ced3623cd3a97675617c46e37f9c 100644 (file)
@@ -60,10 +60,14 @@ static int pgsql_stmt_dtor(pdo_stmt_t *stmt TSRMLS_DC)
                char *q = NULL;
                PGresult *res;
 
-               spprintf(&q, 0, "DEALLOCATE %s", S->stmt_name);
-               res = PQexec(H->server, q);
-               efree(q);
-               if (res) PQclear(res);
+               if (S->is_prepared) {
+                       spprintf(&q, 0, "DEALLOCATE %s", S->stmt_name);
+                       res = PQexec(H->server, q);
+                       efree(q);
+                       if (res) {
+                               PQclear(res);
+                       }
+               }
                efree(S->stmt_name);
                S->stmt_name = NULL;
        }