bind_raw.phpt 1.0 KB

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