Updates to Tomato RAF including NGINX && PHP
[tomato.git] / release / src / router / php / ext / oci8 / tests / bind_rowid.phpt
blob122ad5e18e422d0077dbd94b651177c389d97c9b
1 --TEST--
2 Test ROWID bind
3 --SKIPIF--
4 <?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
5 --FILE--
6 <?php
8 require(dirname(__FILE__)."/connect.inc");
10 function do_query($c)
12         $s = oci_parse($c, 'select address from rid_tab order by id');
13         $id = 1;
14         oci_execute($s, OCI_DEFAULT);
15         while ($row = oci_fetch_array($s, OCI_ASSOC+OCI_RETURN_NULLS)) {
16                 var_dump($row);
17         }
20 $stmtarray = array(
21         "drop table rid_tab",
22         "create table rid_tab (id number, address varchar2(40))",
23         "insert into rid_tab (id, address) values (1, 'original text #1')",
24         "insert into rid_tab (id, address) values (2, 'original text #2')"
27 oci8_test_sql_execute($c, $stmtarray);
29 echo "Initial Data\n";
30 do_query($c);
32 $s = oci_parse($c, 'select rowid, address from rid_tab where id = :l_bv for update');
33 $id = 1;
34 oci_bind_by_name($s, ':l_bv', $id);
35 oci_execute($s, OCI_DEFAULT);
36 $row = oci_fetch_array($s, OCI_ASSOC+OCI_RETURN_NULLS);
38 $rid = $row['ROWID'];
39 $addr = $row['ADDRESS'];
41 $addr = 'Some new text';
43 // Save changes
44 $s = oci_parse($c,'update rid_tab set address = :a_bv where rowid = :r_bv');
45 oci_bind_by_name($s, ':r_bv', $rid, -1, OCI_B_ROWID);
46 oci_bind_by_name($s, ':a_bv', $addr);
47 oci_execute($s);
49 echo "Verify Change\n";
50 do_query($c);
52 // Cleanup
54 $stmtarray = array(
55     "drop table rid_tab"
58 oci8_test_sql_execute($c, $stmtarray);
60 echo "Done\n";
63 --EXPECT--
64 Initial Data
65 array(1) {
66   ["ADDRESS"]=>
67   string(16) "original text #1"
69 array(1) {
70   ["ADDRESS"]=>
71   string(16) "original text #2"
73 Verify Change
74 array(1) {
75   ["ADDRESS"]=>
76   string(13) "Some new text"
78 array(1) {
79   ["ADDRESS"]=>
80   string(16) "original text #2"
82 Done