1--TEST-- 2fetching the same lob several times 3--SKIPIF-- 4<?php 5$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs 6require(__DIR__.'/skipif.inc'); 7?> 8--FILE-- 9<?php 10 11require __DIR__.'/connect.inc'; 12 13$drop = "DROP table lob_test"; 14$statement = oci_parse($c, $drop); 15@oci_execute($statement); 16 17$create = "CREATE table lob_test(mykey NUMBER, lob_1 CLOB)"; 18$statement = oci_parse($c, $create); 19oci_execute($statement); 20 21$init = "INSERT INTO lob_test (mykey, lob_1) VALUES(1, EMPTY_CLOB()) RETURNING lob_1 INTO :mylob"; 22$statement = oci_parse($c, $init); 23$clob = oci_new_descriptor($c, OCI_D_LOB); 24oci_bind_by_name($statement, ":mylob", $clob, -1, OCI_B_CLOB); 25oci_execute($statement, OCI_DEFAULT); 26$clob->save(); 27oci_lob_save(); 28oci_lob_save($clob, "data"); 29unset($clob->descriptor); 30oci_lob_save($clob, "data"); 31 32oci_commit($c); 33 34$init = "INSERT INTO lob_test (mykey, lob_1) VALUES(2, EMPTY_CLOB()) RETURNING lob_1 INTO :mylob"; 35$statement = oci_parse($c, $init); 36$clob = oci_new_descriptor($c, OCI_D_LOB); 37oci_bind_by_name($statement, ":mylob", $clob, -1, OCI_B_CLOB); 38oci_execute($statement, OCI_DEFAULT); 39$clob->save("long data"); 40$clob->save("long data", -1); 41$clob->save("long data", 0); 42 43oci_commit($c); 44 45 46$query = 'SELECT * FROM lob_test ORDER BY mykey ASC'; 47$statement = oci_parse ($c, $query); 48oci_execute($statement, OCI_DEFAULT); 49 50while ($row = oci_fetch_array($statement, OCI_ASSOC)) { 51 $result = $row['LOB_1']->load(); 52 var_dump($result); 53} 54 55$query = 'SELECT * FROM lob_test ORDER BY mykey DESC'; 56$statement = oci_parse ($c, $query); 57oci_execute($statement, OCI_DEFAULT); 58 59while ($row = oci_fetch_array($statement, OCI_ASSOC)) { 60 $result = $row['LOB_1']->load(); 61 var_dump($result); 62} 63 64$drop = "DROP table lob_test"; 65$statement = oci_parse($c, $drop); 66@oci_execute($statement); 67 68echo "Done\n"; 69 70?> 71--EXPECTF-- 72Warning: OCI-Lob::save() expects at least 1 parameter, 0 given in %s on line %d 73 74Warning: oci_lob_save() expects at least 2 parameters, 0 given in %s on line %d 75 76Warning: oci_lob_save(): Unable to find descriptor property in %s on line %d 77 78Warning: OCI-Lob::save(): Offset parameter must be greater than or equal to 0 in %s on line %d 79string(4) "data" 80string(9) "long data" 81string(9) "long data" 82string(4) "data" 83Done 84