summaryrefslogtreecommitdiff
path: root/ext/oci8/tests
diff options
context:
space:
mode:
authorOndřej Surý <ondrej@sury.org>2012-04-06 14:37:49 +0200
committerOndřej Surý <ondrej@sury.org>2012-04-06 14:37:49 +0200
commit7b10b0041aa63c6f8990ceb3ccc190bdd9eea2b9 (patch)
tree01edb9389d7b7f6b277a57e2bce1d05f9748d609 /ext/oci8/tests
parent096b2f823b2273e3ee707b3805feb78d1e4be61d (diff)
downloadphp-7b10b0041aa63c6f8990ceb3ccc190bdd9eea2b9.tar.gz
Imported Upstream version 5.4.1~rc1upstream/5.4.1_rc1
Diffstat (limited to 'ext/oci8/tests')
-rw-r--r--ext/oci8/tests/array_bind_bdouble.phpt1
-rw-r--r--ext/oci8/tests/array_bind_bfloat.phpt1
-rw-r--r--ext/oci8/tests/bind_raw_2.phpt42
-rw-r--r--ext/oci8/tests/bind_sqltint.phpt109
-rw-r--r--ext/oci8/tests/bug43497_92.phpt8
-rw-r--r--ext/oci8/tests/drcp_privileged.phpt7
6 files changed, 164 insertions, 4 deletions
diff --git a/ext/oci8/tests/array_bind_bdouble.phpt b/ext/oci8/tests/array_bind_bdouble.phpt
index 1bb95b236..fb173654b 100644
--- a/ext/oci8/tests/array_bind_bdouble.phpt
+++ b/ext/oci8/tests/array_bind_bdouble.phpt
@@ -4,6 +4,7 @@ Unsupported type: oci_bind_array_by_name() and SQLT_BDOUBLE
<?php
$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
require(dirname(__FILE__).'/skipif.inc');
+if (!defined('SQLT_BDOUBLE')) die('skip SQLT_BDOUBLE type not available on older Oracle clients');
?>
--FILE--
<?php
diff --git a/ext/oci8/tests/array_bind_bfloat.phpt b/ext/oci8/tests/array_bind_bfloat.phpt
index 0b8fad6e6..fdd43958c 100644
--- a/ext/oci8/tests/array_bind_bfloat.phpt
+++ b/ext/oci8/tests/array_bind_bfloat.phpt
@@ -4,6 +4,7 @@ Unsupported type: oci_bind_array_by_name() and SQLT_BFLOAT
<?php
$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
require(dirname(__FILE__).'/skipif.inc');
+if (!defined('SQLT_BFLOAT')) die('skip SQLT_BFLOAT type not available on older Oracle clients');
?>
--FILE--
<?php
diff --git a/ext/oci8/tests/bind_raw_2.phpt b/ext/oci8/tests/bind_raw_2.phpt
new file mode 100644
index 000000000..035c18489
--- /dev/null
+++ b/ext/oci8/tests/bind_raw_2.phpt
@@ -0,0 +1,42 @@
+--TEST--
+bind RAW field with OCI_B_BIN
+--SKIPIF--
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
+--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, OCI_B_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/bind_sqltint.phpt b/ext/oci8/tests/bind_sqltint.phpt
index f01791d3b..ac8518e79 100644
--- a/ext/oci8/tests/bind_sqltint.phpt
+++ b/ext/oci8/tests/bind_sqltint.phpt
@@ -123,6 +123,88 @@ oci_execute($s);
check_col($c, 'number_t92', 150);
+echo "\nTEST151 - 159 Initialization tests\n";
+
+$s = oci_parse($c, "begin :p2 := :p1; end;");
+unset($p1);
+unset($p2);
+oci_bind_by_name($s, ":p1", $p1, 10);
+oci_bind_by_name($s, ":p2", $p2, -1, SQLT_INT);
+oci_execute($s);
+var_dump($p2);
+
+echo "\nTEST152\n";
+
+unset($p1);
+$p2 = null;
+oci_bind_by_name($s, ":p1", $p1, 10);
+oci_bind_by_name($s, ":p2", $p2, -1, SQLT_INT);
+oci_execute($s);
+var_dump($p2);
+
+echo "\nTEST153\n";
+
+unset($p1);
+$p2 = 1111;
+oci_bind_by_name($s, ":p1", $p1, 10);
+oci_bind_by_name($s, ":p2", $p2, -1, SQLT_INT);
+oci_execute($s);
+var_dump($p2);
+
+echo "\nTEST154\n";
+
+$p1 = null;
+unset($p2);
+oci_bind_by_name($s, ":p1", $p1, 10);
+oci_bind_by_name($s, ":p2", $p2, -1, SQLT_INT);
+oci_execute($s);
+var_dump($p2);
+
+echo "\nTEST155\n";
+
+$p1 = null;
+$p2 = null;
+oci_bind_by_name($s, ":p1", $p1, 10);
+oci_bind_by_name($s, ":p2", $p2, -1, SQLT_INT);
+oci_execute($s);
+var_dump($p2);
+
+echo "\nTEST156\n";
+
+$p1 = null;
+$p2 = 2222;
+oci_bind_by_name($s, ":p1", $p1, 10);
+oci_bind_by_name($s, ":p2", $p2, -1, SQLT_INT);
+oci_execute($s);
+var_dump($p2);
+
+echo "\nTEST157\n";
+
+$p1 = 3333;
+unset($p2);
+oci_bind_by_name($s, ":p1", $p1, 10);
+oci_bind_by_name($s, ":p2", $p2, -1, SQLT_INT);
+oci_execute($s);
+var_dump($p2);
+
+echo "\nTEST158\n";
+
+$p1 = 4444;
+$p2 = null;
+oci_bind_by_name($s, ":p1", $p1, 10);
+oci_bind_by_name($s, ":p2", $p2, -1, SQLT_INT);
+oci_execute($s);
+var_dump($p2);
+
+echo "\nTEST159\n";
+
+$p1 = 5555;
+$p2 = 6666;
+oci_bind_by_name($s, ":p1", $p1, 10);
+oci_bind_by_name($s, ":p2", $p2, -1, SQLT_INT);
+oci_execute($s);
+var_dump($p2);
+
// Clean up
$stmtarray = array(
@@ -224,4 +306,31 @@ array(1) {
string(1) "0"
}
}
+
+TEST151 - 159 Initialization tests
+NULL
+
+TEST152
+NULL
+
+TEST153
+NULL
+
+TEST154
+NULL
+
+TEST155
+NULL
+
+TEST156
+NULL
+
+TEST157
+int(3333)
+
+TEST158
+int(4444)
+
+TEST159
+int(5555)
===DONE===
diff --git a/ext/oci8/tests/bug43497_92.phpt b/ext/oci8/tests/bug43497_92.phpt
index d4201257c..cc2a96318 100644
--- a/ext/oci8/tests/bug43497_92.phpt
+++ b/ext/oci8/tests/bug43497_92.phpt
@@ -5,8 +5,12 @@ Bug #43497 (OCI8 XML/getClobVal aka temporary LOBs leak UGA memory)
$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
require(dirname(__FILE__).'/skipif.inc');
if (getenv('SKIP_SLOW_TESTS')) die('skip slow tests excluded by request');
-if (preg_match('/Unknown/', oci_client_version()) != 1) {
- die("skip expected output only valid with Oracle 9gR2 clients");
+ob_start();
+phpinfo(INFO_MODULES);
+$phpinfo = ob_get_clean();
+$iv = preg_match('/Oracle .*Version => (9\.2)/', $phpinfo);
+if ($iv != 1) {
+ die ("skip tests a feature that works only with Oracle 9iR2 client");
}
?>
--FILE--
diff --git a/ext/oci8/tests/drcp_privileged.phpt b/ext/oci8/tests/drcp_privileged.phpt
index 45b5ee4bd..da8702e3c 100644
--- a/ext/oci8/tests/drcp_privileged.phpt
+++ b/ext/oci8/tests/drcp_privileged.phpt
@@ -3,11 +3,14 @@ DRCP: privileged connect
--SKIPIF--
<?php
if (!extension_loaded('oci8')) die("skip no oci8 extension");
-if (strcasecmp($user, "system") && strcasecmp($user, "sys")) die("skip needs to be run as a DBA user");
require(dirname(__FILE__)."/details.inc");
+if (strcasecmp($user, "system") && strcasecmp($user, "sys")) die("skip needs to be run as a DBA user");
+ob_start();
+phpinfo(INFO_MODULES);
+$phpinfo = ob_get_clean();
if (preg_match('/Compile-time ORACLE_HOME/', $phpinfo) !== 1) {
// Assume building PHP with an ORACLE_HOME means the tested DB is on the same machine as PHP
- die("skip this test is unlikely to work with remote Oracle - unless an Oracle password file has been created");
+ die("skip this test is unlikely to work with a remote database - unless an Oracle password file has been created");
}
?>
--INI--