1--TEST-- 2DBA DB4 with persistent connections 3--SKIPIF-- 4<?php 5$handler = "db4"; 6require_once(__DIR__ .'/skipif.inc'); 7die("info $HND handler used"); 8?> 9--FILE-- 10<?php 11 12$handler = "db4"; 13require_once(__DIR__ .'/test.inc'); 14echo "database handler: $handler\n"; 15 16echo "Test 1\n"; 17$db_file1 = dba_popen($db_filename, 'n', 'flatfile'); 18dba_insert("key1", "This is a test insert 1", $db_file1); 19echo dba_fetch("key1", $db_file1), "\n"; 20 21 22echo "Test 2\n"; 23$db_file2 = dba_popen($db_filename, 'n', 'flatfile'); 24if ($db_file1 === $db_file2) { 25 echo "resources are the same\n"; 26} else { 27 echo "resources are different\n"; 28} 29 30 31echo "Test 3 - fetch both rows from second resource\n"; 32dba_insert("key2", "This is a test insert 2", $db_file2); 33echo dba_fetch("key1", $db_file2), "\n"; 34echo dba_fetch("key2", $db_file2), "\n"; 35 36 37echo "Test 4 - fetch both rows from first resource\n"; 38echo dba_fetch("key1", $db_file1), "\n"; 39echo dba_fetch("key2", $db_file1), "\n"; 40 41echo "Test 5 - close 2nd resource\n"; 42dba_close($db_file2); 43var_dump($db_file1); 44var_dump($db_file2); 45 46echo "Test 6 - query after closing 2nd resource\n"; 47echo dba_fetch("key1", $db_file1), "\n"; 48echo dba_fetch("key2", $db_file1), "\n"; 49 50?> 51--CLEAN-- 52<?php 53 require(__DIR__ .'/clean.inc'); 54?> 55--XFAIL-- 56Test 6 crashes with dba pointer of NULL, bug http://bugs.php.net/bug.php?id=51278 57--EXPECTF-- 58database handler: db4 59Test 1 60This is a test insert 1 61Test 2 62resources are different 63Test 3 - fetch both rows from second resource 64This is a test insert 1 65This is a test insert 2 66Test 4 - fetch both rows from first resource 67This is a test insert 1 68This is a test insert 2 69Test 5 - close 2nd resource 70resource(%d) of type (dba persistent) 71resource(%d) of type (Unknown) 72Test 6 - query after closing 2nd resource 73This is a test insert 1 74This is a test insert 2 75