xref: /PHP-5.3/ext/dba/tests/dba_db4_013.phpt (revision 7b329d5a)
1--TEST--
2DBA DB4 File open("rl") & Insert Test
3--SKIPIF--
4<?php
5$handler = "db4";
6require_once(dirname(__FILE__) .'/skipif.inc');
7die("info $HND handler used");
8?>
9--FILE--
10<?php
11
12$handler = "db4";
13require_once(dirname(__FILE__) .'/test.inc');
14echo "database handler: $handler\n";
15
16if (($db_file = dba_popen($db_filename, "c", $handler)) !== FALSE) {
17    echo "database file created\n";
18    dba_close($db_file);
19}
20
21if (($db_file = dba_popen($db_filename, "rl", $handler)) !== FALSE) {
22    echo "database file opened\n";
23    dba_insert("key1", "This is a test insert", $db_file);
24    echo dba_fetch("key1", $db_file), "\n";
25    dba_close($db_file);
26} else {
27    echo "Error creating $db_filename\n";
28}
29
30?>
31--CLEAN--
32<?php
33require(dirname(__FILE__) .'/clean.inc');
34?>
35--EXPECTF--
36database handler: db4
37database file created
38database file opened
39
40Warning: dba_insert(): You cannot perform a modification to a database without proper access in %sdba_db4_013.php on line %d
41