helly Sun Jul 27 12:47:36 2003 EDT
Modified files:
/php-src/ext/pgsql pgsql.c php_pgsql.h
Log:
Added new function pg_parameter_status()
Index: php-src/ext/pgsql/pgsql.c
diff -u php-src/ext/pgsql/pgsql.c:1.285 php-src/ext/pgsql/pgsql.c:1.286
--- php-src/ext/pgsql/pgsql.c:1.285 Sun Jul 27 12:45:10 2003
+++ php-src/ext/pgsql/pgsql.c Sun Jul 27 12:47:36 2003
@@ -19,7 +19,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: pgsql.c,v 1.285 2003/07/27 16:45:10 helly Exp $ */
+/* $Id: pgsql.c,v 1.286 2003/07/27 16:47:36 helly Exp $ */
#include <stdlib.h>
@@ -90,6 +90,9 @@
PHP_FE(pg_options, NULL)
PHP_FE(pg_version, NULL)
PHP_FE(pg_ping, NULL)
+#if HAVE_PQPARAMETERSTATUS
+ PHP_FE(pg_parameter_status, NULL)
+#endif
/* query functions */
PHP_FE(pg_query, NULL)
PHP_FE(pg_send_query, NULL)
@@ -927,6 +930,41 @@
php_pgsql_get_link_info(INTERNAL_FUNCTION_PARAM_PASSTHRU,PHP_PG_VERSION);
}
/* }}} */
+
+#if HAVE_PQPARAMETERSTATUS
+/* {{{ proto string|false pg_parameter_status([resource connection,] string
param_name)
+ Returns the value of a server parameter */
+PHP_FUNCTION(pg_parameter_status)
+{
+ zval *pgsql_link;
+ int id;
+ PGconn *pgsql;
+ char *param;
+ int len;
+
+ if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS()
TSRMLS_CC, "rs", &pgsql_link, ¶m, &len) == SUCCESS) {
+ id = -1;
+ } else if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m, &len)
== SUCCESS) {
+ pgsql_link = NULL;
+ id = PGG(default_link);
+ } else {
+ RETURN_FALSE;
+ }
+ if (pgsql_link == NULL && id == -1) {
+ RETURN_FALSE;
+ }
+
+ ZEND_FETCH_RESOURCE2(pgsql, PGconn *, &pgsql_link, id, "PostgreSQL link",
le_link, le_plink);
+
+ param = (char*)PQparameterStatus(pgsql, param);
+ if (param) {
+ RETURN_STRING(param, 1);
+ } else {
+ RETURN_FALSE;
+ }
+}
+/* }}} */
+#endif
/* {{{ proto bool pg_ping([resource connection])
Ping database. If connection is bad, try to reconnect. */
Index: php-src/ext/pgsql/php_pgsql.h
diff -u php-src/ext/pgsql/php_pgsql.h:1.63 php-src/ext/pgsql/php_pgsql.h:1.64
--- php-src/ext/pgsql/php_pgsql.h:1.63 Tue Jul 22 19:05:17 2003
+++ php-src/ext/pgsql/php_pgsql.h Sun Jul 27 12:47:36 2003
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_pgsql.h,v 1.63 2003/07/22 23:05:17 helly Exp $ */
+/* $Id: php_pgsql.h,v 1.64 2003/07/27 16:47:36 helly Exp $ */
#ifndef PHP_PGSQL_H
#define PHP_PGSQL_H
@@ -73,6 +73,9 @@
PHP_FUNCTION(pg_options);
PHP_FUNCTION(pg_version);
PHP_FUNCTION(pg_ping);
+#if HAVE_PQPARAMETERSTATUS
+PHP_FUNCTION(pg_parameter_status);
+#endif
/* query functions */
PHP_FUNCTION(pg_query);
PHP_FUNCTION(pg_send_query);
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php