1--TEST-- 2oci_lob_free()/close() 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'; 15require __DIR__.'/create_table.inc'; 16 17$ora_sql = "INSERT INTO 18 ".$schema.$table_name." (blob) 19 VALUES (empty_blob()) 20 RETURNING 21 blob 22 INTO :v_blob "; 23 24$statement = oci_parse($c,$ora_sql); 25$blob = oci_new_descriptor($c,OCI_D_LOB); 26oci_bind_by_name($statement,":v_blob", $blob,-1,OCI_B_BLOB); 27oci_execute($statement, OCI_DEFAULT); 28 29var_dump($blob->write("test")); 30var_dump($blob->close()); 31var_dump($blob->write("test")); 32var_dump(oci_free_descriptor($blob)); 33 34try { 35 var_dump($blob->write("test")); 36} catch(\TypeError $exception) { 37 var_dump($exception->getMessage()); 38} 39 40try { 41 var_dump(oci_free_descriptor($blob)); 42} catch(\TypeError $exception) { 43 var_dump($exception->getMessage()); 44} 45 46$blob = oci_new_descriptor($c,OCI_D_LOB); 47unset($blob->descriptor); 48var_dump(oci_free_descriptor($blob)); 49 50oci_commit($c); 51 52$select_sql = "SELECT blob FROM ".$schema.$table_name.""; 53$s = oci_parse($c, $select_sql); 54oci_execute($s); 55 56var_dump(oci_fetch_array($s, OCI_NUM + OCI_RETURN_LOBS)); 57 58require __DIR__.'/drop_table.inc'; 59 60echo "Done\n"; 61 62?> 63--EXPECTF-- 64int(4) 65bool(true) 66int(4) 67bool(true) 68string(%d) "OCILob::write(): %s is not a valid oci8 descriptor resource" 69string(%d) "oci_free_descriptor(): %s is not a valid oci8 descriptor resource" 70 71Warning: oci_free_descriptor(): Unable to find descriptor property in %s on line %d 72bool(false) 73array(1) { 74 [0]=> 75 string(8) "testtest" 76} 77Done 78