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