summaryrefslogtreecommitdiff
path: root/ext/oci8/tests
diff options
context:
space:
mode:
authorAntony Dovgal <tony2001@php.net>2006-04-12 19:21:35 +0000
committerAntony Dovgal <tony2001@php.net>2006-04-12 19:21:35 +0000
commit5751903b1baad353521a47a0421c57ea16f614f5 (patch)
tree1ec26039a8e9be52d8468980a0d08b8cb8c7eee2 /ext/oci8/tests
parent2d2f1cf0c696b49640dca7a034924131f6946737 (diff)
downloadphp-git-5751903b1baad353521a47a0421c57ea16f614f5.tar.gz
fix #37059 (oci_bind_by_name() doesn't support RAW and LONG RAW fields)
add tests
Diffstat (limited to 'ext/oci8/tests')
-rw-r--r--ext/oci8/tests/bind_long.phpt38
-rw-r--r--ext/oci8/tests/bind_long_raw.phpt38
-rw-r--r--ext/oci8/tests/bind_raw.phpt39
-rw-r--r--ext/oci8/tests/test.gifbin0 -> 2523 bytes
4 files changed, 115 insertions, 0 deletions
diff --git a/ext/oci8/tests/bind_long.phpt b/ext/oci8/tests/bind_long.phpt
new file mode 100644
index 0000000000..58590f145a
--- /dev/null
+++ b/ext/oci8/tests/bind_long.phpt
@@ -0,0 +1,38 @@
+--TEST--
+bind LONG field
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+require dirname(__FILE__)."/connect.inc";
+
+$stmt = oci_parse($c, "create table phptestlng( id number(10), fileimage long)");
+oci_execute($stmt);
+
+$stmt = oci_parse ($c, "insert into phptestlng (id, fileimage) values (:id, :fileimage)");
+$i=1;
+$fileimage = file_get_contents( dirname(__FILE__)."/test.gif");
+
+oci_bind_by_name( $stmt, ":id", $i, -1);
+oci_bind_by_name( $stmt, ":fileimage", $fileimage, -1, SQLT_LNG);
+oci_execute($stmt, OCI_DEFAULT);
+oci_commit($c);
+
+$stmt = oci_parse($c, "SELECT fileimage FROM phptestlng");
+oci_execute($stmt);
+
+$row = oci_fetch_row($stmt);
+var_dump(md5($row[0]));
+var_dump(strlen($row[0]));
+
+$stmt = oci_parse($c, "drop table phptestlng");
+oci_execute($stmt);
+
+echo "Done\n";
+
+?>
+--EXPECT--
+string(32) "d04e7036e2f4221abc88fd14e960a45b"
+int(2523)
+Done
diff --git a/ext/oci8/tests/bind_long_raw.phpt b/ext/oci8/tests/bind_long_raw.phpt
new file mode 100644
index 0000000000..2a9962eace
--- /dev/null
+++ b/ext/oci8/tests/bind_long_raw.phpt
@@ -0,0 +1,38 @@
+--TEST--
+bind LONG RAW field
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+require dirname(__FILE__)."/connect.inc";
+
+$stmt = oci_parse($c, "create table phptestlngraw( id number(10), fileimage long raw)");
+oci_execute($stmt);
+
+$stmt = oci_parse ($c, "insert into phptestlngraw (id, fileimage) values (:id, :fileimage)");
+$i=1;
+$fileimage = file_get_contents( dirname(__FILE__)."/test.gif");
+
+oci_bind_by_name( $stmt, ":id", $i, -1);
+oci_bind_by_name( $stmt, ":fileimage", $fileimage, -1, SQLT_LBI);
+oci_execute($stmt, OCI_DEFAULT);
+oci_commit($c);
+
+$stmt = oci_parse($c, "SELECT fileimage FROM phptestlngraw");
+oci_execute($stmt);
+
+$row = oci_fetch_row($stmt);
+var_dump(md5($row[0]));
+var_dump(strlen($row[0]));
+
+$stmt = oci_parse($c, "drop table phptestlngraw");
+oci_execute($stmt);
+
+echo "Done\n";
+
+?>
+--EXPECT--
+string(32) "614fcbba1effb7caa27ef0ef25c27fcf"
+int(2523)
+Done
diff --git a/ext/oci8/tests/bind_raw.phpt b/ext/oci8/tests/bind_raw.phpt
new file mode 100644
index 0000000000..c9087e552b
--- /dev/null
+++ b/ext/oci8/tests/bind_raw.phpt
@@ -0,0 +1,39 @@
+--TEST--
+bind RAW field
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+require dirname(__FILE__)."/connect.inc";
+
+$stmt = oci_parse($c, "create table phptestrawtable( id number(10), fileimage raw(1000))");
+oci_execute($stmt);
+
+$stmt = oci_parse ($c, "insert into phptestrawtable (id, fileimage) values (:id, :fileimage)");
+$i=1;
+$fileimage = file_get_contents( dirname(__FILE__)."/test.gif");
+$fileimage = substr($fileimage, 0, 300);
+
+oci_bind_by_name( $stmt, ":id", $i, -1);
+oci_bind_by_name( $stmt, ":fileimage", $fileimage, -1, SQLT_BIN);
+oci_execute($stmt, OCI_DEFAULT);
+oci_commit($c);
+
+$stmt = oci_parse($c, "SELECT fileimage FROM phptestrawtable");
+oci_execute($stmt);
+
+$row = oci_fetch_row($stmt);
+var_dump(md5($row[0]));
+var_dump(strlen($row[0]));
+
+$stmt = oci_parse($c, "drop table phptestrawtable");
+oci_execute($stmt);
+
+echo "Done\n";
+
+?>
+--EXPECT--
+string(32) "88b274d7a257ac6f70435b83abd4e26e"
+int(300)
+Done
diff --git a/ext/oci8/tests/test.gif b/ext/oci8/tests/test.gif
new file mode 100644
index 0000000000..f352c7308f
--- /dev/null
+++ b/ext/oci8/tests/test.gif
Binary files differ