implemented dba_handlers()

@Added dba_handlers() that lists all installed handlers in an array. (marcus)
This commit is contained in:
Marcus Boerger 2002-10-24 20:43:03 +00:00
parent 0e28eaf550
commit 82b96d99f3
2 changed files with 23 additions and 0 deletions

View 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
/*

View 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