1--TEST-- 2oci_lob_seek()/rewind()/append() 3--EXTENSIONS-- 4oci8 5--SKIPIF-- 6<?php 7$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs 8require(__DIR__.'/skipif.inc'); 9?> 10--FILE-- 11<?php 12 13require __DIR__.'/connect.inc'; 14require __DIR__.'/create_table.inc'; 15 16$ora_sql = "INSERT INTO 17 ".$schema.$table_name." (blob) 18 VALUES (empty_blob()) 19 RETURNING 20 blob 21 INTO :v_blob "; 22 23$statement = oci_parse($c,$ora_sql); 24$blob = oci_new_descriptor($c,OCI_D_LOB); 25oci_bind_by_name($statement,":v_blob", $blob,-1,OCI_B_BLOB); 26oci_execute($statement, OCI_DEFAULT); 27 28var_dump($blob); 29 30var_dump(oci_lob_write($blob, "test")); 31var_dump(oci_lob_rewind($blob)); 32var_dump(oci_lob_write($blob, "str")); 33var_dump(oci_lob_seek($blob, 10, OCI_SEEK_SET)); 34 35oci_commit($c); 36 37$select_sql = "SELECT blob FROM ".$schema.$table_name." FOR UPDATE"; 38$s = oci_parse($c, $select_sql); 39oci_execute($s, OCI_DEFAULT); 40 41var_dump($row = oci_fetch_array($s)); 42var_dump(oci_lob_append($row[0], $blob)); 43var_dump(oci_lob_read($row[0], 10000)); 44 45oci_commit($c); 46 47$select_sql = "SELECT blob FROM ".$schema.$table_name." FOR UPDATE"; 48$s = oci_parse($c, $select_sql); 49oci_execute($s, OCI_DEFAULT); 50 51$row = oci_fetch_array($s); 52 53var_dump(oci_lob_read($row[0], 10000)); 54 55require __DIR__.'/drop_table.inc'; 56 57echo "Done\n"; 58 59?> 60--EXPECTF-- 61object(OCILob)#%d (1) { 62 ["descriptor"]=> 63 resource(%d) of type (oci8 descriptor) 64} 65int(4) 66bool(true) 67int(3) 68bool(true) 69array(2) { 70 [0]=> 71 object(OCILob)#%d (1) { 72 ["descriptor"]=> 73 resource(%d) of type (oci8 descriptor) 74 } 75 ["BLOB"]=> 76 object(OCILob)#%d (1) { 77 ["descriptor"]=> 78 resource(%d) of type (oci8 descriptor) 79 } 80} 81bool(true) 82string(4) "strt" 83string(8) "strtstrt" 84Done 85