1--TEST-- 2Test ROWID bind 3--EXTENSIONS-- 4oci8 5--SKIPIF-- 6<?php 7require_once 'skipifconnectfailure.inc'; 8?> 9--FILE-- 10<?php 11 12require __DIR__.'/connect.inc'; 13 14function do_query($c) 15{ 16 $s = oci_parse($c, 'select address from rid_tab order by id'); 17 $id = 1; 18 oci_execute($s, OCI_DEFAULT); 19 while ($row = oci_fetch_array($s, OCI_ASSOC+OCI_RETURN_NULLS)) { 20 var_dump($row); 21 } 22} 23 24$stmtarray = array( 25 "drop table rid_tab", 26 "create table rid_tab (id number, address varchar2(40))", 27 "insert into rid_tab (id, address) values (1, 'original text #1')", 28 "insert into rid_tab (id, address) values (2, 'original text #2')" 29); 30 31oci8_test_sql_execute($c, $stmtarray); 32 33echo "Initial Data\n"; 34do_query($c); 35 36$s = oci_parse($c, 'select rowid, address from rid_tab where id = :l_bv for update'); 37$id = 1; 38oci_bind_by_name($s, ':l_bv', $id); 39oci_execute($s, OCI_DEFAULT); 40$row = oci_fetch_array($s, OCI_ASSOC+OCI_RETURN_NULLS); 41 42$rid = $row['ROWID']; 43$addr = $row['ADDRESS']; 44 45$addr = 'Some new text'; 46 47// Save changes 48$s = oci_parse($c,'update rid_tab set address = :a_bv where rowid = :r_bv'); 49oci_bind_by_name($s, ':r_bv', $rid, -1, OCI_B_ROWID); 50oci_bind_by_name($s, ':a_bv', $addr); 51oci_execute($s); 52 53echo "Verify Change\n"; 54do_query($c); 55 56// Cleanup 57 58$stmtarray = array( 59 "drop table rid_tab" 60); 61 62oci8_test_sql_execute($c, $stmtarray); 63 64echo "Done\n"; 65 66?> 67--EXPECT-- 68Initial Data 69array(1) { 70 ["ADDRESS"]=> 71 string(16) "original text #1" 72} 73array(1) { 74 ["ADDRESS"]=> 75 string(16) "original text #2" 76} 77Verify Change 78array(1) { 79 ["ADDRESS"]=> 80 string(13) "Some new text" 81} 82array(1) { 83 ["ADDRESS"]=> 84 string(16) "original text #2" 85} 86Done 87