$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");
$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");
res = PQexec(H->server, cmd);
if (PQresultStatus(res) != PGRES_COMMAND_OK) {
+ pdo_pgsql_error(dbh, PQresultStatus(res), pdo_pgsql_sqlstate(res));
ret = 0;
}
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;
}