diff options
| author | Yasuo Ohgaki <yohgaki@php.net> | 2002-10-17 23:41:34 +0000 |
|---|---|---|
| committer | Yasuo Ohgaki <yohgaki@php.net> | 2002-10-17 23:41:34 +0000 |
| commit | 7094b48b23ead90e2eb5cfbe44cabe0f9f19b296 (patch) | |
| tree | 86385809d4bb2cab8279f78de48b055013a17b36 /ext/pgsql/pgsql.c | |
| parent | 30c16baac27b0e74ce900d9ffdd076b381ad0a0d (diff) | |
| download | php-git-7094b48b23ead90e2eb5cfbe44cabe0f9f19b296.tar.gz | |
Added pg_get_pid()
Diffstat (limited to 'ext/pgsql/pgsql.c')
| -rw-r--r-- | ext/pgsql/pgsql.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c index e0bd78ae5f..43fab8557a 100644 --- a/ext/pgsql/pgsql.c +++ b/ext/pgsql/pgsql.c @@ -116,6 +116,7 @@ function_entry pgsql_functions[] = { PHP_FE(pg_field_is_null,NULL) /* async message function */ PHP_FE(pg_get_notify, NULL) + PHP_FE(pg_get_pid, NULL) /* error message functions */ PHP_FE(pg_result_error, NULL) PHP_FE(pg_last_error, NULL) @@ -3015,9 +3016,7 @@ PHP_FUNCTION(pg_get_notify) zval *pgsql_link; int id = -1, result_type = PGSQL_ASSOC; PGconn *pgsql; - PGresult *pgsql_result; PGnotify *pgsql_notify; - pgsql_result_handle *pg_result; if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &pgsql_link) == FAILURE) { @@ -3044,6 +3043,24 @@ PHP_FUNCTION(pg_get_notify) } /* }}} */ +/* {{{ proto resource pg_get_pid([resource connection) + Get backend(server) pid */ +PHP_FUNCTION(pg_get_pid) +{ + zval *pgsql_link; + int id = -1, pid; + PGconn *pgsql; + + if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "r", + &pgsql_link) == FAILURE) { + RETURN_FALSE; + } + + ZEND_FETCH_RESOURCE2(pgsql, PGconn *, &pgsql_link, id, "PostgreSQL link", le_link, le_plink); + + RETURN_LONG(PQbackendPID(pgsql)); +} +/* }}} */ /* {{{ php_pgsql_meta_data * TODO: Add meta_data cache for better performance |
