sqlite3_11_numrows.phpt 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. --TEST--
  2. SQLite3::prepare number of rows
  3. --SKIPIF--
  4. <?php require_once(dirname(__FILE__) . '/skipif.inc');
  5. // Create an instance of the ReflectionMethod class
  6. try {
  7. $method = new ReflectionMethod('sqlite3result', 'numRows');
  8. } catch (ReflectionException $e) {
  9. die("skip");
  10. }
  11. ?>
  12. --FILE--
  13. <?php
  14. require_once(dirname(__FILE__) . '/new_db.inc');
  15. define('TIMENOW', time());
  16. echo "Creating Table\n";
  17. var_dump($db->exec('CREATE TABLE test (time INTEGER, id STRING)'));
  18. echo "INSERT into table\n";
  19. var_dump($db->exec("INSERT INTO test (time, id) VALUES (" . TIMENOW . ", 'a')"));
  20. var_dump($db->exec("INSERT INTO test (time, id) VALUES (" . TIMENOW . ", 'b')"));
  21. echo "SELECTING results\n";
  22. $results = $db->query("SELECT * FROM test ORDER BY id ASC");
  23. echo "Number of rows\n";
  24. var_dump($results->numRows());
  25. $results->finalize();
  26. echo "Closing database\n";
  27. var_dump($db->close());
  28. echo "Done\n";
  29. ?>
  30. --EXPECTF--
  31. Creating Table
  32. bool(true)
  33. INSERT into table
  34. bool(true)
  35. bool(true)
  36. SELECTING results
  37. Number of rows
  38. int(2)
  39. Closing database
  40. bool(true)
  41. Done