lob_014.phpt 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. --TEST--
  2. oci_lob_free()/close()
  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. require __DIR__.'/create_table.inc';
  14. $ora_sql = "INSERT INTO
  15. ".$schema.$table_name." (blob)
  16. VALUES (empty_blob())
  17. RETURNING
  18. blob
  19. INTO :v_blob ";
  20. $statement = oci_parse($c,$ora_sql);
  21. $blob = oci_new_descriptor($c,OCI_D_LOB);
  22. oci_bind_by_name($statement,":v_blob", $blob,-1,OCI_B_BLOB);
  23. oci_execute($statement, OCI_DEFAULT);
  24. $blob;
  25. var_dump($blob->write("test"));
  26. var_dump($blob->close());
  27. var_dump($blob->write("test"));
  28. var_dump($blob->free());
  29. oci_commit($c);
  30. $select_sql = "SELECT blob FROM ".$schema.$table_name."";
  31. $s = oci_parse($c, $select_sql);
  32. oci_execute($s);
  33. var_dump(oci_fetch_array($s, OCI_NUM + OCI_RETURN_LOBS));
  34. require __DIR__.'/drop_table.inc';
  35. echo "Done\n";
  36. ?>
  37. --EXPECT--
  38. int(4)
  39. bool(true)
  40. int(4)
  41. bool(true)
  42. array(1) {
  43. [0]=>
  44. string(8) "testtest"
  45. }
  46. Done