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.

76 lines
1.2 KiB

  1. --TEST--
  2. sqlite: sqlite_fetch_object
  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. class class24 {
  12. function __construct() {
  13. echo __METHOD__ . "\n";
  14. }
  15. }
  16. $data = array(
  17. "one",
  18. "two",
  19. "three"
  20. );
  21. sqlite_query($db, "CREATE TABLE strings(a)");
  22. foreach ($data as $str) {
  23. sqlite_query($db, "INSERT INTO strings VALUES('$str')");
  24. }
  25. echo "====class24====\n";
  26. $res = sqlite_query($db, "SELECT a FROM strings", SQLITE_ASSOC);
  27. while (sqlite_valid($res)) {
  28. var_dump(sqlite_fetch_object($res, 'class24'));
  29. }
  30. echo "====stdclass====\n";
  31. $res = sqlite_query($db, "SELECT a FROM strings", SQLITE_ASSOC);
  32. while (sqlite_valid($res)) {
  33. var_dump(sqlite_fetch_object($res));
  34. }
  35. sqlite_close($db);
  36. echo "====DONE!====\n";
  37. ?>
  38. --EXPECTF--
  39. ====class24====
  40. class24::__construct
  41. object(class24)#%d (1) {
  42. ["a"]=>
  43. string(3) "one"
  44. }
  45. class24::__construct
  46. object(class24)#%d (1) {
  47. ["a"]=>
  48. string(3) "two"
  49. }
  50. class24::__construct
  51. object(class24)#%d (1) {
  52. ["a"]=>
  53. string(5) "three"
  54. }
  55. ====stdclass====
  56. object(stdClass)#%d (1) {
  57. ["a"]=>
  58. string(3) "one"
  59. }
  60. object(stdClass)#%d (1) {
  61. ["a"]=>
  62. string(3) "two"
  63. }
  64. object(stdClass)#%d (1) {
  65. ["a"]=>
  66. string(5) "three"
  67. }
  68. ====DONE!====