Updates to Tomato RAF including NGINX && PHP
[tomato.git] / release / src / router / php / ext / oci8 / tests / fetch_object_2.phpt
blob1814446aa8805e60da71593aa494a8a60ec0fe9b
1 --TEST--
2 oci_fetch_object() with CLOB and NULL
3 --SKIPIF--
4 <?php
5 $target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
6 require(dirname(__FILE__).'/skipif.inc');
7 ?>
8 --FILE--
9 <?php
11 require(dirname(__FILE__).'/connect.inc');
13 // Initialization
15 $stmtarray = array(
16     "drop table fetch_object_2_tab",
17     "create table fetch_object_2_tab (col1 number, col2 CLOB, col3 varchar2(15))",
18     "insert into fetch_object_2_tab values (123, '1st row col2 string', '1 more text')",
19     "insert into fetch_object_2_tab values (456, '2nd row col2 string', NULL)",
20     "insert into fetch_object_2_tab values (789, '3rd row col2 string', '3 more text')",
23 oci8_test_sql_execute($c, $stmtarray);
25 // Run Test
27 echo "Test 1\n";
29 if (!($s = oci_parse($c, 'select * from fetch_object_2_tab order by 1'))) {
30     die("oci_parse(select) failed!\n");
33 if (!oci_execute($s)) {
34     die("oci_execute(select) failed!\n");
37 while ($row = oci_fetch_object($s)) {
38     var_dump($row);
41 echo "Test 2\n";
43 if (!($s = oci_parse($c, 'select * from fetch_object_2_tab order by 1'))) {
44     die("oci_parse(select) failed!\n");
47 if (!oci_execute($s)) {
48     die("oci_execute(select) failed!\n");
51 while ($row = oci_fetch_object($s)) {
52     echo $row->COL1 . "\n";
53     echo $row->COL2->load(100) . "\n";
54     echo $row->COL3 . "\n";
57 // Clean up
59 $stmtarray = array(
60     "drop table fetch_object_2_tab"
63 oci8_test_sql_execute($c, $stmtarray);
66 ===DONE===
67 <?php exit(0); ?>
68 --EXPECTF--
69 Test 1
70 object(stdClass)#%d (3) {
71   ["COL1"]=>
72   string(3) "123"
73   ["COL2"]=>
74   object(OCI-Lob)#%d (1) {
75     ["descriptor"]=>
76     resource(%d) of type (oci8 descriptor)
77   }
78   ["COL3"]=>
79   string(11) "1 more text"
81 object(stdClass)#%d (3) {
82   ["COL1"]=>
83   string(3) "456"
84   ["COL2"]=>
85   object(OCI-Lob)#%d (1) {
86     ["descriptor"]=>
87     resource(%d) of type (oci8 descriptor)
88   }
89   ["COL3"]=>
90   NULL
92 object(stdClass)#%d (3) {
93   ["COL1"]=>
94   string(3) "789"
95   ["COL2"]=>
96   object(OCI-Lob)#%d (1) {
97     ["descriptor"]=>
98     resource(%d) of type (oci8 descriptor)
99   }
100   ["COL3"]=>
101   string(11) "3 more text"
103 Test 2
105 1st row col2 string
106 1 more text
108 2nd row col2 string
111 3rd row col2 string
112 3 more text
113 ===DONE===