bind_long_raw.phpt 988 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. --TEST--
  2. bind LONG RAW field
  3. --EXTENSIONS--
  4. oci8
  5. --SKIPIF--
  6. <?php
  7. $target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
  8. require(__DIR__.'/skipif.inc');
  9. ?>
  10. --FILE--
  11. <?php
  12. require __DIR__."/connect.inc";
  13. $stmt = oci_parse($c, "create table phptestlngraw( id number(10), fileimage long raw)");
  14. oci_execute($stmt);
  15. $stmt = oci_parse ($c, "insert into phptestlngraw (id, fileimage) values (:id, :fileimage)");
  16. $i=1;
  17. $fileimage = file_get_contents( __DIR__."/test.gif");
  18. oci_bind_by_name( $stmt, ":id", $i, -1);
  19. oci_bind_by_name( $stmt, ":fileimage", $fileimage, -1, SQLT_LBI);
  20. oci_execute($stmt, OCI_DEFAULT);
  21. oci_commit($c);
  22. $stmt = oci_parse($c, "SELECT fileimage FROM phptestlngraw");
  23. oci_execute($stmt);
  24. $row = oci_fetch_row($stmt);
  25. var_dump(md5($row[0]));
  26. var_dump(strlen($row[0]));
  27. $stmt = oci_parse($c, "drop table phptestlngraw");
  28. oci_execute($stmt);
  29. echo "Done\n";
  30. ?>
  31. --EXPECT--
  32. string(32) "614fcbba1effb7caa27ef0ef25c27fcf"
  33. int(2523)
  34. Done