summaryrefslogtreecommitdiff
path: root/ext/pdo_pgsql/pgsql_driver.c
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2010-06-10 12:11:19 +0000
committerIlia Alshanetsky <iliaa@php.net>2010-06-10 12:11:19 +0000
commit90906a91e9d719a1d25a69ef4c2dc305d019020b (patch)
tree6869646005cef8f207d6a07855a434c5318930f5 /ext/pdo_pgsql/pgsql_driver.c
parent748dd204761d707461e8169fec43fa317ccba463 (diff)
downloadphp-git-90906a91e9d719a1d25a69ef4c2dc305d019020b.tar.gz
Added inTransaction() method to PDO, with specialized support for Postgres
Diffstat (limited to 'ext/pdo_pgsql/pgsql_driver.c')
-rw-r--r--ext/pdo_pgsql/pgsql_driver.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/ext/pdo_pgsql/pgsql_driver.c b/ext/pdo_pgsql/pgsql_driver.c
index a9ce7e6032..bdb6fb9d18 100644
--- a/ext/pdo_pgsql/pgsql_driver.c
+++ b/ext/pdo_pgsql/pgsql_driver.c
@@ -497,6 +497,15 @@ static int pgsql_handle_rollback(pdo_dbh_t *dbh TSRMLS_DC)
return pdo_pgsql_transaction_cmd("ROLLBACK", dbh TSRMLS_CC);
}
+static int pgsql_handle_in_transaction(pdo_dbh_t *dbh TSRMLS_DC)
+{
+ pdo_pgsql_db_handle *H;
+
+ H = (pdo_pgsql_db_handle *)dbh->driver_data;
+
+ return PQtransactionStatus(H->server);
+}
+
/* {{{ proto string PDO::pgsqlCopyFromArray(string $table_name , array $rows [, string $delimiter [, string $null_as ] [, string $fields])
Returns true if the copy worked fine or false if error */
static PHP_METHOD(PDO, pgsqlCopyFromArray)
@@ -1020,7 +1029,9 @@ static struct pdo_dbh_methods pgsql_methods = {
pdo_pgsql_fetch_error_func,
pdo_pgsql_get_attribute,
pdo_pgsql_check_liveness, /* check_liveness */
- pdo_pgsql_get_driver_methods /* get_driver_methods */
+ pdo_pgsql_get_driver_methods, /* get_driver_methods */
+ NULL,
+ pgsql_handle_in_transaction,
};
static int pdo_pgsql_handle_factory(pdo_dbh_t *dbh, zval *driver_options TSRMLS_DC) /* {{{ */