1--TEST-- 2oci_lob_write() and friends (with errors) 3--EXTENSIONS-- 4oci8 5--SKIPIF-- 6<?php 7require_once 'skipifconnectfailure.inc'; 8$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs 9require __DIR__.'/skipif.inc'; 10?> 11--FILE-- 12<?php 13 14require __DIR__.'/connect.inc'; 15 16// Initialization 17 18$stmtarray = array( 19 "drop table lob_002_tab", 20 "create table lob_002_tab (id number, b1 BLOB)", 21); 22 23oci8_test_sql_execute($c, $stmtarray); 24 25$statement = oci_parse($c, "insert into lob_002_tab (id, b1) values (1, empty_blob()) returning b1 INTO :v_blob "); 26$blob = oci_new_descriptor($c,OCI_D_LOB); 27oci_bind_by_name($statement,":v_blob", $blob,-1,OCI_B_BLOB); 28oci_execute($statement, OCI_DEFAULT); 29 30var_dump($blob); 31 32var_dump($blob->write("test", -1)); 33var_dump($blob->write("test", 1000000)); 34var_dump($blob->write(str_repeat("test", 10000), 1000000)); 35var_dump($blob->tell()); 36var_dump($blob->flush()); 37 38oci_commit($c); 39 40$select_sql = "select b1 from lob_002_tab where id = 1"; 41$s = oci_parse($c, $select_sql); 42oci_execute($s); 43 44$row = oci_fetch_array($s, OCI_RETURN_LOBS); 45 46var_dump(strlen($row[0])); 47 48// Cleanup 49 50$stmtarray = array( 51 "drop table lob_002_tab" 52); 53 54oci8_test_sql_execute($c, $stmtarray); 55 56?> 57--EXPECTF-- 58object(OCILob)#%d (1) { 59 ["descriptor"]=> 60 resource(%d) of type (oci8 descriptor) 61} 62int(0) 63int(4) 64int(40000) 65int(40004) 66bool(false) 67int(40004) 68