summaryrefslogtreecommitdiff
path: root/ext/oci8/tests/prefetch.phpt
diff options
context:
space:
mode:
Diffstat (limited to 'ext/oci8/tests/prefetch.phpt')
-rw-r--r--ext/oci8/tests/prefetch.phpt51
1 files changed, 36 insertions, 15 deletions
diff --git a/ext/oci8/tests/prefetch.phpt b/ext/oci8/tests/prefetch.phpt
index fa4b8fdc6..26762601d 100644
--- a/ext/oci8/tests/prefetch.phpt
+++ b/ext/oci8/tests/prefetch.phpt
@@ -5,26 +5,39 @@ oci_set_prefetch()
--FILE--
<?php
-require dirname(__FILE__)."/connect.inc";
-require dirname(__FILE__).'/create_table.inc';
+require(dirname(__FILE__)."/connect.inc");
-$insert_sql = "INSERT INTO ".$schema.$table_name." (id, value) VALUES (1,1)";
+// Initialize
-if (!($s = oci_parse($c, $insert_sql))) {
- die("oci_parse(insert) failed!\n");
-}
+$stmtarray = array(
+ "drop table prefetch_tab",
+ "create table prefetch_tab (id number, value number)",
+ "insert into prefetch_tab (id, value) values (1,1)",
+ "insert into prefetch_tab (id, value) values (1,1)",
+ "insert into prefetch_tab (id, value) values (1,1)",
+);
-for ($i = 0; $i<3; $i++) {
- if (!oci_execute($s)) {
- die("oci_execute(insert) failed!\n");
+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
+ ))) {
+ echo $stmt . PHP_EOL . $m['message'] . PHP_EOL;
+ }
}
}
-if (!oci_commit($c)) {
- die("oci_commit() failed!\n");
+foreach ($stmtarray as $stmt) {
+ $s = oci_parse($c, $stmt);
+ oci_execute($s);
}
-$select_sql = "SELECT * FROM ".$schema.$table_name."";
+// Run Test
+
+$select_sql = "select * from prefetch_tab";
if (!($s = oci_parse($c, $select_sql))) {
die("oci_parse(select) failed!\n");
@@ -37,11 +50,19 @@ if (!oci_execute($s)) {
}
var_dump(oci_fetch($s));
-
var_dump(oci_num_rows($s));
-require dirname(__FILE__).'/drop_table.inc';
-
+// Cleanup
+
+$stmtarray = array(
+ "drop table prefetch_tab"
+);
+
+foreach ($stmtarray as $stmt) {
+ $s = oci_parse($c, $stmt);
+ oci_execute($s);
+}
+
echo "Done\n";
?>
--EXPECT--