bind_raw.phpt 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. --TEST--
  2. bind 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 phptestrawtable( id number(10), fileimage raw(1000))");
  14. oci_execute($stmt);
  15. $stmt = oci_parse ($c, "insert into phptestrawtable (id, fileimage) values (:id, :fileimage)");
  16. $i=1;
  17. $fileimage = file_get_contents( __DIR__."/test.gif");
  18. $fileimage = substr($fileimage, 0, 300);
  19. oci_bind_by_name( $stmt, ":id", $i, -1);
  20. oci_bind_by_name( $stmt, ":fileimage", $fileimage, -1, SQLT_BIN);
  21. oci_execute($stmt, OCI_DEFAULT);
  22. oci_commit($c);
  23. $stmt = oci_parse($c, "SELECT fileimage FROM phptestrawtable");
  24. oci_execute($stmt);
  25. $row = oci_fetch_row($stmt);
  26. var_dump(md5($row[0]));
  27. var_dump(strlen($row[0]));
  28. $stmt = oci_parse($c, "drop table phptestrawtable");
  29. oci_execute($stmt);
  30. echo "Done\n";
  31. ?>
  32. --EXPECT--
  33. string(32) "88b274d7a257ac6f70435b83abd4e26e"
  34. int(300)
  35. Done