summaryrefslogtreecommitdiff
path: root/ext/oci8/tests/define1.phpt
diff options
context:
space:
mode:
authorOndřej Surý <ondrej@sury.org>2010-03-09 11:57:54 +0100
committerOndřej Surý <ondrej@sury.org>2010-03-09 11:57:54 +0100
commit855a09f4eded707941180c9d90acd17c25e29447 (patch)
treea40947efaa9876f31b6ee3956c3f3775768143bb /ext/oci8/tests/define1.phpt
parentc852c28a88fccf6e34a2cb091fdfa72bce2b59c7 (diff)
downloadphp-855a09f4eded707941180c9d90acd17c25e29447.tar.gz
Imported Upstream version 5.3.2upstream/5.3.2
Diffstat (limited to 'ext/oci8/tests/define1.phpt')
-rw-r--r--ext/oci8/tests/define1.phpt45
1 files changed, 33 insertions, 12 deletions
diff --git a/ext/oci8/tests/define1.phpt b/ext/oci8/tests/define1.phpt
index f6e04cc18..341bc9ed8 100644
--- a/ext/oci8/tests/define1.phpt
+++ b/ext/oci8/tests/define1.phpt
@@ -5,24 +5,36 @@ oci_define_by_name()
--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." (string) VALUES ('some')";
+// Initialize
-if (!($s = oci_parse($c, $insert_sql))) {
- die("oci_parse(insert) failed!\n");
-}
+$stmtarray = array(
+ "drop table define1_tab",
+ "create table define1_tab (string varchar(10))",
+ "insert into define1_tab (string) values ('some')",
+);
-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;
+ }
+ }
}
-$stmt = oci_parse($c, "SELECT string FROM ".$table_name."");
+// Run test
+
+$stmt = oci_parse($c, "select string from define1_tab");
/* the define MUST be done BEFORE ociexecute! */
-$strong = '';
+$string = '';
var_dump(oci_define_by_name($stmt, "STRING", $string, 20));
var_dump(oci_define_by_name($stmt, "STRING", $string, 20));
var_dump(oci_define_by_name($stmt, "", $string, 20));
@@ -34,7 +46,16 @@ while (oci_fetch($stmt)) {
var_dump($string);
}
-require dirname(__FILE__)."/drop_table.inc";
+// Cleanup
+
+$stmtarray = array(
+ "drop table define1_tab"
+);
+
+foreach ($stmtarray as $stmt) {
+ $s = oci_parse($c, $stmt);
+ oci_execute($s);
+}
echo "Done\n";
@@ -48,5 +69,5 @@ bool(false)
Warning: oci_define_by_name() expects at least 3 parameters, 2 given in %s on line %d
NULL
-string(4) "some"
+%unicode|string%(4) "some"
Done