Beispiel #1
0
 public function debug()
 {
     $html = [];
     $html[] = "Available DBA handlers:\n<ul>\n";
     foreach (dba_handlers(true) as $handler_name => $handler_version) {
         // clean the versions
         $handler_version = str_replace('$', '', $handler_version);
         $html[] = "<li>{$handler_name}: {$handler_version}</li>\n";
     }
     $html[] = "</ul>\n";
     $html[] = "All opened databases:\n<ul>\n";
     foreach (dba_list() as $res_id => $db_name) {
         // clean the versions
         $html[] = "<li>{$res_id} : {$db_name}</li>\n";
     }
     $html[] = "</ul>\n";
     return $html;
 }
<?php

$handler = "db4";
require_once dirname(__FILE__) . '/test.inc';
echo "database handler: {$handler}\n";
$db_file1 = $db_filename1 = dirname(__FILE__) . '/test1.dbm';
$db_file2 = $db_filename2 = dirname(__FILE__) . '/test2.dbm';
if (($db_file = dba_open($db_file, "n", $handler)) !== FALSE) {
    echo "database file created\n";
} else {
    echo "{$db_file} does not exist\n";
}
if (($db_file1 = dba_open($db_file1, "n", $handler)) !== FALSE) {
    echo "database file created\n";
} else {
    echo "{$db_file} does not exist\n";
}
if (($db_file2 = dba_open($db_file2, "n", $handler)) !== FALSE) {
    echo "database file created\n";
} else {
    echo "{$db_file} does not exist\n";
}
var_dump(dba_list());
dba_close($db_file);
@unlink($db_filename1);
@unlink($db_filename2);
 static function castDba($dba, array $a)
 {
     $list = dba_list();
     $a['file'] = $list[substr((string) $dba, 13)];
     return $a;
 }
Beispiel #4
0
Datei: Dba.php Projekt: blar/dba
 /**
  * @return array
  */
 public static function getOpenFiles() : array
 {
     return dba_list();
 }
Beispiel #5
0
 public static function castDba($dba, array $a, Stub $stub, $isNested)
 {
     $list = dba_list();
     $a['file'] = $list[(int) $dba];
     return $a;
 }
 static function dbaGetFile($dba)
 {
     $list = dba_list();
     return array('file' => $list[substr((string) $dba, 13)]);
 }