bug70862.phpt 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. --TEST--
  2. MySQL Prepared Statements and BLOBs
  3. --EXTENSIONS--
  4. pdo_mysql
  5. --SKIPIF--
  6. <?php
  7. require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
  8. MySQLPDOTest::skip();
  9. ?>
  10. --FILE--
  11. <?php
  12. require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
  13. $db = MySQLPDOTest::factory();
  14. $db->exec('DROP TABLE IF EXISTS test');
  15. $db->exec(sprintf('CREATE TABLE test(id INT, label BLOB)'));
  16. $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 0);
  17. $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, true);
  18. class HelloWrapper {
  19. public function stream_open() { return true; }
  20. public function stream_eof() { return true; }
  21. public function stream_read() { return NULL; }
  22. public function stream_stat() { return array(); }
  23. }
  24. stream_wrapper_register("hello", "HelloWrapper");
  25. $f = fopen("hello://there", "r");
  26. $stmt = $db->prepare('INSERT INTO test(id, label) VALUES (1, :para)');
  27. $stmt->bindParam(":para", $f, PDO::PARAM_LOB);
  28. $stmt->execute();
  29. var_dump($f);
  30. print "done!";
  31. ?>
  32. --CLEAN--
  33. <?php
  34. require __DIR__ . '/mysql_pdo_test.inc';
  35. $db = MySQLPDOTest::factory();
  36. $db->exec('DROP TABLE IF EXISTS test');
  37. ?>
  38. --EXPECT--
  39. string(0) ""
  40. done!