1--TEST-- 2DBA with persistent connections 3--SKIPIF-- 4<?php 5$handler = "flatfile"; 6require_once(dirname(__FILE__) .'/skipif.inc'); 7die("info $HND handler used"); 8?> 9--FILE-- 10<?php 11 12$handler = "flatfile"; 13require_once(dirname(__FILE__) .'/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===DONE=== 52--CLEAN-- 53<?php 54 require(dirname(__FILE__) .'/clean.inc'); 55?> 56--EXPECTF-- 57database handler: flatfile 58Test 1 59This is a test insert 1 60Test 2 61resources are different 62Test 3 - fetch both rows from second resource 63This is a test insert 1 64This is a test insert 2 65Test 4 - fetch both rows from first resource 66This is a test insert 1 67This is a test insert 2 68Test 5 - close 2nd resource 69resource(%d) of type (dba persistent) 70resource(%d) of type (Unknown) 71Test 6 - query after closing 2nd resource 72This is a test insert 1 73This is a test insert 2 74===DONE=== 75