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