#endif
if (obj->intern) {
if (obj->intern->open && obj->intern->conn->intern) {
- PGresult *res = PQexec(obj->intern->conn->intern->conn, "ROLLBACK");
+ PGresult *res = php_pq_exec(obj->intern->conn->intern->conn, "ROLLBACK");
if (res) {
- PHP_PQclear(res);
+ php_pq_clear_res(res);
}
}
php_pq_object_delref(obj->intern->conn TSRMLS_CC);
switch ((obj->intern->isolation = Z_LVAL_P(zisolation))) {
case PHP_PQTXN_READ_COMMITTED:
- res = PQexec(obj->intern->conn->intern->conn, "SET TRANSACTION ISOLATION LEVEL READ COMMITED");
+ res = php_pq_exec(obj->intern->conn->intern->conn, "SET TRANSACTION ISOLATION LEVEL READ COMMITED");
break;
case PHP_PQTXN_REPEATABLE_READ:
- res = PQexec(obj->intern->conn->intern->conn, "SET TRANSACTION ISOLATION LEVEL REPEATABLE READ");
+ res = php_pq_exec(obj->intern->conn->intern->conn, "SET TRANSACTION ISOLATION LEVEL REPEATABLE READ");
break;
case PHP_PQTXN_SERIALIZABLE:
- res = PQexec(obj->intern->conn->intern->conn, "SET TRANSACTION ISOLATION LEVEL SERIALIZABLE");
+ res = php_pq_exec(obj->intern->conn->intern->conn, "SET TRANSACTION ISOLATION LEVEL SERIALIZABLE");
break;
default:
obj->intern->isolation = orig;
if (res) {
php_pqres_success(res TSRMLS_CC);
- PHP_PQclear(res);
+ php_pq_clear_res(res);
}
}
PGresult *res;
if ((obj->intern->readonly = z_is_true(value))) {
- res = PQexec(obj->intern->conn->intern->conn, "SET TRANSACTION READ ONLY");
+ res = php_pq_exec(obj->intern->conn->intern->conn, "SET TRANSACTION READ ONLY");
} else {
- res = PQexec(obj->intern->conn->intern->conn, "SET TRANSACTION READ WRITE");
+ res = php_pq_exec(obj->intern->conn->intern->conn, "SET TRANSACTION READ WRITE");
}
if (res) {
php_pqres_success(res TSRMLS_CC);
- PHP_PQclear(res);
+ php_pq_clear_res(res);
}
}
PGresult *res;
if ((obj->intern->deferrable = z_is_true(value))) {
- res = PQexec(obj->intern->conn->intern->conn, "SET TRANSACTION DEFERRABLE");
+ res = php_pq_exec(obj->intern->conn->intern->conn, "SET TRANSACTION DEFERRABLE");
} else {
- res = PQexec(obj->intern->conn->intern->conn, "SET TRANSACTION NOT DEFERRABLE");
+ res = php_pq_exec(obj->intern->conn->intern->conn, "SET TRANSACTION NOT DEFERRABLE");
}
if (res) {
php_pqres_success(res TSRMLS_CC);
- PHP_PQclear(res);
+ php_pq_clear_res(res);
}
}
smart_str_appends(&cmd, "\"");
smart_str_0(&cmd);
- res = PQexec(obj->intern->conn->intern->conn, cmd.c);
+ res = php_pq_exec(obj->intern->conn->intern->conn, cmd.c);
if (!res) {
throw_exce(EX_RUNTIME TSRMLS_CC, "Failed to create %s (%s)", cmd.c, PHP_PQerrorMessage(obj->intern->conn->intern->conn));
} else {
php_pqres_success(res TSRMLS_CC);
- PHP_PQclear(res);
+ php_pq_clear_res(res);
}
smart_str_free(&cmd);
smart_str cmd = {0};
if (!obj->intern->savepoint) {
- res = PQexec(obj->intern->conn->intern->conn, "COMMIT");
+ res = php_pq_exec(obj->intern->conn->intern->conn, "COMMIT");
} else {
smart_str_appends(&cmd, "RELEASE SAVEPOINT \"");
smart_str_append_unsigned(&cmd, obj->intern->savepoint--);
smart_str_appends(&cmd, "\"");
smart_str_0(&cmd);
- res = PQexec(obj->intern->conn->intern->conn, cmd.c);
+ res = php_pq_exec(obj->intern->conn->intern->conn, cmd.c);
}
if (!res) {
obj->intern->open = 0;
}
}
- PHP_PQclear(res);
+ php_pq_clear_res(res);
}
smart_str_free(&cmd);
smart_str cmd = {0};
if (!obj->intern->savepoint) {
- res = PQexec(obj->intern->conn->intern->conn, "ROLLBACK");
+ res = php_pq_exec(obj->intern->conn->intern->conn, "ROLLBACK");
} else {
smart_str_appends(&cmd, "ROLLBACK TO SAVEPOINT \"");
smart_str_append_unsigned(&cmd, obj->intern->savepoint--);
smart_str_appends(&cmd, "\"");
smart_str_0(&cmd);
- res = PQexec(obj->intern->conn->intern->conn, cmd.c);
+ res = php_pq_exec(obj->intern->conn->intern->conn, cmd.c);
}
if (!res) {
obj->intern->open = 0;
}
}
- PHP_PQclear(res);
+ php_pq_clear_res(res);
}
smart_str_free(&cmd);
if (!obj->intern) {
throw_exce(EX_UNINITIALIZED TSRMLS_CC, "pq\\Transaction not initialized");
} else {
- PGresult *res = PQexec(obj->intern->conn->intern->conn, "SELECT pg_export_snapshot()");
+ PGresult *res = php_pq_exec(obj->intern->conn->intern->conn, "SELECT pg_export_snapshot()");
if (!res) {
throw_exce(EX_RUNTIME TSRMLS_CC, "Failed to export transaction snapshot (%s)", PHP_PQerrorMessage(obj->intern->conn->intern->conn));
RETVAL_STRING(PQgetvalue(res, 0, 0), 1);
}
- PHP_PQclear(res);
+ php_pq_clear_res(res);
}
php_pqconn_notify_listeners(obj->intern->conn TSRMLS_CC);
smart_str_appends(&cmd, sid);
smart_str_0(&cmd);
- res = PQexec(obj->intern->conn->intern->conn, cmd.c);
+ res = php_pq_exec(obj->intern->conn->intern->conn, cmd.c);
if (!res) {
throw_exce(EX_RUNTIME TSRMLS_CC, "Failed to import transaction snapshot (%s)", PHP_PQerrorMessage(obj->intern->conn->intern->conn));
} else {
php_pqres_success(res TSRMLS_CC);
- PHP_PQclear(res);
+ php_pq_clear_res(res);
}
smart_str_free(&cmd);