dba006.phpt 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. --TEST--
  2. DBA FirstKey/NextKey with 2 deletes
  3. --EXTENSIONS--
  4. dba
  5. --SKIPIF--
  6. <?php
  7. require_once(__DIR__ .'/skipif.inc');
  8. die("info $HND handler used");
  9. ?>
  10. --FILE--
  11. <?php
  12. require_once(__DIR__ .'/test.inc');
  13. echo "database handler: $handler\n";
  14. if (($db_file=dba_open($db_file, "n", $handler))!==FALSE) {
  15. dba_insert("key1", "Content String 1", $db_file);
  16. dba_insert("key2", "Content String 2", $db_file);
  17. dba_insert("key3", "Third Content String", $db_file);
  18. dba_insert("key4", "Another Content String", $db_file);
  19. dba_insert("key5", "The last content string", $db_file);
  20. dba_delete("key3", $db_file);
  21. dba_delete("key1", $db_file);
  22. $a = dba_firstkey($db_file);
  23. $i=0;
  24. while($a) {
  25. $a = dba_nextkey($db_file);
  26. $i++;
  27. }
  28. echo $i;
  29. for ($i=1; $i<6; $i++) {
  30. echo dba_exists("key$i", $db_file) ? "Y" : "N";
  31. }
  32. dba_close($db_file);
  33. } else {
  34. echo "Error creating database\n";
  35. }
  36. ?>
  37. --CLEAN--
  38. <?php
  39. require(__DIR__ .'/clean.inc');
  40. ?>
  41. --EXPECTF--
  42. database handler: %s
  43. 3NYNYY