You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
760 B

  1. --TEST--
  2. sqlite: binary encoding
  3. --INI--
  4. sqlite.assoc_case=0
  5. --SKIPIF--
  6. <?php # vim:ft=php
  7. if (!extension_loaded("sqlite")) print "skip"; ?>
  8. --FILE--
  9. <?php
  10. include "blankdb.inc";
  11. $strings = array(
  12. "hello",
  13. "hello\x01o",
  14. "\x01hello there",
  15. "hello\x00there",
  16. ""
  17. );
  18. sqlite_query("CREATE TABLE strings(a)", $db);
  19. foreach ($strings as $str) {
  20. sqlite_query("INSERT INTO strings VALUES('" . sqlite_escape_string($str) . "')", $db);
  21. }
  22. $i = 0;
  23. $r = sqlite_query("SELECT * from strings", $db);
  24. while ($row = sqlite_fetch_array($r, SQLITE_NUM)) {
  25. if ($row[0] !== $strings[$i]) {
  26. echo "FAIL!\n";
  27. var_dump($row[0]);
  28. var_dump($strings[$i]);
  29. } else {
  30. echo "OK!\n";
  31. }
  32. $i++;
  33. }
  34. sqlite_close($db);
  35. echo "DONE!\n";
  36. ?>
  37. --EXPECT--
  38. OK!
  39. OK!
  40. OK!
  41. OK!
  42. OK!
  43. DONE!