sqlite3_blob_bind_resource.phpt 910 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. --TEST--
  2. SQLite3::execute() with a resource bound for blob param
  3. --SKIPIF--
  4. <?php require_once(__DIR__ . '/skipif.inc'); ?>
  5. --FILE--
  6. <?php
  7. require_once(__DIR__ . '/new_db.inc');
  8. require_once(__DIR__ . '/stream_test.inc');
  9. var_dump($db->exec('CREATE TABLE test (id STRING, data BLOB)'));
  10. $insert_stmt = $db->prepare("INSERT INTO test (id, data) VALUES (1, ?)");
  11. class HelloWrapper {
  12. public function stream_open() { return true; }
  13. public function stream_eof() { return true; }
  14. public function stream_read() { return NULL; }
  15. public function stream_stat() { return array(); }
  16. }
  17. stream_wrapper_register("hello", "HelloWrapper");
  18. $f = fopen("hello://there", "r");
  19. var_dump($insert_stmt->bindParam(1, $f, SQLITE3_BLOB));
  20. var_dump($insert_stmt->execute());
  21. var_dump($insert_stmt->close());
  22. fclose($f);
  23. ?>
  24. +++DONE+++
  25. --EXPECTF--
  26. bool(true)
  27. bool(true)
  28. object(SQLite3Result)#%d (%d) {
  29. }
  30. bool(true)
  31. +++DONE+++