dba_db4_013.phpt 969 B

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