sqlite3stmt_getsql.phpt 793 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. --TEST--
  2. SQLite3Stmt::getSQL test
  3. --EXTENSIONS--
  4. sqlite3
  5. --FILE--
  6. <?php
  7. require_once(__DIR__ . '/new_db.inc');
  8. $db->enableExceptions(true);
  9. $stmt = $db->prepare('SELECT :a, :b, ?;');
  10. $stmt->bindValue(':a', 42);
  11. $stmt->bindValue(':b', 'php');
  12. $stmt->bindValue(3, 43);
  13. echo "Getting non-expanded SQL statement\n";
  14. var_dump($stmt->getSQL(false));
  15. echo "Execute statement\n";
  16. var_dump($res = $stmt->execute());
  17. echo "Statement result\n";
  18. var_dump($res->fetchArray(SQLITE3_NUM));
  19. echo "Closing DB\n";
  20. var_dump($db->close());
  21. echo "Done\n";
  22. ?>
  23. --EXPECT--
  24. Getting non-expanded SQL statement
  25. string(17) "SELECT :a, :b, ?;"
  26. Execute statement
  27. object(SQLite3Result)#3 (0) {
  28. }
  29. Statement result
  30. array(3) {
  31. [0]=>
  32. int(42)
  33. [1]=>
  34. string(3) "php"
  35. [2]=>
  36. int(43)
  37. }
  38. Closing DB
  39. bool(true)
  40. Done