]> granicus.if.org Git - php/commitdiff
- the driver's key name is not zero terminated, hence we need to either
authorMarcus Boerger <helly@php.net>
Tue, 22 Mar 2005 10:26:51 +0000 (10:26 +0000)
committerMarcus Boerger <helly@php.net>
Tue, 22 Mar 2005 10:26:51 +0000 (10:26 +0000)
  estrNcpy() it or use the driver struct.
- table headers do not support single column mode so change to two cols
- there should be only one table header

ext/pdo/pdo.c

index 409d1933376a9856b199fceaf0c2bc70e7a2768d..c7d84139898cec7162a0bf7ae71b37c75eeef71a 100755 (executable)
@@ -378,20 +378,24 @@ PHP_RSHUTDOWN_FUNCTION(pdo)
 PHP_MINFO_FUNCTION(pdo)
 {
        HashPosition pos;
-       ulong num_key;
-       char *name;
-       int namelen;
+       char *drivers = NULL, *ldrivers = estrdup("");
+       pdo_driver_t **pdriver;
        
        php_info_print_table_start();
-       php_info_print_table_header(2, "pdo support", "enabled");
-       php_info_print_table_header(1, "Available PDO Drivers");
+       php_info_print_table_header(2, "PDO support", "enabled");
 
        zend_hash_internal_pointer_reset_ex(&pdo_driver_hash, &pos);
-       while (HASH_KEY_IS_STRING == zend_hash_get_current_key_ex(&pdo_driver_hash, &name, &namelen, &num_key, 0, &pos)) {
-               php_info_print_table_row(1, name);
+       while (SUCCESS == zend_hash_get_current_data_ex(&pdo_driver_hash, (void**)&pdriver, &pos)) {
+               spprintf(&drivers, 0, "%s, %s", ldrivers, (*pdriver)->driver_name);
                zend_hash_move_forward_ex(&pdo_driver_hash, &pos);
+               efree(ldrivers);
+               ldrivers = drivers;
        }
        
+       php_info_print_table_row(2, "PDO drivers", drivers+2);
+       
+       efree(drivers);
+
        php_info_print_table_end();
 
 #if 0