helly Thu Oct 24 16:43:03 2002 EDT Modified files: /php4/ext/dba dba.c php_dba.h Log: implemented dba_handlers() @Added dba_handlers() that lists all installed handlers in an array. (marcus) Index: php4/ext/dba/dba.c diff -u php4/ext/dba/dba.c:1.44 php4/ext/dba/dba.c:1.45 --- php4/ext/dba/dba.c:1.44 Fri Aug 23 18:24:02 2002 +++ php4/ext/dba/dba.c Thu Oct 24 16:43:02 2002 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: dba.c,v 1.44 2002/08/23 22:24:02 sniper Exp $ */ +/* $Id: dba.c,v 1.45 2002/10/24 20:43:02 helly Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -51,6 +51,7 @@ PHP_FE(dba_nextkey, NULL) PHP_FE(dba_optimize, NULL) PHP_FE(dba_sync, NULL) + PHP_FE(dba_handlers, NULL) {NULL, NULL, NULL} }; /* }}} */ @@ -509,6 +510,27 @@ RETURN_TRUE; } RETURN_FALSE; +} +/* }}} */ + +/* {{{ 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); + } } /* }}} */ Index: php4/ext/dba/php_dba.h diff -u php4/ext/dba/php_dba.h:1.12 php4/ext/dba/php_dba.h:1.13 --- php4/ext/dba/php_dba.h:1.12 Fri Aug 23 18:24:02 2002 +++ php4/ext/dba/php_dba.h Thu Oct 24 16:43:03 2002 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_dba.h,v 1.12 2002/08/23 22:24:02 sniper Exp $ */ +/* $Id: php_dba.h,v 1.13 2002/10/24 20:43:03 helly Exp $ */ #ifndef PHP_DBA_H #define PHP_DBA_H @@ -94,6 +94,7 @@ PHP_FUNCTION(dba_fetch); PHP_FUNCTION(dba_optimize); PHP_FUNCTION(dba_sync); +PHP_FUNCTION(dba_handlers); #else #define dba_module_ptr NULL
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php