X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=src%2Fphp_pqtxn.c;h=b48cf7e568b673b2052e7d07edb624b34bed5f79;hb=7b61b6b19fea328ec2ccd767bf9dd4d4b3c0892f;hp=fcf7a4bad5f6ee2f46b34687b20f366dd0a4024d;hpb=d613997b3072b8093bca3fe9d8aca115e2a579aa;p=m6w6%2Fext-pq diff --git a/src/php_pqtxn.c b/src/php_pqtxn.c index fcf7a4b..b48cf7e 100644 --- a/src/php_pqtxn.c +++ b/src/php_pqtxn.c @@ -32,7 +32,7 @@ zend_class_entry *php_pqtxn_class_entry; static zend_object_handlers php_pqtxn_object_handlers; static HashTable php_pqtxn_object_prophandlers; -const char *isolation_level(long *isolation) +const char *php_pq_isolation_level(long *isolation) { switch (*isolation) { case PHP_PQTXN_SERIALIZABLE: @@ -54,7 +54,7 @@ static void php_pqtxn_object_free(void *o TSRMLS_DC) fprintf(stderr, "FREE txn(#%d) %p (conn(#%d): %p)\n", obj->zv.handle, obj, obj->intern->conn->zv.handle, obj->intern->conn); #endif if (obj->intern) { - if (obj->intern->open) { + if (obj->intern->open && obj->intern->conn->intern) { PGresult *res = PQexec(obj->intern->conn->intern->conn, "ROLLBACK"); if (res) { @@ -355,7 +355,7 @@ static PHP_METHOD(pqtxn, commit) { if (!obj->intern) { throw_exce(EX_UNINITIALIZED TSRMLS_CC, "pq\\Transacation not initialized"); } else if (!obj->intern->open) { - throw_exce(EX_RUNTIME TSRMLS_CC, "pq\\Transacation already closed"); + throw_exce(EX_RUNTIME TSRMLS_CC, "pq\\Transaction already closed"); } else { PGresult *res; smart_str cmd = {0}; @@ -704,7 +704,7 @@ static PHP_METHOD(pqtxn, openLOB) { int lofd = lo_open(obj->intern->conn->intern->conn, loid, mode); if (lofd < 0) { - throw_exce(EX_RUNTIME TSRMLS_CC, "Failed to open large object with oid=%u with mode '%s' (%s)", loid, strmode(mode), PHP_PQerrorMessage(obj->intern->conn->intern->conn)); + throw_exce(EX_RUNTIME TSRMLS_CC, "Failed to open large object with oid=%u with mode '%s' (%s)", loid, php_pq_strmode(mode), PHP_PQerrorMessage(obj->intern->conn->intern->conn)); } else { php_pqlob_t *lob = ecalloc(1, sizeof(*lob)); @@ -743,12 +743,12 @@ static PHP_METHOD(pqtxn, createLOB) { Oid loid = lo_creat(obj->intern->conn->intern->conn, mode); if (loid == InvalidOid) { - throw_exce(EX_RUNTIME TSRMLS_CC, "Failed to create large object with mode '%s' (%s)", strmode(mode), PHP_PQerrorMessage(obj->intern->conn->intern->conn)); + throw_exce(EX_RUNTIME TSRMLS_CC, "Failed to create large object with mode '%s' (%s)", php_pq_strmode(mode), PHP_PQerrorMessage(obj->intern->conn->intern->conn)); } else { int lofd = lo_open(obj->intern->conn->intern->conn, loid, mode); if (lofd < 0) { - throw_exce(EX_RUNTIME TSRMLS_CC, "Failed to open large object with oid=%u with mode '%s': %s", loid, strmode(mode), PHP_PQerrorMessage(obj->intern->conn->intern->conn)); + throw_exce(EX_RUNTIME TSRMLS_CC, "Failed to open large object with oid=%u with mode '%s': %s", loid, php_pq_strmode(mode), PHP_PQerrorMessage(obj->intern->conn->intern->conn)); } else { php_pqlob_t *lob = ecalloc(1, sizeof(*lob));