diff options
author | Zeev Suraski <zeev@php.net> | 2000-02-05 17:26:35 +0000 |
---|---|---|
committer | Zeev Suraski <zeev@php.net> | 2000-02-05 17:26:35 +0000 |
commit | 39cb8fe0ac56d1fb5639b0bf6df59faab1cbccbb (patch) | |
tree | 08cd77ac6f58404b1bf73a44f3f5020588e9e496 /ext/pgsql | |
parent | bf609338ae8aa3412d36ad062162a37a2285fb8d (diff) | |
download | php-git-39cb8fe0ac56d1fb5639b0bf6df59faab1cbccbb.tar.gz |
Fix PostgreSQL startup routine in thread-safe mode
Diffstat (limited to 'ext/pgsql')
-rw-r--r-- | ext/pgsql/pgsql.c | 28 | ||||
-rw-r--r-- | ext/pgsql/php_pgsql.h | 1 |
2 files changed, 19 insertions, 10 deletions
diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c index f95e1b0be8..6349802818 100644 --- a/ext/pgsql/pgsql.c +++ b/ext/pgsql/pgsql.c @@ -26,6 +26,7 @@ #endif #include "php.h" +#include "php_ini.h" #include "ext/standard/php_standard.h" #include "php_pgsql.h" #include "php_globals.h" @@ -75,7 +76,7 @@ function_entry pgsql_functions[] = { }; zend_module_entry pgsql_module_entry = { - "PostgreSQL", pgsql_functions, PHP_MINIT(pgsql), NULL, PHP_RINIT(pgsql), NULL, NULL, STANDARD_MODULE_PROPERTIES + "PostgreSQL", pgsql_functions, PHP_MINIT(pgsql), PHP_MSHUTDOWN(pgsql), PHP_RINIT(pgsql), NULL, NULL, STANDARD_MODULE_PROPERTIES }; #if COMPILE_DL @@ -121,18 +122,16 @@ static void _free_result(pgsql_result_handle *pg_result) efree(pg_result); } +PHP_INI_BEGIN() + STD_PHP_INI_BOOLEAN("pgsql.allow_persistent", "1", PHP_INI_SYSTEM, OnUpdateInt, allow_persistent, php_pgsql_globals, pgsql_globals) + STD_PHP_INI_ENTRY_EX("pgsql.max_persistent", "-1", PHP_INI_SYSTEM, OnUpdateInt, max_persistent, php_pgsql_globals, pgsql_globals, display_link_numbers) + STD_PHP_INI_ENTRY_EX("pgsql.max_links", "-1", PHP_INI_SYSTEM, OnUpdateInt, max_links, php_pgsql_globals, pgsql_globals, display_link_numbers) +PHP_INI_END() + + static void php_pgsql_init_globals(PGLS_D) { PGG(num_persistent) = 0; - if (cfg_get_long("pgsql.allow_persistent",&PGG(allow_persistent))==FAILURE) { - PGG(allow_persistent)=1; - } - if (cfg_get_long("pgsql.max_persistent",&PGG(max_persistent))==FAILURE) { - PGG(max_persistent)=-1; - } - if (cfg_get_long("pgsql.max_links",&PGG(max_links))==FAILURE) { - PGG(max_links)=-1; - } } PHP_MINIT_FUNCTION(pgsql) @@ -142,6 +141,8 @@ PHP_MINIT_FUNCTION(pgsql) #else php_pgsql_init_globals(PGLS_C); #endif + + REGISTER_INI_ENTRIES(); le_link = register_list_destructors(_close_pgsql_link,NULL); le_plink = register_list_destructors(NULL,_close_pgsql_plink); @@ -158,6 +159,13 @@ PHP_MINIT_FUNCTION(pgsql) } +PHP_MSHUTDOWN_FUNCTION(pgsql) +{ + UNREGISTER_INI_ENTRIES(); + return SUCCESS; +} + + PHP_RINIT_FUNCTION(pgsql) { PGLS_FETCH(); diff --git a/ext/pgsql/php_pgsql.h b/ext/pgsql/php_pgsql.h index ca4975458c..37dff8235b 100644 --- a/ext/pgsql/php_pgsql.h +++ b/ext/pgsql/php_pgsql.h @@ -59,6 +59,7 @@ extern zend_module_entry pgsql_module_entry; #endif PHP_MINIT_FUNCTION(pgsql); +PHP_MSHUTDOWN_FUNCTION(pgsql); PHP_RINIT_FUNCTION(pgsql); PHP_FUNCTION(pg_connect); PHP_FUNCTION(pg_pconnect); |