1--TEST-- 2DBA with persistent connections 3--EXTENSIONS-- 4dba 5--SKIPIF-- 6<?php 7$handler = "flatfile"; 8require_once(__DIR__ .'/skipif.inc'); 9die("info $HND handler used"); 10?> 11--FILE-- 12<?php 13 14$handler = "flatfile"; 15require_once(__DIR__ .'/test.inc'); 16echo "database handler: $handler\n"; 17 18echo "Test 1\n"; 19$db_file1 = dba_popen($db_filename, 'n', 'flatfile'); 20dba_insert("key1", "This is a test insert 1", $db_file1); 21echo dba_fetch("key1", $db_file1), "\n"; 22 23 24echo "Test 2\n"; 25$db_file2 = dba_popen($db_filename, 'n', 'flatfile'); 26if ($db_file1 === $db_file2) { 27 echo "resources are the same\n"; 28} else { 29 echo "resources are different\n"; 30} 31 32 33echo "Test 3 - fetch both rows from second resource\n"; 34dba_insert("key2", "This is a test insert 2", $db_file2); 35echo dba_fetch("key1", $db_file2), "\n"; 36echo dba_fetch("key2", $db_file2), "\n"; 37 38 39echo "Test 4 - fetch both rows from first resource\n"; 40echo dba_fetch("key1", $db_file1), "\n"; 41echo dba_fetch("key2", $db_file1), "\n"; 42 43echo "Test 5 - close 2nd resource\n"; 44dba_close($db_file2); 45var_dump($db_file1); 46var_dump($db_file2); 47 48echo "Test 6 - query after closing 2nd resource\n"; 49echo dba_fetch("key1", $db_file1), "\n"; 50echo dba_fetch("key2", $db_file1), "\n"; 51 52?> 53--CLEAN-- 54<?php 55 require(__DIR__ .'/clean.inc'); 56?> 57--EXPECTF-- 58database handler: flatfile 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