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