]> granicus.if.org Git - php/commitdiff
implemented dba_handlers()
authorMarcus Boerger <helly@php.net>
Thu, 24 Oct 2002 20:43:03 +0000 (20:43 +0000)
committerMarcus Boerger <helly@php.net>
Thu, 24 Oct 2002 20:43:03 +0000 (20:43 +0000)
@Added dba_handlers() that lists all installed handlers in an array. (marcus)

ext/dba/dba.c
ext/dba/php_dba.h

index 48d5e784c51d24444c3ff513992dc5c43b540d76..eed953b5c9f166f6143888f38e17c812961a69c8 100644 (file)
@@ -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
 
 /*
index 3a9b726fdce24d8661069b89569187d6e612d393..c1bc6f1dd06d74f5c3fab4b96095c3dae0cbee51 100644 (file)
@@ -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