xref: /PHP-7.0/ext/dba/tests/dba010.phpt (revision 7b329d5a)
1--TEST--
2DBA with array keys
3--SKIPIF--
4<?php
5	require_once(dirname(__FILE__) .'/skipif.inc');
6	die("info $HND handler used");
7?>
8--FILE--
9<?php
10require_once(dirname(__FILE__) .'/test.inc');
11echo "database handler: $handler\n";
12if (($db_file=dba_open($db_file, "n", $handler))!==FALSE) {
13    dba_insert(array("", "name0") , "Content String 1", $db_file);
14    dba_insert(array("key1", "name1") , "Content String 1", $db_file);
15    dba_insert(array("key2","name2"), "Content String 2", $db_file);
16    dba_insert("[key3]name3", "Third Content String", $db_file);
17    dba_insert(array("key4","name4"), "Another Content String", $db_file);
18    dba_insert(array("key5","name5"), "The last content string", $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    echo dba_exists(array("","name0"), $db_file) ? "Y" : "N";
27    for ($i=1; $i<5; $i++) {
28        echo dba_exists("[key$i]name$i", $db_file) ? "Y" : "N";
29    }
30    echo dba_exists(array("key5","name5"), $db_file) ? "Y" : "N";
31    echo "\n";
32    dba_close($db_file);
33} else {
34    echo "Error creating database\n";
35}
36
37?>
38--CLEAN--
39<?php
40	require(dirname(__FILE__) .'/clean.inc');
41?>
42--EXPECTF--
43database handler: %s
446YYYYYY
45