mirror of
https://github.com/php/php-src.git
synced 2024-11-24 02:15:04 +08:00
Added pg_get_pid()
This commit is contained in:
parent
30c16baac2
commit
7094b48b23
@ -43,14 +43,13 @@ module with specific version. You need to install PostgreSQL
|
|||||||
somewhere in your system to build PHP with PostgreSQL support.
|
somewhere in your system to build PHP with PostgreSQL support.
|
||||||
|
|
||||||
==== Note For PostgreSQL 7.2 ====
|
==== Note For PostgreSQL 7.2 ====
|
||||||
I've tested upto 7.2.1.
|
I've tested upto 7.2.2.
|
||||||
|
|
||||||
==== TODO List ===
|
==== TODO List ===
|
||||||
Make pg_convert() smater.
|
Make pg_convert() smater.
|
||||||
- Better regex
|
- Better regex
|
||||||
- User defiend type support
|
- User defiend type support
|
||||||
Support async connection.
|
Support async connection.
|
||||||
Support async notification.
|
|
||||||
|
|
||||||
==== Experimental Functions =====
|
==== Experimental Functions =====
|
||||||
|
|
||||||
@ -217,6 +216,19 @@ array pg_select(resource db, string table, array ids[, bool convert])
|
|||||||
Select records that has ids (id=>value)
|
Select records that has ids (id=>value)
|
||||||
|
|
||||||
--------------------------------------------------------------------
|
--------------------------------------------------------------------
|
||||||
|
array pg_get_notify([resource db[, notify]])
|
||||||
|
Get notify message on the connection
|
||||||
|
|
||||||
|
--------------------------------------------------------------------
|
||||||
|
string pg_unescape_bytea(string bytea_data)
|
||||||
|
Unescape bytea field data
|
||||||
|
|
||||||
|
--------------------------------------------------------------------
|
||||||
|
bool pg_ping(resource db)
|
||||||
|
ping database connection and try to reset connection if it's
|
||||||
|
broken
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
|
||||||
Again, experimental functions are subject to be changed without
|
Again, experimental functions are subject to be changed without
|
||||||
notice.
|
notice.
|
||||||
|
@ -116,6 +116,7 @@ function_entry pgsql_functions[] = {
|
|||||||
PHP_FE(pg_field_is_null,NULL)
|
PHP_FE(pg_field_is_null,NULL)
|
||||||
/* async message function */
|
/* async message function */
|
||||||
PHP_FE(pg_get_notify, NULL)
|
PHP_FE(pg_get_notify, NULL)
|
||||||
|
PHP_FE(pg_get_pid, NULL)
|
||||||
/* error message functions */
|
/* error message functions */
|
||||||
PHP_FE(pg_result_error, NULL)
|
PHP_FE(pg_result_error, NULL)
|
||||||
PHP_FE(pg_last_error, NULL)
|
PHP_FE(pg_last_error, NULL)
|
||||||
@ -3015,9 +3016,7 @@ PHP_FUNCTION(pg_get_notify)
|
|||||||
zval *pgsql_link;
|
zval *pgsql_link;
|
||||||
int id = -1, result_type = PGSQL_ASSOC;
|
int id = -1, result_type = PGSQL_ASSOC;
|
||||||
PGconn *pgsql;
|
PGconn *pgsql;
|
||||||
PGresult *pgsql_result;
|
|
||||||
PGnotify *pgsql_notify;
|
PGnotify *pgsql_notify;
|
||||||
pgsql_result_handle *pg_result;
|
|
||||||
|
|
||||||
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "r|l",
|
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "r|l",
|
||||||
&pgsql_link) == FAILURE) {
|
&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
|
/* {{{ php_pgsql_meta_data
|
||||||
* TODO: Add meta_data cache for better performance
|
* TODO: Add meta_data cache for better performance
|
||||||
|
@ -99,6 +99,7 @@ PHP_FUNCTION(pg_field_prtlen);
|
|||||||
PHP_FUNCTION(pg_field_is_null);
|
PHP_FUNCTION(pg_field_is_null);
|
||||||
/* async message functions */
|
/* async message functions */
|
||||||
PHP_FUNCTION(pg_get_notify);
|
PHP_FUNCTION(pg_get_notify);
|
||||||
|
PHP_FUNCTION(pg_get_pid);
|
||||||
/* error message functions */
|
/* error message functions */
|
||||||
PHP_FUNCTION(pg_result_error);
|
PHP_FUNCTION(pg_result_error);
|
||||||
PHP_FUNCTION(pg_last_error);
|
PHP_FUNCTION(pg_last_error);
|
||||||
|
Loading…
Reference in New Issue
Block a user