summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcus Boerger <helly@php.net>2002-10-24 20:43:03 +0000
committerMarcus Boerger <helly@php.net>2002-10-24 20:43:03 +0000
commit82b96d99f3a153fc8be9d39b0c7b408462d3eaa4 (patch)
treecddb1f34366f28727d1b829d8ca0924cc8b51f61
parent0e28eaf550772da4f011b686e984bc5c0da7a432 (diff)
downloadphp-git-82b96d99f3a153fc8be9d39b0c7b408462d3eaa4.tar.gz
implemented dba_handlers()
@Added dba_handlers() that lists all installed handlers in an array. (marcus)
-rw-r--r--ext/dba/dba.c22
-rw-r--r--ext/dba/php_dba.h1
2 files changed, 23 insertions, 0 deletions
diff --git a/ext/dba/dba.c b/ext/dba/dba.c
index 48d5e784c5..eed953b5c9 100644
--- a/ext/dba/dba.c
+++ b/ext/dba/dba.c
@@ -51,6 +51,7 @@ function_entry dba_functions[] = {
PHP_FE(dba_nextkey, NULL)
PHP_FE(dba_optimize, NULL)
PHP_FE(dba_sync, NULL)
+ PHP_FE(dba_handlers, NULL)
{NULL, NULL, NULL}
};
/* }}} */
@@ -512,6 +513,27 @@ PHP_FUNCTION(dba_sync)
}
/* }}} */
+/* {{{ proto array dba_list()
+ List configured databases */
+PHP_FUNCTION(dba_handlers)
+{
+ dba_handler *hptr;
+
+ if (ZEND_NUM_ARGS()!=0) {
+ ZEND_WRONG_PARAM_COUNT();
+ RETURN_FALSE;
+ }
+
+ if (array_init(return_value) == FAILURE) {
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Unable to initialize array");
+ RETURN_FALSE;
+ }
+ for(hptr = handler; hptr->name; hptr++) {
+ add_next_index_string(return_value, hptr->name, 1);
+ }
+}
+/* }}} */
+
#endif
/*
diff --git a/ext/dba/php_dba.h b/ext/dba/php_dba.h
index 3a9b726fdc..c1bc6f1dd0 100644
--- a/ext/dba/php_dba.h
+++ b/ext/dba/php_dba.h
@@ -94,6 +94,7 @@ PHP_FUNCTION(dba_exists);
PHP_FUNCTION(dba_fetch);
PHP_FUNCTION(dba_optimize);
PHP_FUNCTION(dba_sync);
+PHP_FUNCTION(dba_handlers);
#else
#define dba_module_ptr NULL