diff options
Diffstat (limited to 'ext/oci8/tests/fetch_object.phpt')
| -rw-r--r-- | ext/oci8/tests/fetch_object.phpt | 52 |
1 files changed, 19 insertions, 33 deletions
diff --git a/ext/oci8/tests/fetch_object.phpt b/ext/oci8/tests/fetch_object.phpt index 674a88ff28..1c290d5e95 100644 --- a/ext/oci8/tests/fetch_object.phpt +++ b/ext/oci8/tests/fetch_object.phpt @@ -1,7 +1,10 @@ --TEST-- oci_fetch_object() --SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> +<?php +$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> --FILE-- <?php @@ -10,53 +13,39 @@ require(dirname(__FILE__).'/connect.inc'); // Initialization $stmtarray = array( - "drop table fetch_object_tab", - "create table fetch_object_tab (\"caseSensitive\" number, secondcol varchar2(20), anothercol char(15))", - "insert into fetch_object_tab values (123, '1st row col2 string', '1 more text')", - "insert into fetch_object_tab values (456, '2nd row col2 string', '2 more text')", - "insert into fetch_object_tab values (789, '3rd row col2 string', '3 more text')", + "drop table fetch_object_tab", + "create table fetch_object_tab (\"caseSensitive\" number, secondcol varchar2(20), anothercol char(15))", + "insert into fetch_object_tab values (123, '1st row col2 string', '1 more text')", + "insert into fetch_object_tab values (456, '2nd row col2 string', '2 more text')", + "insert into fetch_object_tab values (789, '3rd row col2 string', '3 more text')", ); -foreach ($stmtarray as $stmt) { - $s = oci_parse($c, $stmt); - $r = @oci_execute($s); - if (!$r) { - $m = oci_error($s); - if (!in_array($m['code'], array( // ignore expected errors - 942 // table or view does not exist - , 2289 // sequence does not exist - , 4080 // trigger does not exist - , 38802 // edition does not exist - ))) { - echo $stmt . PHP_EOL . $m['message'] . PHP_EOL; - } - } -} +oci8_test_sql_execute($c, $stmtarray); // Run Test echo "Test 1\n"; if (!($s = oci_parse($c, 'select * from fetch_object_tab'))) { - die("oci_parse(select) failed!\n"); + die("oci_parse(select) failed!\n"); } if (!oci_execute($s)) { - die("oci_execute(select) failed!\n"); + die("oci_execute(select) failed!\n"); } while ($row = oci_fetch_object($s)) { - var_dump($row); + var_dump($row); } echo "Test 2\n"; if (!($s = oci_parse($c, 'select * from fetch_object_tab'))) { - die("oci_parse(select) failed!\n"); + die("oci_parse(select) failed!\n"); } if (!oci_execute($s)) { - die("oci_execute(select) failed!\n"); + die("oci_execute(select) failed!\n"); } while ($row = oci_fetch_object($s)) { @@ -68,11 +57,11 @@ while ($row = oci_fetch_object($s)) { echo "Test 3\n"; if (!($s = oci_parse($c, 'select * from fetch_object_tab where rownum < 2 order by "caseSensitive"'))) { - die("oci_parse(select) failed!\n"); + die("oci_parse(select) failed!\n"); } if (!oci_execute($s)) { - die("oci_execute(select) failed!\n"); + die("oci_execute(select) failed!\n"); } $row = oci_fetch_object($s); @@ -82,13 +71,10 @@ echo $row->CASESENSITIVE . "\n"; // Clean up $stmtarray = array( - "drop table fetch_object_tab" + "drop table fetch_object_tab" ); -foreach ($stmtarray as $stmt) { - $s = oci_parse($c, $stmt); - oci_execute($s); -} +oci8_test_sql_execute($c, $stmtarray); ?> ===DONE=== |
