xref: /php-src/ext/dba/tests/dba_optimize.phpt (revision f11228cd)
1--TEST--
2DBA Optimize Test
3--EXTENSIONS--
4dba
5--CONFLICTS--
6dba
7--SKIPIF--
8<?php
9    require_once __DIR__ .'/skipif.inc';
10    die("info $HND handler used");
11?>
12--FILE--
13<?php
14require_once(__DIR__ .'/test.inc');
15echo "database handler: $handler\n";
16if (($db_file=dba_open($db_filename, "n", $handler))!==FALSE) {
17    dba_insert("key1", "Content String 1", $db_file);
18    dba_insert("key2", "Content String 2", $db_file);
19    $a = dba_firstkey($db_file);
20    $i=0;
21    while($a) {
22        $a = dba_nextkey($db_file);
23        $i++;
24    }
25    echo $i;
26    for ($i=1; $i<3; $i++) {
27        echo dba_exists("key$i", $db_file) ? "Y" : "N";
28    }
29    echo "\n";
30    var_dump(dba_optimize($db_file));
31    dba_close($db_file);
32} else {
33    echo "Error creating database\n";
34}
35
36?>
37--CLEAN--
38<?php
39    require(__DIR__ .'/clean.inc');
40?>
41--EXPECT--
42database handler: flatfile
432YY
44bool(true)
45