mirror of
https://github.com/php/php-src.git
synced 2024-11-26 11:23:47 +08:00
@- PostgreSQL now does a rollback at the end of a request on every
@ persistent connection. This is done by doing an "empty" transaction @ on the connection (This was advised by someone from the PostgreSQL @ core-team). If you leave transactions open on your page you will see a @ "NOTICE: BEGIN: already a transaction in progress" message in your @ apache error_log. This message is created by the PostgreSQL libs - we can @ do nothing about it. (Thies)
This commit is contained in:
parent
79a38a1c3a
commit
f6925611fb
@ -93,7 +93,7 @@ zend_module_entry pgsql_module_entry = {
|
||||
PHP_MINIT(pgsql),
|
||||
PHP_MSHUTDOWN(pgsql),
|
||||
PHP_RINIT(pgsql),
|
||||
NULL,
|
||||
PHP_RSHUTDOWN(pgsql),
|
||||
PHP_MINFO(pgsql),
|
||||
STANDARD_MODULE_PROPERTIES
|
||||
};
|
||||
@ -145,6 +145,29 @@ static void _close_pgsql_plink(zend_rsrc_list_entry *rsrc)
|
||||
PGG(num_links)--;
|
||||
}
|
||||
|
||||
static int _rollback_transactions(zend_rsrc_list_entry *rsrc)
|
||||
{
|
||||
PGconn *link = (PGconn *)rsrc->ptr;
|
||||
/*
|
||||
PGresult *pg_result;
|
||||
ExecStatusType status;
|
||||
*/
|
||||
|
||||
PQexec(link,"BEGIN;ROLLBACK;");
|
||||
|
||||
/* maybe do error handling later....
|
||||
pg_result = PQexec(link,"BEGIN;ROLLBACK;");
|
||||
|
||||
if (pg_result) {
|
||||
status = PQresultStatus(pg_result);
|
||||
} else {
|
||||
status = (ExecStatusType) PQstatus(link);
|
||||
}
|
||||
*/
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static void _free_ptr(zend_rsrc_list_entry *rsrc)
|
||||
{
|
||||
@ -213,6 +236,14 @@ PHP_RINIT_FUNCTION(pgsql)
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
PHP_RSHUTDOWN_FUNCTION(pgsql)
|
||||
{
|
||||
zend_hash_apply(&EG(persistent_list),_rollback_transactions);
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
||||
PHP_MINFO_FUNCTION(pgsql)
|
||||
{
|
||||
@ -491,6 +522,8 @@ PHP_FUNCTION(pg_close)
|
||||
|
||||
ZEND_FETCH_RESOURCE2(pgsql, PGconn *, pgsql_link, id, "PostgreSQL link", le_link, le_plink);
|
||||
|
||||
printf("\npg_close %d\n",id);
|
||||
|
||||
if (id==-1) { /* explicit resource number */
|
||||
zend_list_delete(Z_RESVAL_PP(pgsql_link));
|
||||
}
|
||||
|
@ -48,6 +48,7 @@ extern zend_module_entry pgsql_module_entry;
|
||||
PHP_MINIT_FUNCTION(pgsql);
|
||||
PHP_MSHUTDOWN_FUNCTION(pgsql);
|
||||
PHP_RINIT_FUNCTION(pgsql);
|
||||
PHP_RSHUTDOWN_FUNCTION(pgsql);
|
||||
PHP_MINFO_FUNCTION(pgsql);
|
||||
PHP_FUNCTION(pg_connect);
|
||||
PHP_FUNCTION(pg_pconnect);
|
||||
|
Loading…
Reference in New Issue
Block a user