1--TEST-- 2oci_lob_truncate() with default parameter value 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_044_tab", 20 "create table lob_044_tab (blob BLOB)", 21); 22 23oci8_test_sql_execute($c, $stmtarray); 24 25 26// Run Test 27 28echo "Test 1 - truncate on insert\n"; 29 30$s = oci_parse($c, "INSERT INTO lob_044_tab (blob) VALUES (empty_blob()) RETURNING blob INTO :v_blob "); 31$blob = oci_new_descriptor($c, OCI_D_LOB); 32oci_bind_by_name($s,":v_blob", $blob, -1, OCI_B_BLOB); 33oci_execute($s, OCI_DEFAULT); 34 35var_dump($blob->write("this is a biiiig faaat test string. why are you reading it, I wonder? =)")); 36var_dump($blob->seek(0)); 37var_dump($blob->read(10000)); 38var_dump($blob->truncate()); 39var_dump($blob->seek(0)); 40var_dump($blob->read(10000)); 41 42oci_commit($c); 43 44 45// Read it back 46 47echo "\nTest 2 - read it back\n"; 48 49$s = oci_parse($c, "SELECT blob FROM lob_044_tab FOR UPDATE"); 50oci_execute($s, OCI_DEFAULT); 51$row = oci_fetch_array($s); 52var_dump($row[0]->read(10000)); 53 54// Clean up 55 56$stmtarray = array( 57 "drop table lob_044_tab" 58); 59 60oci8_test_sql_execute($c, $stmtarray); 61 62?> 63--EXPECT-- 64Test 1 - truncate on insert 65int(72) 66bool(true) 67string(72) "this is a biiiig faaat test string. why are you reading it, I wonder? =)" 68bool(true) 69bool(true) 70string(0) "" 71 72Test 2 - read it back 73string(0) "" 74