summaryrefslogtreecommitdiff
path: root/ext/oci8/tests
diff options
context:
space:
mode:
authorAntony Dovgal <tony2001@php.net>2005-12-01 13:39:48 +0000
committerAntony Dovgal <tony2001@php.net>2005-12-01 13:39:48 +0000
commit3756201e048585a891540645ea22adf3b1b96d20 (patch)
tree83bbb31ef0ae4d58f0de5f4a7ec62ffce0afb568 /ext/oci8/tests
parent916ad6c8f71b340a13800f2be08cd83c96242874 (diff)
downloadphp-git-3756201e048585a891540645ea22adf3b1b96d20.tar.gz
upgrade bundled OCI8 to v.1.1
Diffstat (limited to 'ext/oci8/tests')
-rw-r--r--ext/oci8/tests/bind_empty.phpt44
-rw-r--r--ext/oci8/tests/bug26133.phpt31
-rw-r--r--ext/oci8/tests/bug27303.phpt257
-rw-r--r--ext/oci8/tests/bug27303_2.phpt257
-rw-r--r--ext/oci8/tests/bug27303_3.phpt257
-rw-r--r--ext/oci8/tests/bug27303_4.phpt257
-rw-r--r--ext/oci8/tests/bug32325.phpt44
-rw-r--r--ext/oci8/tests/close.phpt22
-rw-r--r--ext/oci8/tests/coll_001.phpt33
-rw-r--r--ext/oci8/tests/coll_002.phpt36
-rw-r--r--ext/oci8/tests/coll_002_func.phpt36
-rw-r--r--ext/oci8/tests/coll_003.phpt40
-rw-r--r--ext/oci8/tests/coll_003_func.phpt40
-rw-r--r--ext/oci8/tests/coll_004.phpt35
-rw-r--r--ext/oci8/tests/coll_004_func.phpt35
-rw-r--r--ext/oci8/tests/coll_005.phpt33
-rw-r--r--ext/oci8/tests/coll_006.phpt36
-rw-r--r--ext/oci8/tests/coll_006_func.phpt36
-rw-r--r--ext/oci8/tests/coll_007.phpt40
-rw-r--r--ext/oci8/tests/coll_008.phpt35
-rw-r--r--ext/oci8/tests/coll_009.phpt48
-rw-r--r--ext/oci8/tests/coll_009_func.phpt48
-rw-r--r--ext/oci8/tests/coll_010.phpt47
-rw-r--r--ext/oci8/tests/coll_010_func.phpt47
-rw-r--r--ext/oci8/tests/coll_011.phpt49
-rw-r--r--ext/oci8/tests/coll_011_func.phpt49
-rw-r--r--ext/oci8/tests/coll_012.phpt47
-rw-r--r--ext/oci8/tests/coll_012_func.phpt47
-rw-r--r--ext/oci8/tests/coll_013.phpt44
-rw-r--r--ext/oci8/tests/coll_013_func.phpt44
-rw-r--r--ext/oci8/tests/coll_014.phpt44
-rw-r--r--ext/oci8/tests/coll_014_func.phpt44
-rw-r--r--ext/oci8/tests/coll_015.phpt44
-rw-r--r--ext/oci8/tests/coll_015_func.phpt44
-rw-r--r--ext/oci8/tests/coll_016.phpt54
-rw-r--r--ext/oci8/tests/coll_016_func.phpt54
-rw-r--r--ext/oci8/tests/coll_017.phpt44
-rw-r--r--ext/oci8/tests/coll_017_func.phpt44
-rw-r--r--ext/oci8/tests/commit.phpt153
-rw-r--r--ext/oci8/tests/commit_old.phpt151
-rw-r--r--ext/oci8/tests/connect.inc24
-rw-r--r--ext/oci8/tests/connect.phpt27
-rw-r--r--ext/oci8/tests/connect_1.phpt40
-rw-r--r--ext/oci8/tests/connect_1_old.phpt40
-rw-r--r--ext/oci8/tests/connect_old.phpt27
-rw-r--r--ext/oci8/tests/connect_without_oracle_home.phpt25
-rw-r--r--ext/oci8/tests/connect_without_oracle_home_old.phpt25
-rw-r--r--ext/oci8/tests/create_table.inc13
-rw-r--r--ext/oci8/tests/create_type.inc17
-rw-r--r--ext/oci8/tests/cursor_bind_err.phpt53
-rw-r--r--ext/oci8/tests/cursors.phpt64
-rw-r--r--ext/oci8/tests/cursors_old.phpt69
-rw-r--r--ext/oci8/tests/debug.phpt36
-rw-r--r--ext/oci8/tests/default_prefetch.phpt55
-rw-r--r--ext/oci8/tests/default_prefetch1.phpt55
-rw-r--r--ext/oci8/tests/default_prefetch2.phpt58
-rw-r--r--ext/oci8/tests/define.phpt46
-rw-r--r--ext/oci8/tests/define_old.phpt46
-rw-r--r--ext/oci8/tests/drop_table.inc6
-rw-r--r--ext/oci8/tests/drop_type.inc12
-rw-r--r--ext/oci8/tests/error.phpt45
-rw-r--r--ext/oci8/tests/error1.phpt23
-rw-r--r--ext/oci8/tests/error_old.phpt45
-rw-r--r--ext/oci8/tests/exec_fetch.phpt24
-rw-r--r--ext/oci8/tests/fetch.phpt61
-rw-r--r--ext/oci8/tests/fetch_all.phpt154
-rw-r--r--ext/oci8/tests/fetch_array.phpt235
-rw-r--r--ext/oci8/tests/fetch_assoc.phpt69
-rw-r--r--ext/oci8/tests/fetch_into.phpt87
-rw-r--r--ext/oci8/tests/fetch_into1.phpt197
-rw-r--r--ext/oci8/tests/fetch_into2.phpt75
-rw-r--r--ext/oci8/tests/fetch_object.phpt69
-rw-r--r--ext/oci8/tests/fetch_row.phpt69
-rw-r--r--ext/oci8/tests/field_funcs.phpt110
-rw-r--r--ext/oci8/tests/field_funcs_old.phpt110
-rw-r--r--ext/oci8/tests/lob_001.phptbin0 -> 1415 bytes
-rw-r--r--ext/oci8/tests/lob_002.phpt71
-rw-r--r--ext/oci8/tests/lob_003.phptbin0 -> 1787 bytes
-rw-r--r--ext/oci8/tests/lob_004.phpt85
-rw-r--r--ext/oci8/tests/lob_005.phpt57
-rw-r--r--ext/oci8/tests/lob_006.phptbin0 -> 1853 bytes
-rw-r--r--ext/oci8/tests/lob_007.phpt71
-rw-r--r--ext/oci8/tests/lob_008.phpt70
-rw-r--r--ext/oci8/tests/lob_009.phpt74
-rw-r--r--ext/oci8/tests/lob_009.txt6
-rw-r--r--ext/oci8/tests/lob_010.phpt51
-rw-r--r--ext/oci8/tests/lob_011.phpt81
-rw-r--r--ext/oci8/tests/lob_012.phpt55
-rw-r--r--ext/oci8/tests/lob_013.phpt59
-rw-r--r--ext/oci8/tests/lob_014.phpt63
-rw-r--r--ext/oci8/tests/lob_015.phpt56
-rw-r--r--ext/oci8/tests/lob_016.phpt72
-rw-r--r--ext/oci8/tests/lob_017.phpt74
-rw-r--r--ext/oci8/tests/lob_018.phpt72
-rw-r--r--ext/oci8/tests/lob_temp.phpt41
-rw-r--r--ext/oci8/tests/lob_temp1.phpt37
-rw-r--r--ext/oci8/tests/num.phpt71
-rw-r--r--ext/oci8/tests/oci_execute_segfault.phpt35
-rw-r--r--ext/oci8/tests/old_oci_close.phpt28
-rw-r--r--ext/oci8/tests/old_oci_close1.phpt30
-rw-r--r--ext/oci8/tests/password.phpt35
-rw-r--r--ext/oci8/tests/password_new.phpt35
-rw-r--r--ext/oci8/tests/password_old.phpt35
-rw-r--r--ext/oci8/tests/persistent.phpt32
-rw-r--r--ext/oci8/tests/prefetch.phpt56
-rw-r--r--ext/oci8/tests/prefetch_old.phpt56
-rw-r--r--ext/oci8/tests/privileged_connect.phpt31
-rw-r--r--ext/oci8/tests/privileged_connect1.phpt33
-rw-r--r--ext/oci8/tests/serverversion.phpt35
-rw-r--r--ext/oci8/tests/statement_cache.phpt40
-rw-r--r--ext/oci8/tests/statement_type.phpt51
-rw-r--r--ext/oci8/tests/statement_type_old.phpt51
-rw-r--r--ext/oci8/tests/uncommitted.phpt22
113 files changed, 6599 insertions, 33 deletions
diff --git a/ext/oci8/tests/bind_empty.phpt b/ext/oci8/tests/bind_empty.phpt
new file mode 100644
index 0000000000..4088616055
--- /dev/null
+++ b/ext/oci8/tests/bind_empty.phpt
@@ -0,0 +1,44 @@
+--TEST--
+binding empty values
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--ENV--
+return "
+ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
+NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
+";
+--FILE--
+<?php
+
+require dirname(__FILE__).'/connect.inc';
+
+$drop = "DROP table bind_test";
+$statement = oci_parse($c, $drop);
+@oci_execute($statement);
+
+$create = "CREATE table bind_test(name VARCHAR(10))";
+$statement = oci_parse($c, $create);
+oci_execute($statement);
+
+
+$name = null;
+$stmt = oci_parse($c, "UPDATE bind_test SET name=:name");
+oci_bind_by_name($stmt, ":name", &$name);
+
+$res = oci_execute($stmt);
+
+$name = "";
+$stmt = oci_parse($c, "UPDATE bind_test SET name=:name");
+oci_bind_by_name($stmt, ":name", &$name);
+
+$res = oci_execute($stmt);
+
+$drop = "DROP table bind_test";
+$statement = oci_parse($c, $drop);
+@oci_execute($statement);
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+Done
diff --git a/ext/oci8/tests/bug26133.phpt b/ext/oci8/tests/bug26133.phpt
index d3f0ed9bf3..a0492cfde6 100644
--- a/ext/oci8/tests/bug26133.phpt
+++ b/ext/oci8/tests/bug26133.phpt
@@ -1,36 +1,39 @@
--TEST--
Bug #26133 (ocifreedesc() segfault)
--SKIPIF--
-<?php
- require 'skipif.inc';
-?>
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--ENV--
+return "
+ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
+NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
+";
--FILE--
<?php
- require 'connect.inc';
- require 'create_table.inc';
-
- if ($connection) {
+
+ require dirname(__FILE__).'/connect.inc';
+ require dirname(__FILE__).'/create_table.inc';
+
+ if ($c) {
$ora_sql = "INSERT INTO
- ".$schema."php_test_table (id, value)
+ ".$schema.$table_name." (id, value)
VALUES ('1','1')
RETURNING
ROWID
INTO :v_rowid ";
- $statement = OCIParse($connection,$ora_sql);
- $rowid = OCINewDescriptor($connection,OCI_D_ROWID);
+ $statement = OCIParse($c,$ora_sql);
+ $rowid = OCINewDescriptor($c,OCI_D_ROWID);
OCIBindByName($statement,":v_rowid", $rowid,-1,OCI_B_ROWID);
if (OCIExecute($statement)) {
- OCICommit($connection);
+ OCICommit($c);
}
OCIFreeStatement($statement);
$rowid->free();
}
- require 'drop_table.inc';
+ require dirname(__FILE__).'/drop_table.inc';
echo "Done\n";
?>
---EXPECTF--
+--EXPECT--
Done
-
diff --git a/ext/oci8/tests/bug27303.phpt b/ext/oci8/tests/bug27303.phpt
new file mode 100644
index 0000000000..22a1f6d717
--- /dev/null
+++ b/ext/oci8/tests/bug27303.phpt
@@ -0,0 +1,257 @@
+--TEST--
+bug #27303 (OCIBindByName binds numeric PHP values as characters)
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--ENV--
+return "
+ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
+NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
+";
+--FILE--
+<?php
+
+require dirname(__FILE__).'/connect.inc';
+
+$create_st = array();
+$create_st[] = "drop sequence myseq";
+$create_st[] = "drop table mytab";
+$create_st[] = "create sequence myseq";
+$create_st[] = "create table mytab (mydata varchar2(20), seqcol number)";
+
+foreach ($create_st as $statement) {
+ $stmt = oci_parse($c, $statement);
+ oci_execute($stmt);
+}
+
+define('MYLIMIT', 200);
+define('INITMYBV', 11);
+
+$stmt = "insert into mytab (mydata, seqcol) values ('Some data', myseq.nextval) returning seqcol into :mybv";
+
+$stid = OCIParse($c, $stmt);
+if (!$stid) { echo "Parse error"; die; }
+
+//$mybv = INITMYBV; // Uncomment this for the 2nd test only
+$r = OCIBindByName($stid, ':MYBV', $mybv /*, 5 */); // Uncomment this for the 3rd test only
+if (!$r) { echo "Bind error"; die; }
+
+for ($i = 1; $i < MYLIMIT; $i++) {
+ $r = OCIExecute($stid, OCI_DEFAULT);
+ if (!$r) { echo "Execute error"; die; }
+ var_dump($mybv);
+}
+
+OCICommit($c);
+
+$drop_st = array();
+$drop_st[] = "drop sequence myseq";
+$drop_st[] = "drop table mytab";
+
+foreach ($create_st as $statement) {
+ $stmt = oci_parse($c, $statement);
+ oci_execute($stmt);
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+string(1) "1"
+string(1) "2"
+string(1) "3"
+string(1) "4"
+string(1) "5"
+string(1) "6"
+string(1) "7"
+string(1) "8"
+string(1) "9"
+string(2) "10"
+string(2) "11"
+string(2) "12"
+string(2) "13"
+string(2) "14"
+string(2) "15"
+string(2) "16"
+string(2) "17"
+string(2) "18"
+string(2) "19"
+string(2) "20"
+string(2) "21"
+string(2) "22"
+string(2) "23"
+string(2) "24"
+string(2) "25"
+string(2) "26"
+string(2) "27"
+string(2) "28"
+string(2) "29"
+string(2) "30"
+string(2) "31"
+string(2) "32"
+string(2) "33"
+string(2) "34"
+string(2) "35"
+string(2) "36"
+string(2) "37"
+string(2) "38"
+string(2) "39"
+string(2) "40"
+string(2) "41"
+string(2) "42"
+string(2) "43"
+string(2) "44"
+string(2) "45"
+string(2) "46"
+string(2) "47"
+string(2) "48"
+string(2) "49"
+string(2) "50"
+string(2) "51"
+string(2) "52"
+string(2) "53"
+string(2) "54"
+string(2) "55"
+string(2) "56"
+string(2) "57"
+string(2) "58"
+string(2) "59"
+string(2) "60"
+string(2) "61"
+string(2) "62"
+string(2) "63"
+string(2) "64"
+string(2) "65"
+string(2) "66"
+string(2) "67"
+string(2) "68"
+string(2) "69"
+string(2) "70"
+string(2) "71"
+string(2) "72"
+string(2) "73"
+string(2) "74"
+string(2) "75"
+string(2) "76"
+string(2) "77"
+string(2) "78"
+string(2) "79"
+string(2) "80"
+string(2) "81"
+string(2) "82"
+string(2) "83"
+string(2) "84"
+string(2) "85"
+string(2) "86"
+string(2) "87"
+string(2) "88"
+string(2) "89"
+string(2) "90"
+string(2) "91"
+string(2) "92"
+string(2) "93"
+string(2) "94"
+string(2) "95"
+string(2) "96"
+string(2) "97"
+string(2) "98"
+string(2) "99"
+string(3) "100"
+string(3) "101"
+string(3) "102"
+string(3) "103"
+string(3) "104"
+string(3) "105"
+string(3) "106"
+string(3) "107"
+string(3) "108"
+string(3) "109"
+string(3) "110"
+string(3) "111"
+string(3) "112"
+string(3) "113"
+string(3) "114"
+string(3) "115"
+string(3) "116"
+string(3) "117"
+string(3) "118"
+string(3) "119"
+string(3) "120"
+string(3) "121"
+string(3) "122"
+string(3) "123"
+string(3) "124"
+string(3) "125"
+string(3) "126"
+string(3) "127"
+string(3) "128"
+string(3) "129"
+string(3) "130"
+string(3) "131"
+string(3) "132"
+string(3) "133"
+string(3) "134"
+string(3) "135"
+string(3) "136"
+string(3) "137"
+string(3) "138"
+string(3) "139"
+string(3) "140"
+string(3) "141"
+string(3) "142"
+string(3) "143"
+string(3) "144"
+string(3) "145"
+string(3) "146"
+string(3) "147"
+string(3) "148"
+string(3) "149"
+string(3) "150"
+string(3) "151"
+string(3) "152"
+string(3) "153"
+string(3) "154"
+string(3) "155"
+string(3) "156"
+string(3) "157"
+string(3) "158"
+string(3) "159"
+string(3) "160"
+string(3) "161"
+string(3) "162"
+string(3) "163"
+string(3) "164"
+string(3) "165"
+string(3) "166"
+string(3) "167"
+string(3) "168"
+string(3) "169"
+string(3) "170"
+string(3) "171"
+string(3) "172"
+string(3) "173"
+string(3) "174"
+string(3) "175"
+string(3) "176"
+string(3) "177"
+string(3) "178"
+string(3) "179"
+string(3) "180"
+string(3) "181"
+string(3) "182"
+string(3) "183"
+string(3) "184"
+string(3) "185"
+string(3) "186"
+string(3) "187"
+string(3) "188"
+string(3) "189"
+string(3) "190"
+string(3) "191"
+string(3) "192"
+string(3) "193"
+string(3) "194"
+string(3) "195"
+string(3) "196"
+string(3) "197"
+string(3) "198"
+string(3) "199"
+Done
diff --git a/ext/oci8/tests/bug27303_2.phpt b/ext/oci8/tests/bug27303_2.phpt
new file mode 100644
index 0000000000..39c7c1099a
--- /dev/null
+++ b/ext/oci8/tests/bug27303_2.phpt
@@ -0,0 +1,257 @@
+--TEST--
+bug #27303 (OCIBindByName binds numeric PHP values as characters)
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--ENV--
+return "
+ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
+NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
+";
+--FILE--
+<?php
+
+require dirname(__FILE__).'/connect.inc';
+
+$create_st = array();
+$create_st[] = "drop sequence myseq";
+$create_st[] = "drop table mytab";
+$create_st[] = "create sequence myseq";
+$create_st[] = "create table mytab (mydata varchar2(20), seqcol number)";
+
+foreach ($create_st as $statement) {
+ $stmt = oci_parse($c, $statement);
+ oci_execute($stmt);
+}
+
+define('MYLIMIT', 200);
+define('INITMYBV', 11);
+
+$stmt = "insert into mytab (mydata, seqcol) values ('Some data', myseq.nextval) returning seqcol into :mybv";
+
+$stid = OCIParse($c, $stmt);
+if (!$stid) { echo "Parse error"; die; }
+
+$mybv = INITMYBV; // Uncomment this for the 2nd test only
+$r = OCIBindByName($stid, ':MYBV', $mybv /*, 5 */); // Uncomment this for the 3rd test only
+if (!$r) { echo "Bind error"; die; }
+
+for ($i = 1; $i < MYLIMIT; $i++) {
+ $r = OCIExecute($stid, OCI_DEFAULT);
+ if (!$r) { echo "Execute error"; die; }
+ var_dump($mybv);
+}
+
+OCICommit($c);
+
+$drop_st = array();
+$drop_st[] = "drop sequence myseq";
+$drop_st[] = "drop table mytab";
+
+foreach ($create_st as $statement) {
+ $stmt = oci_parse($c, $statement);
+ oci_execute($stmt);
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+string(1) "1"
+string(1) "2"
+string(1) "3"
+string(1) "4"
+string(1) "5"
+string(1) "6"
+string(1) "7"
+string(1) "8"
+string(1) "9"
+string(2) "10"
+string(2) "11"
+string(2) "12"
+string(2) "13"
+string(2) "14"
+string(2) "15"
+string(2) "16"
+string(2) "17"
+string(2) "18"
+string(2) "19"
+string(2) "20"
+string(2) "21"
+string(2) "22"
+string(2) "23"
+string(2) "24"
+string(2) "25"
+string(2) "26"
+string(2) "27"
+string(2) "28"
+string(2) "29"
+string(2) "30"
+string(2) "31"
+string(2) "32"
+string(2) "33"
+string(2) "34"
+string(2) "35"
+string(2) "36"
+string(2) "37"
+string(2) "38"
+string(2) "39"
+string(2) "40"
+string(2) "41"
+string(2) "42"
+string(2) "43"
+string(2) "44"
+string(2) "45"
+string(2) "46"
+string(2) "47"
+string(2) "48"
+string(2) "49"
+string(2) "50"
+string(2) "51"
+string(2) "52"
+string(2) "53"
+string(2) "54"
+string(2) "55"
+string(2) "56"
+string(2) "57"
+string(2) "58"
+string(2) "59"
+string(2) "60"
+string(2) "61"
+string(2) "62"
+string(2) "63"
+string(2) "64"
+string(2) "65"
+string(2) "66"
+string(2) "67"
+string(2) "68"
+string(2) "69"
+string(2) "70"
+string(2) "71"
+string(2) "72"
+string(2) "73"
+string(2) "74"
+string(2) "75"
+string(2) "76"
+string(2) "77"
+string(2) "78"
+string(2) "79"
+string(2) "80"
+string(2) "81"
+string(2) "82"
+string(2) "83"
+string(2) "84"
+string(2) "85"
+string(2) "86"
+string(2) "87"
+string(2) "88"
+string(2) "89"
+string(2) "90"
+string(2) "91"
+string(2) "92"
+string(2) "93"
+string(2) "94"
+string(2) "95"
+string(2) "96"
+string(2) "97"
+string(2) "98"
+string(2) "99"
+string(3) "100"
+string(3) "101"
+string(3) "102"
+string(3) "103"
+string(3) "104"
+string(3) "105"
+string(3) "106"
+string(3) "107"
+string(3) "108"
+string(3) "109"
+string(3) "110"
+string(3) "111"
+string(3) "112"
+string(3) "113"
+string(3) "114"
+string(3) "115"
+string(3) "116"
+string(3) "117"
+string(3) "118"
+string(3) "119"
+string(3) "120"
+string(3) "121"
+string(3) "122"
+string(3) "123"
+string(3) "124"
+string(3) "125"
+string(3) "126"
+string(3) "127"
+string(3) "128"
+string(3) "129"
+string(3) "130"
+string(3) "131"
+string(3) "132"
+string(3) "133"
+string(3) "134"
+string(3) "135"
+string(3) "136"
+string(3) "137"
+string(3) "138"
+string(3) "139"
+string(3) "140"
+string(3) "141"
+string(3) "142"
+string(3) "143"
+string(3) "144"
+string(3) "145"
+string(3) "146"
+string(3) "147"
+string(3) "148"
+string(3) "149"
+string(3) "150"
+string(3) "151"
+string(3) "152"
+string(3) "153"
+string(3) "154"
+string(3) "155"
+string(3) "156"
+string(3) "157"
+string(3) "158"
+string(3) "159"
+string(3) "160"
+string(3) "161"
+string(3) "162"
+string(3) "163"
+string(3) "164"
+string(3) "165"
+string(3) "166"
+string(3) "167"
+string(3) "168"
+string(3) "169"
+string(3) "170"
+string(3) "171"
+string(3) "172"
+string(3) "173"
+string(3) "174"
+string(3) "175"
+string(3) "176"
+string(3) "177"
+string(3) "178"
+string(3) "179"
+string(3) "180"
+string(3) "181"
+string(3) "182"
+string(3) "183"
+string(3) "184"
+string(3) "185"
+string(3) "186"
+string(3) "187"
+string(3) "188"
+string(3) "189"
+string(3) "190"
+string(3) "191"
+string(3) "192"
+string(3) "193"
+string(3) "194"
+string(3) "195"
+string(3) "196"
+string(3) "197"
+string(3) "198"
+string(3) "199"
+Done
diff --git a/ext/oci8/tests/bug27303_3.phpt b/ext/oci8/tests/bug27303_3.phpt
new file mode 100644
index 0000000000..137f907076
--- /dev/null
+++ b/ext/oci8/tests/bug27303_3.phpt
@@ -0,0 +1,257 @@
+--TEST--
+bug #27303 (OCIBindByName binds numeric PHP values as characters)
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--ENV--
+return "
+ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
+NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
+";
+--FILE--
+<?php
+
+require dirname(__FILE__).'/connect.inc';
+
+$create_st = array();
+$create_st[] = "drop sequence myseq";
+$create_st[] = "drop table mytab";
+$create_st[] = "create sequence myseq";
+$create_st[] = "create table mytab (mydata varchar2(20), seqcol number)";
+
+foreach ($create_st as $statement) {
+ $stmt = oci_parse($c, $statement);
+ oci_execute($stmt);
+}
+
+define('MYLIMIT', 200);
+define('INITMYBV', 11);
+
+$stmt = "insert into mytab (mydata, seqcol) values ('Some data', myseq.nextval) returning seqcol into :mybv";
+
+$stid = OCIParse($c, $stmt);
+if (!$stid) { echo "Parse error"; die; }
+
+$mybv = INITMYBV; // Uncomment this for the 2nd test only
+$r = OCIBindByName($stid, ':MYBV', $mybv, 5, SQLT_INT); // Uncomment this for the 3rd test only
+if (!$r) { echo "Bind error"; die; }
+
+for ($i = 1; $i < MYLIMIT; $i++) {
+ $r = OCIExecute($stid, OCI_DEFAULT);
+ if (!$r) { echo "Execute error"; die; }
+ var_dump($mybv);
+}
+
+OCICommit($c);
+
+$drop_st = array();
+$drop_st[] = "drop sequence myseq";
+$drop_st[] = "drop table mytab";
+
+foreach ($create_st as $statement) {
+ $stmt = oci_parse($c, $statement);
+ oci_execute($stmt);
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+int(1)
+int(2)
+int(3)
+int(4)
+int(5)
+int(6)
+int(7)
+int(8)
+int(9)
+int(10)
+int(11)
+int(12)
+int(13)
+int(14)
+int(15)
+int(16)
+int(17)
+int(18)
+int(19)
+int(20)
+int(21)
+int(22)
+int(23)
+int(24)
+int(25)
+int(26)
+int(27)
+int(28)
+int(29)
+int(30)
+int(31)
+int(32)
+int(33)
+int(34)
+int(35)
+int(36)
+int(37)
+int(38)
+int(39)
+int(40)
+int(41)
+int(42)
+int(43)
+int(44)
+int(45)
+int(46)
+int(47)
+int(48)
+int(49)
+int(50)
+int(51)
+int(52)
+int(53)
+int(54)
+int(55)
+int(56)
+int(57)
+int(58)
+int(59)
+int(60)
+int(61)
+int(62)
+int(63)
+int(64)
+int(65)
+int(66)
+int(67)
+int(68)
+int(69)
+int(70)
+int(71)
+int(72)
+int(73)
+int(74)
+int(75)
+int(76)
+int(77)
+int(78)
+int(79)
+int(80)
+int(81)
+int(82)
+int(83)
+int(84)
+int(85)
+int(86)
+int(87)
+int(88)
+int(89)
+int(90)
+int(91)
+int(92)
+int(93)
+int(94)
+int(95)
+int(96)
+int(97)
+int(98)
+int(99)
+int(100)
+int(101)
+int(102)
+int(103)
+int(104)
+int(105)
+int(106)
+int(107)
+int(108)
+int(109)
+int(110)
+int(111)
+int(112)
+int(113)
+int(114)
+int(115)
+int(116)
+int(117)
+int(118)
+int(119)
+int(120)
+int(121)
+int(122)
+int(123)
+int(124)
+int(125)
+int(126)
+int(127)
+int(128)
+int(129)
+int(130)
+int(131)
+int(132)
+int(133)
+int(134)
+int(135)
+int(136)
+int(137)
+int(138)
+int(139)
+int(140)
+int(141)
+int(142)
+int(143)
+int(144)
+int(145)
+int(146)
+int(147)
+int(148)
+int(149)
+int(150)
+int(151)
+int(152)
+int(153)
+int(154)
+int(155)
+int(156)
+int(157)
+int(158)
+int(159)
+int(160)
+int(161)
+int(162)
+int(163)
+int(164)
+int(165)
+int(166)
+int(167)
+int(168)
+int(169)
+int(170)
+int(171)
+int(172)
+int(173)
+int(174)
+int(175)
+int(176)
+int(177)
+int(178)
+int(179)
+int(180)
+int(181)
+int(182)
+int(183)
+int(184)
+int(185)
+int(186)
+int(187)
+int(188)
+int(189)
+int(190)
+int(191)
+int(192)
+int(193)
+int(194)
+int(195)
+int(196)
+int(197)
+int(198)
+int(199)
+Done
diff --git a/ext/oci8/tests/bug27303_4.phpt b/ext/oci8/tests/bug27303_4.phpt
new file mode 100644
index 0000000000..70b8d8f36c
--- /dev/null
+++ b/ext/oci8/tests/bug27303_4.phpt
@@ -0,0 +1,257 @@
+--TEST--
+bug #27303 (OCIBindByName binds numeric PHP values as characters)
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--ENV--
+return "
+ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
+NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
+";
+--FILE--
+<?php
+
+require dirname(__FILE__).'/connect.inc';
+
+$create_st = array();
+$create_st[] = "drop sequence myseq";
+$create_st[] = "drop table mytab";
+$create_st[] = "create sequence myseq";
+$create_st[] = "create table mytab (mydata varchar2(20), seqcol number)";
+
+foreach ($create_st as $statement) {
+ $stmt = oci_parse($c, $statement);
+ oci_execute($stmt);
+}
+
+define('MYLIMIT', 200);
+define('INITMYBV', 11);
+
+$stmt = "insert into mytab (mydata, seqcol) values ('Some data', myseq.nextval) returning seqcol into :mybv";
+
+$stid = OCIParse($c, $stmt);
+if (!$stid) { echo "Parse error"; die; }
+
+//$mybv = INITMYBV; // Uncomment this for the 2nd test only
+$r = OCIBindByName($stid, ':MYBV', $mybv, 0 ); // Uncomment this for the 3rd test only
+if (!$r) { echo "Bind error"; die; }
+
+for ($i = 1; $i < MYLIMIT; $i++) {
+ $r = OCIExecute($stid, OCI_DEFAULT);
+ if (!$r) { echo "Execute error"; die; }
+ var_dump($mybv);
+}
+
+OCICommit($c);
+
+$drop_st = array();
+$drop_st[] = "drop sequence myseq";
+$drop_st[] = "drop table mytab";
+
+foreach ($create_st as $statement) {
+ $stmt = oci_parse($c, $statement);
+ oci_execute($stmt);
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+string(1) "1"
+string(1) "2"
+string(1) "3"
+string(1) "4"
+string(1) "5"
+string(1) "6"
+string(1) "7"
+string(1) "8"
+string(1) "9"
+string(2) "10"
+string(2) "11"
+string(2) "12"
+string(2) "13"
+string(2) "14"
+string(2) "15"
+string(2) "16"
+string(2) "17"
+string(2) "18"
+string(2) "19"
+string(2) "20"
+string(2) "21"
+string(2) "22"
+string(2) "23"
+string(2) "24"
+string(2) "25"
+string(2) "26"
+string(2) "27"
+string(2) "28"
+string(2) "29"
+string(2) "30"
+string(2) "31"
+string(2) "32"
+string(2) "33"
+string(2) "34"
+string(2) "35"
+string(2) "36"
+string(2) "37"
+string(2) "38"
+string(2) "39"
+string(2) "40"
+string(2) "41"
+string(2) "42"
+string(2) "43"
+string(2) "44"
+string(2) "45"
+string(2) "46"
+string(2) "47"
+string(2) "48"
+string(2) "49"
+string(2) "50"
+string(2) "51"
+string(2) "52"
+string(2) "53"
+string(2) "54"
+string(2) "55"
+string(2) "56"
+string(2) "57"
+string(2) "58"
+string(2) "59"
+string(2) "60"
+string(2) "61"
+string(2) "62"
+string(2) "63"
+string(2) "64"
+string(2) "65"
+string(2) "66"
+string(2) "67"
+string(2) "68"
+string(2) "69"
+string(2) "70"
+string(2) "71"
+string(2) "72"
+string(2) "73"
+string(2) "74"
+string(2) "75"
+string(2) "76"
+string(2) "77"
+string(2) "78"
+string(2) "79"
+string(2) "80"
+string(2) "81"
+string(2) "82"
+string(2) "83"
+string(2) "84"
+string(2) "85"
+string(2) "86"
+string(2) "87"
+string(2) "88"
+string(2) "89"
+string(2) "90"
+string(2) "91"
+string(2) "92"
+string(2) "93"
+string(2) "94"
+string(2) "95"
+string(2) "96"
+string(2) "97"
+string(2) "98"
+string(2) "99"
+string(3) "100"
+string(3) "101"
+string(3) "102"
+string(3) "103"
+string(3) "104"
+string(3) "105"
+string(3) "106"
+string(3) "107"
+string(3) "108"
+string(3) "109"
+string(3) "110"
+string(3) "111"
+string(3) "112"
+string(3) "113"
+string(3) "114"
+string(3) "115"
+string(3) "116"
+string(3) "117"
+string(3) "118"
+string(3) "119"
+string(3) "120"
+string(3) "121"
+string(3) "122"
+string(3) "123"
+string(3) "124"
+string(3) "125"
+string(3) "126"
+string(3) "127"
+string(3) "128"
+string(3) "129"
+string(3) "130"
+string(3) "131"
+string(3) "132"
+string(3) "133"
+string(3) "134"
+string(3) "135"
+string(3) "136"
+string(3) "137"
+string(3) "138"
+string(3) "139"
+string(3) "140"
+string(3) "141"
+string(3) "142"
+string(3) "143"
+string(3) "144"
+string(3) "145"
+string(3) "146"
+string(3) "147"
+string(3) "148"
+string(3) "149"
+string(3) "150"
+string(3) "151"
+string(3) "152"
+string(3) "153"
+string(3) "154"
+string(3) "155"
+string(3) "156"
+string(3) "157"
+string(3) "158"
+string(3) "159"
+string(3) "160"
+string(3) "161"
+string(3) "162"
+string(3) "163"
+string(3) "164"
+string(3) "165"
+string(3) "166"
+string(3) "167"
+string(3) "168"
+string(3) "169"
+string(3) "170"
+string(3) "171"
+string(3) "172"
+string(3) "173"
+string(3) "174"
+string(3) "175"
+string(3) "176"
+string(3) "177"
+string(3) "178"
+string(3) "179"
+string(3) "180"
+string(3) "181"
+string(3) "182"
+string(3) "183"
+string(3) "184"
+string(3) "185"
+string(3) "186"
+string(3) "187"
+string(3) "188"
+string(3) "189"
+string(3) "190"
+string(3) "191"
+string(3) "192"
+string(3) "193"
+string(3) "194"
+string(3) "195"
+string(3) "196"
+string(3) "197"
+string(3) "198"
+string(3) "199"
+Done
diff --git a/ext/oci8/tests/bug32325.phpt b/ext/oci8/tests/bug32325.phpt
new file mode 100644
index 0000000000..1b5dd0d24d
--- /dev/null
+++ b/ext/oci8/tests/bug32325.phpt
@@ -0,0 +1,44 @@
+--TEST--
+bug #32325 (Can't retrieve collection using OCI8)
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--ENV--
+return "
+ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
+NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
+";
+--FILE--
+<?php
+
+require dirname(__FILE__).'/connect.inc';
+require dirname(__FILE__).'/create_table.inc';
+
+$create_stmt = oci_parse($c, "create or replace type ut_num_list_t as table of number");
+oci_execute($create_stmt);
+
+$collection = oci_new_collection($c, "UT_NUM_LIST_T");
+
+$sql = "
+ begin
+ select ut_num_list_t(1,2,3,4) into :list from dual;
+ end;";
+
+$stmt = oci_parse($c, $sql);
+
+oci_bind_by_name($stmt, ":list", $collection, -1, OCI_B_NTY);
+oci_execute($stmt);
+
+var_dump($collection->size());
+var_dump($collection->getelem(1));
+var_dump($collection->getelem(2));
+
+$drop_stmt = oci_parse($c, "drop type ut_num_list_t");
+oci_execute($drop_stmt);
+
+echo "Done\n";
+?>
+--EXPECTF--
+int(4)
+float(2)
+float(3)
+Done
diff --git a/ext/oci8/tests/close.phpt b/ext/oci8/tests/close.phpt
new file mode 100644
index 0000000000..08bac05ba5
--- /dev/null
+++ b/ext/oci8/tests/close.phpt
@@ -0,0 +1,22 @@
+--TEST--
+connect/close/connect
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--ENV--
+return "
+ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
+NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
+";
+--FILE--
+<?php
+
+require dirname(__FILE__).'/connect.inc';
+
+oci_close($c);
+
+oci_connect($user, $password, $dbase);
+
+echo "Done\n";
+?>
+--EXPECTF--
+Done
diff --git a/ext/oci8/tests/coll_001.phpt b/ext/oci8/tests/coll_001.phpt
new file mode 100644
index 0000000000..8a223f864b
--- /dev/null
+++ b/ext/oci8/tests/coll_001.phpt
@@ -0,0 +1,33 @@
+--TEST--
+oci_new_collection()
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--ENV--
+return "
+ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
+NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
+TNS_ADMIN=".(isset($_ENV['TNS_ADMIN']) ? $_ENV['TNS_ADMIN'] : '')."
+";
+--FILE--
+<?php
+
+require dirname(__FILE__)."/connect.inc";
+require dirname(__FILE__)."/create_type.inc";
+
+var_dump(oci_new_collection($c, $type_name));
+var_dump(oci_new_collection($c, "NONEXISTENT"));
+
+echo "Done\n";
+
+require dirname(__FILE__)."/drop_type.inc";
+
+?>
+--EXPECTF--
+object(OCI-Collection)#%d (1) {
+ ["collection"]=>
+ resource(%d) of type (oci8 collection)
+}
+
+Warning: oci_new_collection(): OCI-22303: type ""."NONEXISTENT" not found in %s on line %d
+bool(false)
+Done
diff --git a/ext/oci8/tests/coll_002.phpt b/ext/oci8/tests/coll_002.phpt
new file mode 100644
index 0000000000..39f0dbf065
--- /dev/null
+++ b/ext/oci8/tests/coll_002.phpt
@@ -0,0 +1,36 @@
+--TEST--
+oci_new_collection() + free()
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--ENV--
+return "
+ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
+NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
+TNS_ADMIN=".(isset($_ENV['TNS_ADMIN']) ? $_ENV['TNS_ADMIN'] : '')."
+";
+--FILE--
+<?php
+
+require dirname(__FILE__)."/connect.inc";
+require dirname(__FILE__)."/create_type.inc";
+
+var_dump($coll1 = oci_new_collection($c, $type_name));
+
+var_dump($coll1->free());
+var_dump($coll1->size());
+
+echo "Done\n";
+
+require dirname(__FILE__)."/drop_type.inc";
+
+?>
+--EXPECTF--
+object(OCI-Collection)#%d (1) {
+ ["collection"]=>
+ resource(%d) of type (oci8 collection)
+}
+bool(true)
+
+Warning: OCI-Collection::size(): %d is not a valid oci8 collection resource in %s on line %d
+bool(false)
+Done
diff --git a/ext/oci8/tests/coll_002_func.phpt b/ext/oci8/tests/coll_002_func.phpt
new file mode 100644
index 0000000000..4a7cb209c3
--- /dev/null
+++ b/ext/oci8/tests/coll_002_func.phpt
@@ -0,0 +1,36 @@
+--TEST--
+oci_new_collection() + free()
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--ENV--
+return "
+ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
+NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
+TNS_ADMIN=".(isset($_ENV['TNS_ADMIN']) ? $_ENV['TNS_ADMIN'] : '')."
+";
+--FILE--
+<?php
+
+require dirname(__FILE__)."/connect.inc";
+require dirname(__FILE__)."/create_type.inc";
+
+var_dump($coll1 = oci_new_collection($c, $type_name));
+
+var_dump(oci_free_collection($coll1));
+var_dump(oci_collection_size($coll1));
+
+echo "Done\n";
+
+require dirname(__FILE__)."/drop_type.inc";
+
+?>
+--EXPECTF--
+object(OCI-Collection)#%d (1) {
+ ["collection"]=>
+ resource(%d) of type (oci8 collection)
+}
+bool(true)
+
+Warning: oci_collection_size(): %d is not a valid oci8 collection resource in %s on line %d
+bool(false)
+Done
diff --git a/ext/oci8/tests/coll_003.phpt b/ext/oci8/tests/coll_003.phpt
new file mode 100644
index 0000000000..a47816ad2c
--- /dev/null
+++ b/ext/oci8/tests/coll_003.phpt
@@ -0,0 +1,40 @@
+--TEST--
+collection methods
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--ENV--
+return "
+ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
+NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
+TNS_ADMIN=".(isset($_ENV['TNS_ADMIN']) ? $_ENV['TNS_ADMIN'] : '')."
+";
+--FILE--
+<?php
+
+require dirname(__FILE__)."/connect.inc";
+require dirname(__FILE__)."/create_type.inc";
+
+$coll1 = oci_new_collection($c, $type_name);
+
+var_dump($coll1->size());
+var_dump($coll1->max());
+var_dump($coll1->trim(3));
+var_dump($coll1->append(1));
+var_dump($coll1->getElem(0));
+var_dump($coll1->assignElem(0,2));
+
+echo "Done\n";
+
+require dirname(__FILE__)."/drop_type.inc";
+
+?>
+--EXPECTF--
+int(0)
+int(0)
+
+Warning: OCI-Collection::trim(): OCI-22167: given trim size [3] must be less than or equal to [0] in %s on line %d
+bool(false)
+bool(true)
+float(1)
+bool(true)
+Done
diff --git a/ext/oci8/tests/coll_003_func.phpt b/ext/oci8/tests/coll_003_func.phpt
new file mode 100644
index 0000000000..2057b6361a
--- /dev/null
+++ b/ext/oci8/tests/coll_003_func.phpt
@@ -0,0 +1,40 @@
+--TEST--
+collection methods
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--ENV--
+return "
+ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
+NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
+TNS_ADMIN=".(isset($_ENV['TNS_ADMIN']) ? $_ENV['TNS_ADMIN'] : '')."
+";
+--FILE--
+<?php
+
+require dirname(__FILE__)."/connect.inc";
+require dirname(__FILE__)."/create_type.inc";
+
+$coll1 = oci_new_collection($c, $type_name);
+
+var_dump(oci_collection_size($coll1));
+var_dump(oci_collection_max($coll1));
+var_dump(oci_collection_trim($coll1, 3));
+var_dump(oci_collection_append($coll1, 1));
+var_dump(oci_collection_element_get($coll1, 0));
+var_dump(oci_collection_element_assign($coll1, 0, 2));
+
+echo "Done\n";
+
+require dirname(__FILE__)."/drop_type.inc";
+
+?>
+--EXPECTF--
+int(0)
+int(0)
+
+Warning: oci_collection_trim(): OCI-22167: given trim size [3] must be less than or equal to [0] in %s on line %d
+bool(false)
+bool(true)
+float(1)
+bool(true)
+Done
diff --git a/ext/oci8/tests/coll_004.phpt b/ext/oci8/tests/coll_004.phpt
new file mode 100644
index 0000000000..4af6d1d907
--- /dev/null
+++ b/ext/oci8/tests/coll_004.phpt
@@ -0,0 +1,35 @@
+--TEST--
+oci_collection_assign()
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--ENV--
+return "
+ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
+NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
+TNS_ADMIN=".(isset($_ENV['TNS_ADMIN']) ? $_ENV['TNS_ADMIN'] : '')."
+";
+--FILE--
+<?php
+
+require dirname(__FILE__)."/connect.inc";
+require dirname(__FILE__)."/create_type.inc";
+
+$coll1 = oci_new_collection($c, $type_name);
+$coll2 = oci_new_collection($c, $type_name);
+
+var_dump($coll1->append(1));
+
+var_dump($coll2->assign($coll1));
+
+var_dump($coll2->getElem(0));
+
+echo "Done\n";
+
+require dirname(__FILE__)."/drop_type.inc";
+
+?>
+--EXPECT--
+bool(true)
+bool(true)
+float(1)
+Done
diff --git a/ext/oci8/tests/coll_004_func.phpt b/ext/oci8/tests/coll_004_func.phpt
new file mode 100644
index 0000000000..9d7f5f6cd9
--- /dev/null
+++ b/ext/oci8/tests/coll_004_func.phpt
@@ -0,0 +1,35 @@
+--TEST--
+oci_collection_assign()
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--ENV--
+return "
+ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
+NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
+TNS_ADMIN=".(isset($_ENV['TNS_ADMIN']) ? $_ENV['TNS_ADMIN'] : '')."
+";
+--FILE--
+<?php
+
+require dirname(__FILE__)."/connect.inc";
+require dirname(__FILE__)."/create_type.inc";
+
+$coll1 = oci_new_collection($c, $type_name);
+$coll2 = oci_new_collection($c, $type_name);
+
+var_dump(oci_collection_append($coll1, 1));
+
+var_dump(oci_collection_assign($coll2, $coll1));
+
+var_dump(oci_collection_element_get($coll2, 0));
+
+echo "Done\n";
+
+require dirname(__FILE__)."/drop_type.inc";
+
+?>
+--EXPECT--
+bool(true)
+bool(true)
+float(1)
+Done
diff --git a/ext/oci8/tests/coll_005.phpt b/ext/oci8/tests/coll_005.phpt
new file mode 100644
index 0000000000..d43c856cc7
--- /dev/null
+++ b/ext/oci8/tests/coll_005.phpt
@@ -0,0 +1,33 @@
+--TEST--
+ocinewcollection()
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--ENV--
+return "
+ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
+NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
+TNS_ADMIN=".(isset($_ENV['TNS_ADMIN']) ? $_ENV['TNS_ADMIN'] : '')."
+";
+--FILE--
+<?php
+
+require dirname(__FILE__)."/connect.inc";
+require dirname(__FILE__)."/create_type.inc";
+
+var_dump(ocinewcollection($c, $type_name));
+var_dump(ocinewcollection($c, "NONEXISTENT"));
+
+echo "Done\n";
+
+require dirname(__FILE__)."/drop_type.inc";
+
+?>
+--EXPECTF--
+object(OCI-Collection)#%d (1) {
+ ["collection"]=>
+ resource(%d) of type (oci8 collection)
+}
+
+Warning: ocinewcollection(): OCI-22303: type ""."NONEXISTENT" not found in %s on line %d
+bool(false)
+Done
diff --git a/ext/oci8/tests/coll_006.phpt b/ext/oci8/tests/coll_006.phpt
new file mode 100644
index 0000000000..a1039987f9
--- /dev/null
+++ b/ext/oci8/tests/coll_006.phpt
@@ -0,0 +1,36 @@
+--TEST--
+ocinewcollection() + free()
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--ENV--
+return "
+ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
+NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
+TNS_ADMIN=".(isset($_ENV['TNS_ADMIN']) ? $_ENV['TNS_ADMIN'] : '')."
+";
+--FILE--
+<?php
+
+require dirname(__FILE__)."/connect.inc";
+require dirname(__FILE__)."/create_type.inc";
+
+var_dump($coll1 = ocinewcollection($c, $type_name));
+
+var_dump($coll1->free());
+var_dump($coll1->size());
+
+echo "Done\n";
+
+require dirname(__FILE__)."/drop_type.inc";
+
+?>
+--EXPECTF--
+object(OCI-Collection)#%d (1) {
+ ["collection"]=>
+ resource(%d) of type (oci8 collection)
+}
+bool(true)
+
+Warning: OCI-Collection::size(): %d is not a valid oci8 collection resource in %s on line %d
+bool(false)
+Done
diff --git a/ext/oci8/tests/coll_006_func.phpt b/ext/oci8/tests/coll_006_func.phpt
new file mode 100644
index 0000000000..f43c142c40
--- /dev/null
+++ b/ext/oci8/tests/coll_006_func.phpt
@@ -0,0 +1,36 @@
+--TEST--
+ocinewcollection() + free()
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--ENV--
+return "
+ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
+NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
+TNS_ADMIN=".(isset($_ENV['TNS_ADMIN']) ? $_ENV['TNS_ADMIN'] : '')."
+";
+--FILE--
+<?php
+
+require dirname(__FILE__)."/connect.inc";
+require dirname(__FILE__)."/create_type.inc";
+
+var_dump($coll1 = ocinewcollection($c, $type_name));
+
+var_dump(oci_free_collection($coll1));
+var_dump(oci_collection_size($coll1));
+
+echo "Done\n";
+
+require dirname(__FILE__)."/drop_type.inc";
+
+?>
+--EXPECTF--
+object(OCI-Collection)#%d (1) {
+ ["collection"]=>
+ resource(%d) of type (oci8 collection)
+}
+bool(true)
+
+Warning: oci_collection_size(): %d is not a valid oci8 collection resource in %s on line %d
+bool(false)
+Done
diff --git a/ext/oci8/tests/coll_007.phpt b/ext/oci8/tests/coll_007.phpt
new file mode 100644
index 0000000000..256ce0bfa7
--- /dev/null
+++ b/ext/oci8/tests/coll_007.phpt
@@ -0,0 +1,40 @@
+--TEST--
+collection methods
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--ENV--
+return "
+ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
+NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
+TNS_ADMIN=".(isset($_ENV['TNS_ADMIN']) ? $_ENV['TNS_ADMIN'] : '')."
+";
+--FILE--
+<?php
+
+require dirname(__FILE__)."/connect.inc";
+require dirname(__FILE__)."/create_type.inc";
+
+$coll1 = ocinewcollection($c, $type_name);
+
+var_dump($coll1->size());
+var_dump($coll1->max());
+var_dump($coll1->trim(3));
+var_dump($coll1->append(1));
+var_dump($coll1->getElem(0));
+var_dump($coll1->assignElem(0,2));
+
+echo "Done\n";
+
+require dirname(__FILE__)."/drop_type.inc";
+
+?>
+--EXPECTF--
+int(0)
+int(0)
+
+Warning: OCI-Collection::trim(): OCI-22167: given trim size [3] must be less than or equal to [0] in %s on line %d
+bool(false)
+bool(true)
+float(1)
+bool(true)
+Done
diff --git a/ext/oci8/tests/coll_008.phpt b/ext/oci8/tests/coll_008.phpt
new file mode 100644
index 0000000000..36e052b7ed
--- /dev/null
+++ b/ext/oci8/tests/coll_008.phpt
@@ -0,0 +1,35 @@
+--TEST--
+ocicollassign()
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--ENV--
+return "
+ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
+NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
+TNS_ADMIN=".(isset($_ENV['TNS_ADMIN']) ? $_ENV['TNS_ADMIN'] : '')."
+";
+--FILE--
+<?php
+
+require dirname(__FILE__)."/connect.inc";
+require dirname(__FILE__)."/create_type.inc";
+
+$coll1 = ocinewcollection($c, $type_name);
+$coll2 = ocinewcollection($c, $type_name);
+
+var_dump($coll1->append(1));
+
+var_dump($coll2->assign($coll1));
+
+var_dump($coll2->getElem(0));
+
+echo "Done\n";
+
+require dirname(__FILE__)."/drop_type.inc";
+
+?>
+--EXPECT--
+bool(true)
+bool(true)
+float(1)
+Done
diff --git a/ext/oci8/tests/coll_009.phpt b/ext/oci8/tests/coll_009.phpt
new file mode 100644
index 0000000000..1910af9efb
--- /dev/null
+++ b/ext/oci8/tests/coll_009.phpt
@@ -0,0 +1,48 @@
+--TEST--
+collections and wrong dates
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--ENV--
+return "
+ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
+NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
+TNS_ADMIN=".(isset($_ENV['TNS_ADMIN']) ? $_ENV['TNS_ADMIN'] : '')."
+";
+--FILE--
+<?php
+
+require dirname(__FILE__)."/connect.inc";
+
+$ora_sql = "DROP TYPE
+ ".$type_name."
+ ";
+
+$statement = OCIParse($c,$ora_sql);
+@OCIExecute($statement);
+
+$ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF DATE";
+
+$statement = OCIParse($c,$ora_sql);
+OCIExecute($statement);
+
+
+$coll1 = ocinewcollection($c, $type_name);
+$coll2 = ocinewcollection($c, $type_name);
+
+var_dump($coll1->append("2005-07-28"));
+
+var_dump($coll2->assign($coll1));
+
+var_dump($coll2->getElem(0));
+
+echo "Done\n";
+
+require dirname(__FILE__)."/drop_type.inc";
+
+?>
+--EXPECTF--
+Warning: OCI-Collection::append(): OCI-01861: literal does not match format string in %s on line %d
+bool(false)
+bool(true)
+bool(false)
+Done
diff --git a/ext/oci8/tests/coll_009_func.phpt b/ext/oci8/tests/coll_009_func.phpt
new file mode 100644
index 0000000000..d383abe4ad
--- /dev/null
+++ b/ext/oci8/tests/coll_009_func.phpt
@@ -0,0 +1,48 @@
+--TEST--
+collections and wrong dates
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--ENV--
+return "
+ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
+NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
+TNS_ADMIN=".(isset($_ENV['TNS_ADMIN']) ? $_ENV['TNS_ADMIN'] : '')."
+";
+--FILE--
+<?php
+
+require dirname(__FILE__)."/connect.inc";
+
+$ora_sql = "DROP TYPE
+ ".$type_name."
+ ";
+
+$statement = OCIParse($c,$ora_sql);
+@OCIExecute($statement);
+
+$ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF DATE";
+
+$statement = OCIParse($c,$ora_sql);
+OCIExecute($statement);
+
+
+$coll1 = ocinewcollection($c, $type_name);
+$coll2 = ocinewcollection($c, $type_name);
+
+var_dump(oci_collection_append($coll1, "2005-07-28"));
+
+var_dump(oci_collection_assign($coll2, $coll1));
+
+var_dump(oci_collection_element_get($coll2, 0));
+
+echo "Done\n";
+
+require dirname(__FILE__)."/drop_type.inc";
+
+?>
+--EXPECTF--
+Warning: oci_collection_append(): OCI-01861: literal does not match format string in %s on line %d
+bool(false)
+bool(true)
+bool(false)
+Done
diff --git a/ext/oci8/tests/coll_010.phpt b/ext/oci8/tests/coll_010.phpt
new file mode 100644
index 0000000000..b23096206e
--- /dev/null
+++ b/ext/oci8/tests/coll_010.phpt
@@ -0,0 +1,47 @@
+--TEST--
+collections and nulls
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--ENV--
+return "
+ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
+NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
+TNS_ADMIN=".(isset($_ENV['TNS_ADMIN']) ? $_ENV['TNS_ADMIN'] : '')."
+";
+--FILE--
+<?php
+
+require dirname(__FILE__)."/connect.inc";
+
+$ora_sql = "DROP TYPE
+ ".$type_name."
+ ";
+
+$statement = OCIParse($c,$ora_sql);
+@OCIExecute($statement);
+
+$ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF VARCHAR(10)";
+
+$statement = OCIParse($c,$ora_sql);
+OCIExecute($statement);
+
+
+$coll1 = ocinewcollection($c, $type_name);
+$coll2 = ocinewcollection($c, $type_name);
+
+var_dump($coll1->append(null));
+
+var_dump($coll2->assign($coll1));
+
+var_dump($coll2->getElem(0));
+
+echo "Done\n";
+
+require dirname(__FILE__)."/drop_type.inc";
+
+?>
+--EXPECT--
+bool(true)
+bool(true)
+NULL
+Done
diff --git a/ext/oci8/tests/coll_010_func.phpt b/ext/oci8/tests/coll_010_func.phpt
new file mode 100644
index 0000000000..dff980e013
--- /dev/null
+++ b/ext/oci8/tests/coll_010_func.phpt
@@ -0,0 +1,47 @@
+--TEST--
+collections and nulls
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--ENV--
+return "
+ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
+NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
+TNS_ADMIN=".(isset($_ENV['TNS_ADMIN']) ? $_ENV['TNS_ADMIN'] : '')."
+";
+--FILE--
+<?php
+
+require dirname(__FILE__)."/connect.inc";
+
+$ora_sql = "DROP TYPE
+ ".$type_name."
+ ";
+
+$statement = OCIParse($c,$ora_sql);
+@OCIExecute($statement);
+
+$ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF VARCHAR(10)";
+
+$statement = OCIParse($c,$ora_sql);
+OCIExecute($statement);
+
+
+$coll1 = ocinewcollection($c, $type_name);
+$coll2 = ocinewcollection($c, $type_name);
+
+var_dump(oci_collection_append($coll1, null));
+
+var_dump(oci_collection_assign($coll2, $coll1));
+
+var_dump(oci_collection_element_get($coll2, 0));
+
+echo "Done\n";
+
+require dirname(__FILE__)."/drop_type.inc";
+
+?>
+--EXPECT--
+bool(true)
+bool(true)
+NULL
+Done
diff --git a/ext/oci8/tests/coll_011.phpt b/ext/oci8/tests/coll_011.phpt
new file mode 100644
index 0000000000..448b7f9a6b
--- /dev/null
+++ b/ext/oci8/tests/coll_011.phpt
@@ -0,0 +1,49 @@
+--TEST--
+collections and strings
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--ENV--
+return "
+ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
+NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
+TNS_ADMIN=".(isset($_ENV['TNS_ADMIN']) ? $_ENV['TNS_ADMIN'] : '')."
+";
+--FILE--
+<?php
+
+require dirname(__FILE__)."/connect.inc";
+
+$ora_sql = "DROP TYPE
+ ".$type_name."
+ ";
+
+$statement = OCIParse($c,$ora_sql);
+@OCIExecute($statement);
+
+$ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF VARCHAR(10)";
+
+$statement = OCIParse($c,$ora_sql);
+OCIExecute($statement);
+
+
+$coll1 = ocinewcollection($c, $type_name);
+$coll2 = ocinewcollection($c, $type_name);
+
+var_dump($coll1->append("string"));
+var_dump($coll1->append("string"));
+
+var_dump($coll2->assign($coll1));
+
+var_dump($coll2->getElem(0));
+
+echo "Done\n";
+
+require dirname(__FILE__)."/drop_type.inc";
+
+?>
+--EXPECT--
+bool(true)
+bool(true)
+bool(true)
+string(6) "string"
+Done
diff --git a/ext/oci8/tests/coll_011_func.phpt b/ext/oci8/tests/coll_011_func.phpt
new file mode 100644
index 0000000000..3226d15b86
--- /dev/null
+++ b/ext/oci8/tests/coll_011_func.phpt
@@ -0,0 +1,49 @@
+--TEST--
+collections and strings
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--ENV--
+return "
+ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
+NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
+TNS_ADMIN=".(isset($_ENV['TNS_ADMIN']) ? $_ENV['TNS_ADMIN'] : '')."
+";
+--FILE--
+<?php
+
+require dirname(__FILE__)."/connect.inc";
+
+$ora_sql = "DROP TYPE
+ ".$type_name."
+ ";
+
+$statement = OCIParse($c,$ora_sql);
+@OCIExecute($statement);
+
+$ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF VARCHAR(10)";
+
+$statement = OCIParse($c,$ora_sql);
+OCIExecute($statement);
+
+
+$coll1 = ocinewcollection($c, $type_name);
+$coll2 = ocinewcollection($c, $type_name);
+
+var_dump(oci_collection_append($coll1, "string"));
+var_dump(oci_collection_append($coll1, "string"));
+
+var_dump(oci_collection_assign($coll2, $coll1));
+
+var_dump(oci_collection_element_get($coll2, 0));
+
+echo "Done\n";
+
+require dirname(__FILE__)."/drop_type.inc";
+
+?>
+--EXPECT--
+bool(true)
+bool(true)
+bool(true)
+string(6) "string"
+Done
diff --git a/ext/oci8/tests/coll_012.phpt b/ext/oci8/tests/coll_012.phpt
new file mode 100644
index 0000000000..59383b0cbc
--- /dev/null
+++ b/ext/oci8/tests/coll_012.phpt
@@ -0,0 +1,47 @@
+--TEST--
+collections and correct dates
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--ENV--
+return "
+ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
+NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
+TNS_ADMIN=".(isset($_ENV['TNS_ADMIN']) ? $_ENV['TNS_ADMIN'] : '')."
+";
+--FILE--
+<?php
+
+require dirname(__FILE__)."/connect.inc";
+
+$ora_sql = "DROP TYPE
+ ".$type_name."
+ ";
+
+$statement = OCIParse($c,$ora_sql);
+@OCIExecute($statement);
+
+$ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF DATE";
+
+$statement = OCIParse($c,$ora_sql);
+OCIExecute($statement);
+
+
+$coll1 = ocinewcollection($c, $type_name);
+$coll2 = ocinewcollection($c, $type_name);
+
+var_dump($coll1->append("28-JUL-05"));
+
+var_dump($coll2->assign($coll1));
+
+var_dump($coll2->getElem(0));
+
+echo "Done\n";
+
+require dirname(__FILE__)."/drop_type.inc";
+
+?>
+--EXPECT--
+bool(true)
+bool(true)
+string(9) "28-JUL-05"
+Done
diff --git a/ext/oci8/tests/coll_012_func.phpt b/ext/oci8/tests/coll_012_func.phpt
new file mode 100644
index 0000000000..16b85097d4
--- /dev/null
+++ b/ext/oci8/tests/coll_012_func.phpt
@@ -0,0 +1,47 @@
+--TEST--
+collections and correct dates
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--ENV--
+return "
+ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
+NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
+TNS_ADMIN=".(isset($_ENV['TNS_ADMIN']) ? $_ENV['TNS_ADMIN'] : '')."
+";
+--FILE--
+<?php
+
+require dirname(__FILE__)."/connect.inc";
+
+$ora_sql = "DROP TYPE
+ ".$type_name."
+ ";
+
+$statement = OCIParse($c,$ora_sql);
+@OCIExecute($statement);
+
+$ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF DATE";
+
+$statement = OCIParse($c,$ora_sql);
+OCIExecute($statement);
+
+
+$coll1 = ocinewcollection($c, $type_name);
+$coll2 = ocinewcollection($c, $type_name);
+
+var_dump(oci_collection_append($coll1, "28-JUL-05"));
+
+var_dump(oci_collection_assign($coll2, $coll1));
+
+var_dump(oci_collection_element_get($coll2, 0));
+
+echo "Done\n";
+
+require dirname(__FILE__)."/drop_type.inc";
+
+?>
+--EXPECT--
+bool(true)
+bool(true)
+string(9) "28-JUL-05"
+Done
diff --git a/ext/oci8/tests/coll_013.phpt b/ext/oci8/tests/coll_013.phpt
new file mode 100644
index 0000000000..cd1c851771
--- /dev/null
+++ b/ext/oci8/tests/coll_013.phpt
@@ -0,0 +1,44 @@
+--TEST--
+collections and correct dates (2)
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--ENV--
+return "
+ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
+NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
+TNS_ADMIN=".(isset($_ENV['TNS_ADMIN']) ? $_ENV['TNS_ADMIN'] : '')."
+";
+--FILE--
+<?php
+
+require dirname(__FILE__)."/connect.inc";
+
+$ora_sql = "DROP TYPE
+ ".$type_name."
+ ";
+
+$statement = OCIParse($c,$ora_sql);
+@OCIExecute($statement);
+
+$ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF DATE";
+
+$statement = OCIParse($c,$ora_sql);
+OCIExecute($statement);
+
+
+$coll1 = ocinewcollection($c, $type_name);
+
+var_dump($coll1->append("28-JUL-05"));
+var_dump($coll1->assignElem(0,"01-JAN-05"));
+var_dump($coll1->getElem(0));
+
+echo "Done\n";
+
+require dirname(__FILE__)."/drop_type.inc";
+
+?>
+--EXPECT--
+bool(true)
+bool(true)
+string(9) "01-JAN-05"
+Done
diff --git a/ext/oci8/tests/coll_013_func.phpt b/ext/oci8/tests/coll_013_func.phpt
new file mode 100644
index 0000000000..6141105b01
--- /dev/null
+++ b/ext/oci8/tests/coll_013_func.phpt
@@ -0,0 +1,44 @@
+--TEST--
+collections and correct dates (2)
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--ENV--
+return "
+ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
+NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
+TNS_ADMIN=".(isset($_ENV['TNS_ADMIN']) ? $_ENV['TNS_ADMIN'] : '')."
+";
+--FILE--
+<?php
+
+require dirname(__FILE__)."/connect.inc";
+
+$ora_sql = "DROP TYPE
+ ".$type_name."
+ ";
+
+$statement = OCIParse($c,$ora_sql);
+@OCIExecute($statement);
+
+$ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF DATE";
+
+$statement = OCIParse($c,$ora_sql);
+OCIExecute($statement);
+
+
+$coll1 = ocinewcollection($c, $type_name);
+
+var_dump(oci_collection_append($coll1, "28-JUL-05"));
+var_dump(oci_collection_element_assign($coll1, 0, "01-JAN-05"));
+var_dump(oci_collection_element_get($coll1, 0));
+
+echo "Done\n";
+
+require dirname(__FILE__)."/drop_type.inc";
+
+?>
+--EXPECT--
+bool(true)
+bool(true)
+string(9) "01-JAN-05"
+Done
diff --git a/ext/oci8/tests/coll_014.phpt b/ext/oci8/tests/coll_014.phpt
new file mode 100644
index 0000000000..abbdbff274
--- /dev/null
+++ b/ext/oci8/tests/coll_014.phpt
@@ -0,0 +1,44 @@
+--TEST--
+collections and strings (2)
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--ENV--
+return "
+ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
+NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
+TNS_ADMIN=".(isset($_ENV['TNS_ADMIN']) ? $_ENV['TNS_ADMIN'] : '')."
+";
+--FILE--
+<?php
+
+require dirname(__FILE__)."/connect.inc";
+
+$ora_sql = "DROP TYPE
+ ".$type_name."
+ ";
+
+$statement = OCIParse($c,$ora_sql);
+@OCIExecute($statement);
+
+$ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF VARCHAR(10)";
+
+$statement = OCIParse($c,$ora_sql);
+OCIExecute($statement);
+
+
+$coll1 = ocinewcollection($c, $type_name);
+
+var_dump($coll1->append("striing"));
+var_dump($coll1->assignElem(0,"blah"));
+var_dump($coll1->getElem(0));
+
+echo "Done\n";
+
+require dirname(__FILE__)."/drop_type.inc";
+
+?>
+--EXPECT--
+bool(true)
+bool(true)
+string(4) "blah"
+Done
diff --git a/ext/oci8/tests/coll_014_func.phpt b/ext/oci8/tests/coll_014_func.phpt
new file mode 100644
index 0000000000..a728ee0f7d
--- /dev/null
+++ b/ext/oci8/tests/coll_014_func.phpt
@@ -0,0 +1,44 @@
+--TEST--
+collections and strings (2)
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--ENV--
+return "
+ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
+NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
+TNS_ADMIN=".(isset($_ENV['TNS_ADMIN']) ? $_ENV['TNS_ADMIN'] : '')."
+";
+--FILE--
+<?php
+
+require dirname(__FILE__)."/connect.inc";
+
+$ora_sql = "DROP TYPE
+ ".$type_name."
+ ";
+
+$statement = OCIParse($c,$ora_sql);
+@OCIExecute($statement);
+
+$ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF VARCHAR(10)";
+
+$statement = OCIParse($c,$ora_sql);
+OCIExecute($statement);
+
+
+$coll1 = ocinewcollection($c, $type_name);
+
+var_dump(oci_collection_append($coll1, "striing"));
+var_dump(oci_collection_element_assign($coll1, 0,"blah"));
+var_dump(oci_collection_element_get($coll1, 0));
+
+echo "Done\n";
+
+require dirname(__FILE__)."/drop_type.inc";
+
+?>
+--EXPECT--
+bool(true)
+bool(true)
+string(4) "blah"
+Done
diff --git a/ext/oci8/tests/coll_015.phpt b/ext/oci8/tests/coll_015.phpt
new file mode 100644
index 0000000000..c9f9bda941
--- /dev/null
+++ b/ext/oci8/tests/coll_015.phpt
@@ -0,0 +1,44 @@
+--TEST--
+collections and numbers (2)
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--ENV--
+return "
+ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
+NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
+TNS_ADMIN=".(isset($_ENV['TNS_ADMIN']) ? $_ENV['TNS_ADMIN'] : '')."
+";
+--FILE--
+<?php
+
+require dirname(__FILE__)."/connect.inc";
+
+$ora_sql = "DROP TYPE
+ ".$type_name."
+ ";
+
+$statement = OCIParse($c,$ora_sql);
+@OCIExecute($statement);
+
+$ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF NUMBER";
+
+$statement = OCIParse($c,$ora_sql);
+OCIExecute($statement);
+
+
+$coll1 = ocinewcollection($c, $type_name);
+
+var_dump($coll1->append(1));
+var_dump($coll1->assignElem(0,2345));
+var_dump($coll1->getElem(0));
+
+echo "Done\n";
+
+require dirname(__FILE__)."/drop_type.inc";
+
+?>
+--EXPECT--
+bool(true)
+bool(true)
+float(2345)
+Done
diff --git a/ext/oci8/tests/coll_015_func.phpt b/ext/oci8/tests/coll_015_func.phpt
new file mode 100644
index 0000000000..27c4e68cd4
--- /dev/null
+++ b/ext/oci8/tests/coll_015_func.phpt
@@ -0,0 +1,44 @@
+--TEST--
+collections and numbers (2)
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--ENV--
+return "
+ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
+NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
+TNS_ADMIN=".(isset($_ENV['TNS_ADMIN']) ? $_ENV['TNS_ADMIN'] : '')."
+";
+--FILE--
+<?php
+
+require dirname(__FILE__)."/connect.inc";
+
+$ora_sql = "DROP TYPE
+ ".$type_name."
+ ";
+
+$statement = OCIParse($c,$ora_sql);
+@OCIExecute($statement);
+
+$ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF NUMBER";
+
+$statement = OCIParse($c,$ora_sql);
+OCIExecute($statement);
+
+
+$coll1 = ocinewcollection($c, $type_name);
+
+var_dump(oci_collection_append($coll1, 1));
+var_dump(oci_collection_element_assign($coll1,0,2345));
+var_dump(oci_collection_element_get($coll1, 0));
+
+echo "Done\n";
+
+require dirname(__FILE__)."/drop_type.inc";
+
+?>
+--EXPECT--
+bool(true)
+bool(true)
+float(2345)
+Done
diff --git a/ext/oci8/tests/coll_016.phpt b/ext/oci8/tests/coll_016.phpt
new file mode 100644
index 0000000000..3f685dd73f
--- /dev/null
+++ b/ext/oci8/tests/coll_016.phpt
@@ -0,0 +1,54 @@
+--TEST--
+collections and negative/too big element indexes
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--ENV--
+return "
+ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
+NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
+TNS_ADMIN=".(isset($_ENV['TNS_ADMIN']) ? $_ENV['TNS_ADMIN'] : '')."
+";
+--FILE--
+<?php
+
+require dirname(__FILE__)."/connect.inc";
+
+$ora_sql = "DROP TYPE
+ ".$type_name."
+ ";
+
+$statement = OCIParse($c,$ora_sql);
+@OCIExecute($statement);
+
+$ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF NUMBER";
+
+$statement = OCIParse($c,$ora_sql);
+OCIExecute($statement);
+
+
+$coll1 = ocinewcollection($c, $type_name);
+
+var_dump($coll1->append(1));
+var_dump($coll1->assignElem(-1,2345));
+var_dump($coll1->assignElem(5000,2345));
+var_dump($coll1->getElem(-1));
+var_dump($coll1->getElem(-100));
+var_dump($coll1->getElem(500));
+
+echo "Done\n";
+
+require dirname(__FILE__)."/drop_type.inc";
+
+?>
+--EXPECTF--
+bool(true)
+
+Warning: OCI-Collection::assignelem(): OCI-22165: given index [4294967295] must be in the range of 0 to [0] in %s on line %d
+bool(false)
+
+Warning: OCI-Collection::assignelem(): OCI-22165: given index [5000] must be in the range of 0 to [0] in %s on line %d
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+Done
diff --git a/ext/oci8/tests/coll_016_func.phpt b/ext/oci8/tests/coll_016_func.phpt
new file mode 100644
index 0000000000..f9ba14db49
--- /dev/null
+++ b/ext/oci8/tests/coll_016_func.phpt
@@ -0,0 +1,54 @@
+--TEST--
+collections and negative/too big element indexes
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--ENV--
+return "
+ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
+NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
+TNS_ADMIN=".(isset($_ENV['TNS_ADMIN']) ? $_ENV['TNS_ADMIN'] : '')."
+";
+--FILE--
+<?php
+
+require dirname(__FILE__)."/connect.inc";
+
+$ora_sql = "DROP TYPE
+ ".$type_name."
+ ";
+
+$statement = OCIParse($c,$ora_sql);
+@OCIExecute($statement);
+
+$ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF NUMBER";
+
+$statement = OCIParse($c,$ora_sql);
+OCIExecute($statement);
+
+
+$coll1 = ocinewcollection($c, $type_name);
+
+var_dump(oci_collection_append($coll1, 1));
+var_dump(oci_collection_element_assign($coll1,-1,2345));
+var_dump(oci_collection_element_assign($coll1,5000,2345));
+var_dump(oci_collection_element_get($coll1, -1));
+var_dump(oci_collection_element_get($coll1, -100));
+var_dump(oci_collection_element_get($coll1, 500));
+
+echo "Done\n";
+
+require dirname(__FILE__)."/drop_type.inc";
+
+?>
+--EXPECTF--
+bool(true)
+
+Warning: oci_collection_element_assign(): OCI-22165: given index [4294967295] must be in the range of 0 to [0] in %s on line %d
+bool(false)
+
+Warning: oci_collection_element_assign(): OCI-22165: given index [5000] must be in the range of 0 to [0] in %s on line %d
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+Done
diff --git a/ext/oci8/tests/coll_017.phpt b/ext/oci8/tests/coll_017.phpt
new file mode 100644
index 0000000000..2ba0ce5382
--- /dev/null
+++ b/ext/oci8/tests/coll_017.phpt
@@ -0,0 +1,44 @@
+--TEST--
+collections and nulls (2)
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--ENV--
+return "
+ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
+NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
+TNS_ADMIN=".(isset($_ENV['TNS_ADMIN']) ? $_ENV['TNS_ADMIN'] : '')."
+";
+--FILE--
+<?php
+
+require dirname(__FILE__)."/connect.inc";
+
+$ora_sql = "DROP TYPE
+ ".$type_name."
+ ";
+
+$statement = OCIParse($c,$ora_sql);
+@OCIExecute($statement);
+
+$ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF VARCHAR(10)";
+
+$statement = OCIParse($c,$ora_sql);
+OCIExecute($statement);
+
+
+$coll1 = ocinewcollection($c, $type_name);
+
+var_dump($coll1->append("string"));
+var_dump($coll1->assignElem(0, null));
+var_dump($coll1->getElem(0));
+
+echo "Done\n";
+
+require dirname(__FILE__)."/drop_type.inc";
+
+?>
+--EXPECT--
+bool(true)
+bool(true)
+NULL
+Done
diff --git a/ext/oci8/tests/coll_017_func.phpt b/ext/oci8/tests/coll_017_func.phpt
new file mode 100644
index 0000000000..ada10a192d
--- /dev/null
+++ b/ext/oci8/tests/coll_017_func.phpt
@@ -0,0 +1,44 @@
+--TEST--
+collections and nulls (2)
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--ENV--
+return "
+ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
+NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
+TNS_ADMIN=".(isset($_ENV['TNS_ADMIN']) ? $_ENV['TNS_ADMIN'] : '')."
+";
+--FILE--
+<?php
+
+require dirname(__FILE__)."/connect.inc";
+
+$ora_sql = "DROP TYPE
+ ".$type_name."
+ ";
+
+$statement = OCIParse($c,$ora_sql);
+@OCIExecute($statement);
+
+$ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF VARCHAR(10)";
+
+$statement = OCIParse($c,$ora_sql);
+OCIExecute($statement);
+
+
+$coll1 = ocinewcollection($c, $type_name);
+
+var_dump(oci_collection_append($coll1, "string"));
+var_dump(oci_collection_element_assign($coll1, 0, null));
+var_dump(oci_collection_element_get($coll1, 0));
+
+echo "Done\n";
+
+require dirname(__FILE__)."/drop_type.inc";
+
+?>
+--EXPECT--
+bool(true)
+bool(true)
+NULL
+Done
diff --git a/ext/oci8/tests/commit.phpt b/ext/oci8/tests/commit.phpt
new file mode 100644
index 0000000000..7a44a31a9b
--- /dev/null
+++ b/ext/oci8/tests/commit.phpt
@@ -0,0 +1,153 @@
+--TEST--
+oci_commit()/oci_rollback()
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--ENV--
+return "
+ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
+NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
+";
+--FILE--
+<?php
+
+require dirname(__FILE__)."/connect.inc";
+require dirname(__FILE__).'/create_table.inc';
+
+$insert_sql = "INSERT INTO ".$schema.$table_name." (id, value) VALUES (1,1)";
+
+if (!($s = oci_parse($c, $insert_sql))) {
+ die("oci_parse(insert) failed!\n");
+}
+
+for ($i = 0; $i<3; $i++) {
+ if (!oci_execute($s, OCI_DEFAULT)) {
+ die("oci_execute(insert) failed!\n");
+ }
+}
+
+var_dump(oci_rollback($c));
+
+$select_sql = "SELECT * FROM ".$schema.$table_name."";
+
+if (!($select = oci_parse($c, $select_sql))) {
+ die("oci_parse(select) failed!\n");
+}
+
+/* oci_fetch_all */
+if (!oci_execute($select)) {
+ die("oci_execute(select) failed!\n");
+}
+var_dump(oci_fetch_all($select, $all));
+var_dump($all);
+
+/* ocifetchstatement */
+if (!oci_execute($s)) {
+ die("oci_execute(select) failed!\n");
+}
+
+$insert_sql = "INSERT INTO ".$schema.$table_name." (id, value) VALUES (1,1)";
+
+if (!($s = oci_parse($c, $insert_sql))) {
+ die("oci_parse(insert) failed!\n");
+}
+
+for ($i = 0; $i<3; $i++) {
+ if (!oci_execute($s, OCI_DEFAULT)) {
+ die("oci_execute(insert) failed!\n");
+ }
+}
+
+var_dump(oci_commit($c));
+
+/* oci_fetch_all */
+if (!oci_execute($select)) {
+ die("oci_execute(select) failed!\n");
+}
+var_dump(oci_fetch_all($select, $all));
+var_dump($all);
+
+
+require dirname(__FILE__).'/drop_table.inc';
+
+echo "Done\n";
+?>
+--EXPECT--
+bool(true)
+int(0)
+array(5) {
+ ["ID"]=>
+ array(0) {
+ }
+ ["VALUE"]=>
+ array(0) {
+ }
+ ["BLOB"]=>
+ array(0) {
+ }
+ ["CLOB"]=>
+ array(0) {
+ }
+ ["STRING"]=>
+ array(0) {
+ }
+}
+bool(true)
+int(4)
+array(5) {
+ ["ID"]=>
+ array(4) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(1) "1"
+ [2]=>
+ string(1) "1"
+ [3]=>
+ string(1) "1"
+ }
+ ["VALUE"]=>
+ array(4) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(1) "1"
+ [2]=>
+ string(1) "1"
+ [3]=>
+ string(1) "1"
+ }
+ ["BLOB"]=>
+ array(4) {
+ [0]=>
+ NULL
+ [1]=>
+ NULL
+ [2]=>
+ NULL
+ [3]=>
+ NULL
+ }
+ ["CLOB"]=>
+ array(4) {
+ [0]=>
+ NULL
+ [1]=>
+ NULL
+ [2]=>
+ NULL
+ [3]=>
+ NULL
+ }
+ ["STRING"]=>
+ array(4) {
+ [0]=>
+ NULL
+ [1]=>
+ NULL
+ [2]=>
+ NULL
+ [3]=>
+ NULL
+ }
+}
+Done
diff --git a/ext/oci8/tests/commit_old.phpt b/ext/oci8/tests/commit_old.phpt
new file mode 100644
index 0000000000..3dfb383113
--- /dev/null
+++ b/ext/oci8/tests/commit_old.phpt
@@ -0,0 +1,151 @@
+--TEST--
+ocicommit()/ocirollback()
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--ENV--
+return "
+ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
+NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
+";
+--FILE--
+<?php
+
+require dirname(__FILE__)."/connect.inc";
+require dirname(__FILE__).'/create_table.inc';
+
+$insert_sql = "INSERT INTO ".$schema.$table_name." (id, value) VALUES (1,1)";
+
+if (!($s = ociparse($c, $insert_sql))) {
+ die("ociparse(insert) failed!\n");
+}
+
+for ($i = 0; $i<3; $i++) {
+ if (!ociexecute($s, OCI_DEFAULT)) {
+ die("ociexecute(insert) failed!\n");
+ }
+}
+
+var_dump(ocirollback($c));
+
+$select_sql = "SELECT * FROM ".$schema.$table_name."";
+
+if (!($select = ociparse($c, $select_sql))) {
+ die("ociparse(select) failed!\n");
+}
+
+if (!oci_execute($select)) {
+ die("ociexecute(select) failed!\n");
+}
+var_dump(ocifetchstatement($select, $all));
+var_dump($all);
+
+/* ocifetchstatement */
+if (!ociexecute($s)) {
+ die("ociexecute(select) failed!\n");
+}
+
+$insert_sql = "INSERT INTO ".$schema.$table_name." (id, value) VALUES (1,1)";
+
+if (!($s = ociparse($c, $insert_sql))) {
+ die("ociparse(insert) failed!\n");
+}
+
+for ($i = 0; $i<3; $i++) {
+ if (!ociexecute($s, OCI_DEFAULT)) {
+ die("ociexecute(insert) failed!\n");
+ }
+}
+
+var_dump(ocicommit($c));
+
+if (!ociexecute($select)) {
+ die("ociexecute(select) failed!\n");
+}
+var_dump(ocifetchstatement($select, $all));
+var_dump($all);
+
+
+require dirname(__FILE__).'/drop_table.inc';
+
+echo "Done\n";
+?>
+--EXPECT--
+bool(true)
+int(0)
+array(5) {
+ ["ID"]=>
+ array(0) {
+ }
+ ["VALUE"]=>
+ array(0) {
+ }
+ ["BLOB"]=>
+ array(0) {
+ }
+ ["CLOB"]=>
+ array(0) {
+ }
+ ["STRING"]=>
+ array(0) {
+ }
+}
+bool(true)
+int(4)
+array(5) {
+ ["ID"]=>
+ array(4) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(1) "1"
+ [2]=>
+ string(1) "1"
+ [3]=>
+ string(1) "1"
+ }
+ ["VALUE"]=>
+ array(4) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(1) "1"
+ [2]=>
+ string(1) "1"
+ [3]=>
+ string(1) "1"
+ }
+ ["BLOB"]=>
+ array(4) {
+ [0]=>
+ NULL
+ [1]=>
+ NULL
+ [2]=>
+ NULL
+ [3]=>
+ NULL
+ }
+ ["CLOB"]=>
+ array(4) {
+ [0]=>
+ NULL
+ [1]=>
+ NULL
+ [2]=>
+ NULL
+ [3]=>
+ NULL
+ }
+ ["STRING"]=>
+ array(4) {
+ [0]=>
+ NULL
+ [1]=>
+ NULL
+ [2]=>
+ NULL
+ [3]=>
+ NULL
+ }
+}
+Done
diff --git a/ext/oci8/tests/connect.inc b/ext/oci8/tests/connect.inc
index a0013e20d7..887c8fdaa1 100644
--- a/ext/oci8/tests/connect.inc
+++ b/ext/oci8/tests/connect.inc
@@ -4,29 +4,27 @@
* Please, change user, password and dbase to match your configuration.
*
* */
-
-$user = "user";
-$password = "pass";
-$dbase = "base";
+
+$user = "system";
+$password = "system";
+$dbase = "oracle";
/*
* You should have privileges to create tables in this schema
*
* */
-
-$schema = "system";
-
/*
- * Remove the last line in skipif.inc to run tests
- *
- * */
-
+$schema = "system";
+*/
+$table_name = "tb".substr(str_replace(Array(".", "-"), "_", php_uname("n")), 0, 5);
+$type_name = strtoupper("tp".substr(str_replace(Array(".", "-"), "_", php_uname("n")), 0, 5));
+
if (!empty($dbase)) {
- $connection = ocilogon($user,$password,$dbase);
+ $c = ocilogon($user,$password,$dbase);
}
else {
- $connection = ocilogon($user,$password);
+ $c = ocilogon($user,$password);
}
if (!empty($schema)) {
diff --git a/ext/oci8/tests/connect.phpt b/ext/oci8/tests/connect.phpt
new file mode 100644
index 0000000000..d873a7e015
--- /dev/null
+++ b/ext/oci8/tests/connect.phpt
@@ -0,0 +1,27 @@
+--TEST--
+oci_connect()
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--ENV--
+return "
+ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
+NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
+";
+--FILE--
+<?php
+
+require dirname(__FILE__)."/connect.inc";
+
+if (!empty($dbase)) {
+ var_dump(oci_connect($user, $password, $dbase));
+}
+else {
+ var_dump(oci_connect($user, $password));
+}
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+resource(%d) of type (oci8 connection)
+Done
diff --git a/ext/oci8/tests/connect_1.phpt b/ext/oci8/tests/connect_1.phpt
new file mode 100644
index 0000000000..e658344496
--- /dev/null
+++ b/ext/oci8/tests/connect_1.phpt
@@ -0,0 +1,40 @@
+--TEST--
+oci_pconnect() & oci_new_connect()
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--ENV--
+return "
+ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
+NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
+";
+--FILE--
+<?php
+
+require dirname(__FILE__)."/connect.inc";
+
+if (!empty($dbase)) {
+ var_dump($c1 = oci_pconnect($user, $password, $dbase));
+}
+else {
+ var_dump($c1 = oci_pconnect($user, $password));
+}
+
+if (!empty($dbase)) {
+ var_dump($c2 = oci_new_connect($user, $password, $dbase));
+}
+else {
+ var_dump($c2 = oci_new_connect($user, $password));
+}
+
+var_dump(oci_close($c1));
+var_dump(ocilogoff($c2));
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+resource(%d) of type (oci8 persistent connection)
+resource(%d) of type (oci8 connection)
+bool(true)
+bool(true)
+Done
diff --git a/ext/oci8/tests/connect_1_old.phpt b/ext/oci8/tests/connect_1_old.phpt
new file mode 100644
index 0000000000..73c756159d
--- /dev/null
+++ b/ext/oci8/tests/connect_1_old.phpt
@@ -0,0 +1,40 @@
+--TEST--
+ociplogon() & ocinlogon()
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--ENV--
+return "
+ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
+NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
+";
+--FILE--
+<?php
+
+require dirname(__FILE__)."/connect.inc";
+
+if (!empty($dbase)) {
+ var_dump($c1 = ociplogon($user, $password, $dbase));
+}
+else {
+ var_dump($c1 = ociplogon($user, $password));
+}
+
+if (!empty($dbase)) {
+ var_dump($c2 = ocinlogon($user, $password, $dbase));
+}
+else {
+ var_dump($c2 = ocinlogon($user, $password));
+}
+
+var_dump(ocilogoff($c1));
+var_dump(ocilogoff($c2));
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+resource(%d) of type (oci8 persistent connection)
+resource(%d) of type (oci8 connection)
+bool(true)
+bool(true)
+Done
diff --git a/ext/oci8/tests/connect_old.phpt b/ext/oci8/tests/connect_old.phpt
new file mode 100644
index 0000000000..a8183d4ec8
--- /dev/null
+++ b/ext/oci8/tests/connect_old.phpt
@@ -0,0 +1,27 @@
+--TEST--
+ocilogon()
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--ENV--
+return "
+ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
+NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
+";
+--FILE--
+<?php
+
+require dirname(__FILE__)."/connect.inc";
+
+if (!empty($dbase)) {
+ var_dump(ocilogon($user, $password, $dbase));
+}
+else {
+ var_dump(ocilogon($user, $password));
+}
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+resource(%d) of type (oci8 connection)
+Done
diff --git a/ext/oci8/tests/connect_without_oracle_home.phpt b/ext/oci8/tests/connect_without_oracle_home.phpt
new file mode 100644
index 0000000000..513d60cefd
--- /dev/null
+++ b/ext/oci8/tests/connect_without_oracle_home.phpt
@@ -0,0 +1,25 @@
+--TEST--
+oci_connect() without ORACLE_HOME set (OCIServerAttach() segfaults)
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+require dirname(__FILE__)."/connect.inc";
+
+if (!empty($dbase)) {
+ var_dump(oci_connect($user, $password, $dbase));
+}
+else {
+ var_dump(oci_connect($user, $password));
+}
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+Warning: ocilogon(): _oci_open_server failed, check ORACLE_HOME and NLS_LANG variables: ORA-12514: TNS:listener does not currently know of service requested in connect descriptor in %sconnect.inc on line %d
+
+Warning: oci_connect(): _oci_open_server failed, check ORACLE_HOME and NLS_LANG variables: ORA-12514: TNS:listener does not currently know of service requested in connect descriptor in %sconnect_without_oracle_home.php on line %d
+bool(false)
+Done
diff --git a/ext/oci8/tests/connect_without_oracle_home_old.phpt b/ext/oci8/tests/connect_without_oracle_home_old.phpt
new file mode 100644
index 0000000000..68b11de155
--- /dev/null
+++ b/ext/oci8/tests/connect_without_oracle_home_old.phpt
@@ -0,0 +1,25 @@
+--TEST--
+ocilogon() without ORACLE_HOME set (OCIServerAttach() segfaults)
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+require dirname(__FILE__)."/connect.inc";
+
+if (!empty($dbase)) {
+ var_dump(ocilogon($user, $password, $dbase));
+}
+else {
+ var_dump(ocilogon($user, $password));
+}
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+Warning: ocilogon(): _oci_open_server failed, check ORACLE_HOME and NLS_LANG variables: ORA-12514: TNS:listener does not currently know of service requested in connect descriptor in %sconnect.inc on line %d
+
+Warning: oci_connect(): _oci_open_server failed, check ORACLE_HOME and NLS_LANG variables: ORA-12514: TNS:listener does not currently know of service requested in connect descriptor in %sconnect_without_oracle_home.php on line %d
+bool(false)
+Done
diff --git a/ext/oci8/tests/create_table.inc b/ext/oci8/tests/create_table.inc
index c423ce577d..d6debf2339 100644
--- a/ext/oci8/tests/create_table.inc
+++ b/ext/oci8/tests/create_table.inc
@@ -1,11 +1,18 @@
<?php
- if ($connection) {
+ if ($c) {
+ $ora_sql = "DROP TABLE
+ ".$schema.$table_name."
+ ";
+
+ $statement = OCIParse($c, $ora_sql);
+ @OCIExecute($statement);
+
$ora_sql = "CREATE TABLE
- ".$schema."php_test_table (id NUMBER, value NUMBER)
+ ".$schema.$table_name." (id NUMBER, value NUMBER, blob BLOB, clob CLOB, string VARCHAR(10))
";
- $statement = OCIParse($connection,$ora_sql);
+ $statement = OCIParse($c,$ora_sql);
OCIExecute($statement);
}
diff --git a/ext/oci8/tests/create_type.inc b/ext/oci8/tests/create_type.inc
new file mode 100644
index 0000000000..e23f7cb903
--- /dev/null
+++ b/ext/oci8/tests/create_type.inc
@@ -0,0 +1,17 @@
+<?php
+
+ if ($c) {
+ $ora_sql = "DROP TYPE
+ ".$type_name."
+ ";
+
+ $statement = OCIParse($c,$ora_sql);
+ @OCIExecute($statement);
+
+ $ora_sql = "CREATE TYPE ".$type_name." AS TABLE OF NUMBER(11)";
+
+ $statement = OCIParse($c,$ora_sql);
+ OCIExecute($statement);
+ }
+
+?>
diff --git a/ext/oci8/tests/cursor_bind_err.phpt b/ext/oci8/tests/cursor_bind_err.phpt
new file mode 100644
index 0000000000..343167387b
--- /dev/null
+++ b/ext/oci8/tests/cursor_bind_err.phpt
@@ -0,0 +1,53 @@
+--TEST--
+binding a cursor (with errors)
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--ENV--
+return "
+ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
+NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
+";
+--FILE--
+<?php
+
+require dirname(__FILE__)."/connect.inc";
+require dirname(__FILE__)."/create_table.inc";
+
+$insert_sql = "INSERT INTO ".$schema.$table_name." (id, value) VALUES (1,1)";
+
+if (!($s = oci_parse($c, $insert_sql))) {
+ die("oci_parse(insert) failed!\n");
+}
+
+for ($i = 0; $i<3; $i++) {
+ if (!oci_execute($s)) {
+ die("oci_execute(insert) failed!\n");
+ }
+}
+
+if (!oci_commit($c)) {
+ die("oci_commit() failed!\n");
+}
+
+$sql = "select CURSOR(select * from ".$schema.$table_name.") into :cursor from dual";
+$stmt = oci_parse($c, $sql);
+
+$cursor = oci_new_cursor($c);
+oci_bind_by_name($stmt, ":cursor", $cursor, -1, OCI_B_CURSOR);
+
+oci_execute($stmt);
+
+oci_execute($cursor);
+var_dump(oci_fetch_assoc($cursor));
+
+require dirname(__FILE__)."/drop_table.inc";
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+Warning: oci_bind_by_name(): ORA-01036: illegal variable name/number in %s on line %d
+
+Warning: oci_fetch_assoc(): ORA-24338: statement handle not executed in %s on line %d
+bool(false)
+Done
diff --git a/ext/oci8/tests/cursors.phpt b/ext/oci8/tests/cursors.phpt
new file mode 100644
index 0000000000..e69ff82dd2
--- /dev/null
+++ b/ext/oci8/tests/cursors.phpt
@@ -0,0 +1,64 @@
+--TEST--
+fetching cursor from a statement
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--ENV--
+return "
+ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
+NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
+";
+--FILE--
+<?php
+
+require dirname(__FILE__)."/connect.inc";
+require dirname(__FILE__)."/create_table.inc";
+
+$insert_sql = "INSERT INTO ".$schema.$table_name." (id, value) VALUES (1,1)";
+
+if (!($s = oci_parse($c, $insert_sql))) {
+ die("oci_parse(insert) failed!\n");
+}
+
+for ($i = 0; $i<3; $i++) {
+ if (!oci_execute($s)) {
+ die("oci_execute(insert) failed!\n");
+ }
+}
+
+if (!oci_commit($c)) {
+ die("oci_commit() failed!\n");
+}
+
+$sql = "select CURSOR(select * from ".$schema.$table_name.") as curs FROM dual";
+$stmt = oci_parse($c, $sql);
+
+oci_execute($stmt);
+
+while ($data = oci_fetch_assoc($stmt)) {
+ oci_execute($data["CURS"]);
+ $subdata = oci_fetch_assoc($data["CURS"]);
+ var_dump($subdata);
+ var_dump(oci_cancel($data["CURS"]));
+ $subdata = oci_fetch_assoc($data["CURS"]);
+ var_dump($subdata);
+ var_dump(oci_cancel($data["CURS"]));
+}
+
+require dirname(__FILE__)."/drop_table.inc";
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+array(2) {
+ ["ID"]=>
+ string(1) "1"
+ ["VALUE"]=>
+ string(1) "1"
+}
+bool(true)
+
+Warning: oci_fetch_assoc()%sORA-01002: fetch out of sequence in %scursors.php on line %d
+bool(false)
+bool(true)
+Done
diff --git a/ext/oci8/tests/cursors_old.phpt b/ext/oci8/tests/cursors_old.phpt
new file mode 100644
index 0000000000..4991ed795a
--- /dev/null
+++ b/ext/oci8/tests/cursors_old.phpt
@@ -0,0 +1,69 @@
+--TEST--
+fetching cursor from a statement
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--ENV--
+return "
+ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
+NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
+";
+--FILE--
+<?php
+
+require dirname(__FILE__)."/connect.inc";
+require dirname(__FILE__)."/create_table.inc";
+
+$insert_sql = "INSERT INTO ".$schema.$table_name." (id, value) VALUES (1,1)";
+
+if (!($s = ociparse($c, $insert_sql))) {
+ die("ociparse(insert) failed!\n");
+}
+
+for ($i = 0; $i<3; $i++) {
+ if (!ociexecute($s)) {
+ die("ociexecute(insert) failed!\n");
+ }
+}
+
+if (!ocicommit($c)) {
+ die("ocicommit() failed!\n");
+}
+
+$sql = "select CURSOR(select * from ".$schema.$table_name.") as curs FROM dual";
+$stmt = ociparse($c, $sql);
+
+ociexecute($stmt);
+
+while ($result = ocifetchinto($stmt, $data, OCI_ASSOC)) {
+ ociexecute($data["CURS"]);
+ ocifetchinto($data["CURS"], $subdata, OCI_ASSOC);
+ var_dump($subdata);
+ var_dump(ocicancel($data["CURS"]));
+ ocifetchinto($data["CURS"], $subdata, OCI_ASSOC);
+ var_dump($subdata);
+ var_dump(ocicancel($data["CURS"]));
+}
+
+require dirname(__FILE__)."/drop_table.inc";
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+array(2) {
+ ["ID"]=>
+ string(1) "1"
+ ["VALUE"]=>
+ string(1) "1"
+}
+bool(true)
+
+Warning: ocifetchinto():%sORA-01002: fetch out of sequence in %scursors_old.php on line %d
+array(2) {
+ ["ID"]=>
+ string(1) "1"
+ ["VALUE"]=>
+ string(1) "1"
+}
+bool(true)
+Done
diff --git a/ext/oci8/tests/debug.phpt b/ext/oci8/tests/debug.phpt
new file mode 100644
index 0000000000..2a2d2f79c2
--- /dev/null
+++ b/ext/oci8/tests/debug.phpt
@@ -0,0 +1,36 @@
+--TEST--
+oci_internal_debug()
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--ENV--
+return "
+ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
+NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
+";
+--FILE--
+<?php
+
+require dirname(__FILE__)."/connect.inc";
+
+oci_internal_debug(true);
+
+if (!empty($dbase)) {
+ oci_connect($user, $password, $dbase);
+}
+else {
+ oci_connect($user, $password);
+}
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+OCI8 DEBUG: OCINlsEnvironmentVariableGet in php_oci_do_connect_ex() (%s/oci8.c:%d)
+Done
+OCI8 DEBUG: OCISessionEnd in php_oci_connection_close() (%s/oci8.c:%d)
+OCI8 DEBUG: OCIHandleFree in php_oci_connection_close() (%s/oci8.c:%d)
+OCI8 DEBUG: OCIServerDetach in php_oci_connection_close() (%s/oci8.c:%d)
+OCI8 DEBUG: OCIHandleFree in php_oci_connection_close() (%s/oci8.c:%d)
+OCI8 DEBUG: OCIHandleFree in php_oci_connection_close() (%s/oci8.c:%d)
+OCI8 DEBUG: OCIHandleFree in php_oci_connection_close() (%s/oci8.c:%d)
+OCI8 DEBUG: OCIHandleFree in php_oci_connection_close() (%s/oci8.c:%d)
diff --git a/ext/oci8/tests/default_prefetch.phpt b/ext/oci8/tests/default_prefetch.phpt
new file mode 100644
index 0000000000..46d2d07e4c
--- /dev/null
+++ b/ext/oci8/tests/default_prefetch.phpt
@@ -0,0 +1,55 @@
+--TEST--
+oci8.default_prefetch ini option
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--ENV--
+return "
+ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
+NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
+";
+--INI--
+oci8.default_prefetch=20
+--FILE--
+<?php
+
+require dirname(__FILE__)."/connect.inc";
+require dirname(__FILE__).'/create_table.inc';
+
+$insert_sql = "INSERT INTO ".$schema.$table_name." (id, value) VALUES (1,1)";
+
+if (!($s = oci_parse($c, $insert_sql))) {
+ die("oci_parse(insert) failed!\n");
+}
+
+for ($i = 0; $i<3; $i++) {
+ if (!oci_execute($s)) {
+ die("oci_execute(insert) failed!\n");
+ }
+}
+
+if (!oci_commit($c)) {
+ die("oci_commit() failed!\n");
+}
+
+$select_sql = "SELECT * FROM ".$schema.$table_name."";
+
+if (!($s = oci_parse($c, $select_sql))) {
+ die("oci_parse(select) failed!\n");
+}
+
+if (!oci_execute($s)) {
+ die("oci_execute(select) failed!\n");
+}
+
+var_dump(oci_fetch($s));
+
+var_dump(oci_num_rows($s));
+
+require dirname(__FILE__).'/drop_table.inc';
+
+echo "Done\n";
+?>
+--EXPECT--
+bool(true)
+int(1)
+Done
diff --git a/ext/oci8/tests/default_prefetch1.phpt b/ext/oci8/tests/default_prefetch1.phpt
new file mode 100644
index 0000000000..8f43450c84
--- /dev/null
+++ b/ext/oci8/tests/default_prefetch1.phpt
@@ -0,0 +1,55 @@
+--TEST--
+oci8.default_prefetch ini option
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--ENV--
+return "
+ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
+NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
+";
+--INI--
+oci8.default_prefetch=100
+--FILE--
+<?php
+
+require dirname(__FILE__)."/connect.inc";
+require dirname(__FILE__).'/create_table.inc';
+
+$insert_sql = "INSERT INTO ".$schema.$table_name." (id, value) VALUES (1,1)";
+
+if (!($s = oci_parse($c, $insert_sql))) {
+ die("oci_parse(insert) failed!\n");
+}
+
+for ($i = 0; $i<3; $i++) {
+ if (!oci_execute($s)) {
+ die("oci_execute(insert) failed!\n");
+ }
+}
+
+if (!oci_commit($c)) {
+ die("oci_commit() failed!\n");
+}
+
+$select_sql = "SELECT * FROM ".$schema.$table_name."";
+
+if (!($s = oci_parse($c, $select_sql))) {
+ die("oci_parse(select) failed!\n");
+}
+
+if (!oci_execute($s)) {
+ die("oci_execute(select) failed!\n");
+}
+
+var_dump(oci_fetch($s));
+
+var_dump(oci_num_rows($s));
+
+require dirname(__FILE__).'/drop_table.inc';
+
+echo "Done\n";
+?>
+--EXPECT--
+bool(true)
+int(1)
+Done
diff --git a/ext/oci8/tests/default_prefetch2.phpt b/ext/oci8/tests/default_prefetch2.phpt
new file mode 100644
index 0000000000..8a0939cdc1
--- /dev/null
+++ b/ext/oci8/tests/default_prefetch2.phpt
@@ -0,0 +1,58 @@
+--TEST--
+oci8.default_prefetch ini option
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--ENV--
+return "
+ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
+NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
+";
+--INI--
+oci8.default_prefetch=100
+--FILE--
+<?php
+
+require dirname(__FILE__)."/connect.inc";
+require dirname(__FILE__).'/create_table.inc';
+
+$insert_sql = "INSERT INTO ".$schema.$table_name." (id, value) VALUES (1,1)";
+
+if (!($s = oci_parse($c, $insert_sql))) {
+ die("oci_parse(insert) failed!\n");
+}
+
+for ($i = 0; $i<3; $i++) {
+ if (!oci_execute($s)) {
+ die("oci_execute(insert) failed!\n");
+ }
+}
+
+if (!oci_commit($c)) {
+ die("oci_commit() failed!\n");
+}
+
+$select_sql = "SELECT * FROM ".$schema.$table_name."";
+
+if (!($s = oci_parse($c, $select_sql))) {
+ die("oci_parse(select) failed!\n");
+}
+
+var_dump(oci_set_prefetch($s, 10));
+
+if (!oci_execute($s)) {
+ die("oci_execute(select) failed!\n");
+}
+
+var_dump(oci_fetch($s));
+
+var_dump(oci_num_rows($s));
+
+require dirname(__FILE__).'/drop_table.inc';
+
+echo "Done\n";
+?>
+--EXPECT--
+bool(true)
+bool(true)
+int(1)
+Done
diff --git a/ext/oci8/tests/define.phpt b/ext/oci8/tests/define.phpt
new file mode 100644
index 0000000000..dde5d575b3
--- /dev/null
+++ b/ext/oci8/tests/define.phpt
@@ -0,0 +1,46 @@
+--TEST--
+oci_define_by_name()
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--ENV--
+return "
+ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
+NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
+";
+--FILE--
+<?php
+
+require dirname(__FILE__)."/connect.inc";
+require dirname(__FILE__)."/create_table.inc";
+
+$insert_sql = "INSERT INTO ".$schema.$table_name." (string) VALUES ('some')";
+
+if (!($s = oci_parse($c, $insert_sql))) {
+ die("oci_parse(insert) failed!\n");
+}
+
+if (!oci_execute($s)) {
+ die("oci_execute(insert) failed!\n");
+}
+
+$stmt = oci_parse($c, "SELECT string FROM ".$table_name."");
+
+/* the define MUST be done BEFORE ociexecute! */
+
+$strong = '';
+oci_define_by_name($stmt, "STRING", $string, 20);
+
+oci_execute($stmt);
+
+while (oci_fetch($stmt)) {
+ var_dump($string);
+}
+
+require dirname(__FILE__)."/drop_table.inc";
+
+echo "Done\n";
+
+?>
+--EXPECT--
+string(4) "some"
+Done
diff --git a/ext/oci8/tests/define_old.phpt b/ext/oci8/tests/define_old.phpt
new file mode 100644
index 0000000000..e3c8278668
--- /dev/null
+++ b/ext/oci8/tests/define_old.phpt
@@ -0,0 +1,46 @@
+--TEST--
+ocidefinebyname()
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--ENV--
+return "
+ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
+NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
+";
+--FILE--
+<?php
+
+require dirname(__FILE__)."/connect.inc";
+require dirname(__FILE__)."/create_table.inc";
+
+$insert_sql = "INSERT INTO ".$schema.$table_name." (string) VALUES ('some')";
+
+if (!($s = ociparse($c, $insert_sql))) {
+ die("oci_parse(insert) failed!\n");
+}
+
+if (!ociexecute($s)) {
+ die("oci_execute(insert) failed!\n");
+}
+
+$stmt = ociparse($c, "SELECT string FROM ".$table_name."");
+
+/* the define MUST be done BEFORE ociexecute! */
+
+$strong = '';
+ocidefinebyname($stmt, "STRING", $string, 20);
+
+ociexecute($stmt);
+
+while (ocifetch($stmt)) {
+ var_dump($string);
+}
+
+require dirname(__FILE__)."/drop_table.inc";
+
+echo "Done\n";
+
+?>
+--EXPECT--
+string(4) "some"
+Done
diff --git a/ext/oci8/tests/drop_table.inc b/ext/oci8/tests/drop_table.inc
index 4e558f5e33..ffd99f5af3 100644
--- a/ext/oci8/tests/drop_table.inc
+++ b/ext/oci8/tests/drop_table.inc
@@ -1,11 +1,11 @@
<?php
- if ($connection) {
+ if ($c) {
$ora_sql = "DROP TABLE
- ".$schema."php_test_table
+ ".$schema.$table_name."
";
- $statement = OCIParse($connection,$ora_sql);
+ $statement = OCIParse($c,$ora_sql);
OCIExecute($statement);
}
diff --git a/ext/oci8/tests/drop_type.inc b/ext/oci8/tests/drop_type.inc
new file mode 100644
index 0000000000..047968ef28
--- /dev/null
+++ b/ext/oci8/tests/drop_type.inc
@@ -0,0 +1,12 @@
+<?php
+
+ if ($c) {
+ $ora_sql = "DROP TYPE
+ ".$type_name."
+ ";
+
+ $statement = OCIParse($c,$ora_sql);
+ OCIExecute($statement);
+ }
+
+?>
diff --git a/ext/oci8/tests/error.phpt b/ext/oci8/tests/error.phpt
new file mode 100644
index 0000000000..594a3d1319
--- /dev/null
+++ b/ext/oci8/tests/error.phpt
@@ -0,0 +1,45 @@
+--TEST--
+oci_error()
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--ENV--
+return "
+ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
+NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
+";
+--FILE--
+<?php
+
+require dirname(__FILE__)."/connect.inc";
+
+if (!empty($dbase)) {
+ var_dump(oci_connect($user, $password, $dbase));
+}
+else {
+ var_dump(oci_connect($user, $password));
+}
+
+var_dump($s = oci_parse($c, "WRONG SYNTAX"));
+var_dump(oci_execute($s));
+var_dump(oci_error($s));
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+resource(%s) of type (oci8 connection)
+resource(%s) of type (oci8 statement)
+
+Warning: oci_execute(): ORA-00900: invalid SQL statement in %s on line %d
+bool(false)
+array(4) {
+ ["code"]=>
+ int(900)
+ ["message"]=>
+ string(32) "ORA-00900: invalid SQL statement"
+ ["offset"]=>
+ int(0)
+ ["sqltext"]=>
+ string(12) "WRONG SYNTAX"
+}
+Done
diff --git a/ext/oci8/tests/error1.phpt b/ext/oci8/tests/error1.phpt
new file mode 100644
index 0000000000..a150de8975
--- /dev/null
+++ b/ext/oci8/tests/error1.phpt
@@ -0,0 +1,23 @@
+--TEST--
+oci_error() when oci_connect() fails
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--ENV--
+return "
+ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
+NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
+";
+--FILE--
+<?php
+
+var_dump(oci_connect("some", "some", "some"));
+var_dump(oci_error());
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+Warning: oci_connect(): ORA-12154: TNS:could not resolve the connect identifier specified in %s on line %d
+bool(false)
+bool(false)
+Done
diff --git a/ext/oci8/tests/error_old.phpt b/ext/oci8/tests/error_old.phpt
new file mode 100644
index 0000000000..fbdcd9e610
--- /dev/null
+++ b/ext/oci8/tests/error_old.phpt
@@ -0,0 +1,45 @@
+--TEST--
+ocierror()
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--ENV--
+return "
+ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
+NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
+";
+--FILE--
+<?php
+
+require dirname(__FILE__)."/connect.inc";
+
+if (!empty($dbase)) {
+ var_dump(ocilogon($user, $password, $dbase));
+}
+else {
+ var_dump(ocilogon($user, $password));
+}
+
+var_dump($s = ociparse($c, "WRONG SYNTAX"));
+var_dump(ociexecute($s));
+var_dump(ocierror($s));
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+resource(%s) of type (oci8 connection)
+resource(%s) of type (oci8 statement)
+
+Warning: ociexecute(): ORA-00900: invalid SQL statement in %s on line %d
+bool(false)
+array(4) {
+ ["code"]=>
+ int(900)
+ ["message"]=>
+ string(32) "ORA-00900: invalid SQL statement"
+ ["offset"]=>
+ int(0)
+ ["sqltext"]=>
+ string(12) "WRONG SYNTAX"
+}
+Done
diff --git a/ext/oci8/tests/exec_fetch.phpt b/ext/oci8/tests/exec_fetch.phpt
new file mode 100644
index 0000000000..e1705273aa
--- /dev/null
+++ b/ext/oci8/tests/exec_fetch.phpt
@@ -0,0 +1,24 @@
+--TEST--
+fetch after failed oci_execute()
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--ENV--
+return "
+ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
+NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
+";
+--FILE--
+<?php
+
+require dirname(__FILE__).'/connect.inc';
+
+$sql = "select 2 from nonex_dual";
+$stmt = oci_parse($c, $sql);
+
+var_dump(oci_execute($stmt));
+var_dump(oci_fetch_array($stmt));
+
+echo "Done\n";
+?>
+--EXPECTF--
+Done
diff --git a/ext/oci8/tests/fetch.phpt b/ext/oci8/tests/fetch.phpt
new file mode 100644
index 0000000000..72ca9f3f80
--- /dev/null
+++ b/ext/oci8/tests/fetch.phpt
@@ -0,0 +1,61 @@
+--TEST--
+ocifetch() & ociresult()
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--ENV--
+return "
+ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
+NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
+";
+--FILE--
+<?php
+
+require dirname(__FILE__)."/connect.inc";
+require dirname(__FILE__).'/create_table.inc';
+
+$insert_sql = "INSERT INTO ".$schema.$table_name." (id, value) VALUES (1,1)";
+
+if (!($s = oci_parse($c, $insert_sql))) {
+ die("oci_parse(insert) failed!\n");
+}
+
+for ($i = 0; $i<3; $i++) {
+ if (!oci_execute($s)) {
+ die("oci_execute(insert) failed!\n");
+ }
+}
+
+if (!oci_commit($c)) {
+ die("oci_commit() failed!\n");
+}
+
+$select_sql = "SELECT * FROM ".$schema.$table_name."";
+
+if (!($s = oci_parse($c, $select_sql))) {
+ die("oci_parse(select) failed!\n");
+}
+
+if (!oci_execute($s)) {
+ die("oci_execute(select) failed!\n");
+}
+
+while(ocifetch($s)) {
+ $i = 1;
+ while ($row = ociresult($s, $i)) {
+ $i++;
+ var_dump($row);
+ }
+}
+
+require dirname(__FILE__).'/drop_table.inc';
+
+echo "Done\n";
+?>
+--EXPECT--
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+string(1) "1"
+Done
diff --git a/ext/oci8/tests/fetch_all.phpt b/ext/oci8/tests/fetch_all.phpt
new file mode 100644
index 0000000000..49193ffc87
--- /dev/null
+++ b/ext/oci8/tests/fetch_all.phpt
@@ -0,0 +1,154 @@
+--TEST--
+oci_fetch_all()
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--ENV--
+return "
+ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
+NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
+";
+--FILE--
+<?php
+
+require dirname(__FILE__)."/connect.inc";
+require dirname(__FILE__).'/create_table.inc';
+
+$insert_sql = "INSERT INTO ".$schema."".$table_name." (id, value) VALUES (1,1)";
+
+if (!($s = oci_parse($c, $insert_sql))) {
+ die("oci_parse(insert) failed!\n");
+}
+
+for ($i = 0; $i<3; $i++) {
+ if (!oci_execute($s)) {
+ die("oci_execute(insert) failed!\n");
+ }
+}
+
+if (!oci_commit($c)) {
+ die("oci_commit() failed!\n");
+}
+
+$select_sql = "SELECT * FROM ".$schema."".$table_name."";
+
+if (!($s = oci_parse($c, $select_sql))) {
+ die("oci_parse(select) failed!\n");
+}
+
+/* oci_fetch_all */
+if (!oci_execute($s)) {
+ die("oci_execute(select) failed!\n");
+}
+var_dump(oci_fetch_all($s, $all));
+var_dump($all);
+
+/* ocifetchstatement */
+if (!oci_execute($s)) {
+ die("oci_execute(select) failed!\n");
+}
+
+var_dump(ocifetchstatement($s, $all));
+var_dump($all);
+
+require dirname(__FILE__).'/drop_table.inc';
+
+echo "Done\n";
+?>
+--EXPECT--
+int(3)
+array(5) {
+ ["ID"]=>
+ array(3) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(1) "1"
+ [2]=>
+ string(1) "1"
+ }
+ ["VALUE"]=>
+ array(3) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(1) "1"
+ [2]=>
+ string(1) "1"
+ }
+ ["BLOB"]=>
+ array(3) {
+ [0]=>
+ NULL
+ [1]=>
+ NULL
+ [2]=>
+ NULL
+ }
+ ["CLOB"]=>
+ array(3) {
+ [0]=>
+ NULL
+ [1]=>
+ NULL
+ [2]=>
+ NULL
+ }
+ ["STRING"]=>
+ array(3) {
+ [0]=>
+ NULL
+ [1]=>
+ NULL
+ [2]=>
+ NULL
+ }
+}
+int(3)
+array(5) {
+ ["ID"]=>
+ array(3) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(1) "1"
+ [2]=>
+ string(1) "1"
+ }
+ ["VALUE"]=>
+ array(3) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(1) "1"
+ [2]=>
+ string(1) "1"
+ }
+ ["BLOB"]=>
+ array(3) {
+ [0]=>
+ NULL
+ [1]=>
+ NULL
+ [2]=>
+ NULL
+ }
+ ["CLOB"]=>
+ array(3) {
+ [0]=>
+ NULL
+ [1]=>
+ NULL
+ [2]=>
+ NULL
+ }
+ ["STRING"]=>
+ array(3) {
+ [0]=>
+ NULL
+ [1]=>
+ NULL
+ [2]=>
+ NULL
+ }
+}
+Done
diff --git a/ext/oci8/tests/fetch_array.phpt b/ext/oci8/tests/fetch_array.phpt
new file mode 100644
index 0000000000..ada162453d
--- /dev/null
+++ b/ext/oci8/tests/fetch_array.phpt
@@ -0,0 +1,235 @@
+--TEST--
+oci_fetch_array()
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--ENV--
+return "
+ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
+NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
+";
+--FILE--
+<?php
+
+require dirname(__FILE__)."/connect.inc";
+require dirname(__FILE__).'/create_table.inc';
+
+$insert_sql = "INSERT INTO ".$schema."".$table_name." (id, value) VALUES (1,1)";
+
+if (!($s = oci_parse($c, $insert_sql))) {
+ die("oci_parse(insert) failed!\n");
+}
+
+for ($i = 0; $i<3; $i++) {
+ if (!oci_execute($s)) {
+ die("oci_execute(insert) failed!\n");
+ }
+}
+
+if (!oci_commit($c)) {
+ die("oci_commit() failed!\n");
+}
+
+$select_sql = "SELECT * FROM ".$schema."".$table_name."";
+
+if (!($s = oci_parse($c, $select_sql))) {
+ die("oci_parse(select) failed!\n");
+}
+
+if (!oci_execute($s)) {
+ die("oci_execute(select) failed!\n");
+}
+while ($row = oci_fetch_array($s)) {
+ var_dump($row);
+}
+
+if (!oci_execute($s)) {
+ die("oci_execute(select) failed!\n");
+}
+while ($row = oci_fetch_array($s, OCI_NUM)) {
+ var_dump($row);
+}
+
+if (!oci_execute($s)) {
+ die("oci_execute(select) failed!\n");
+}
+while ($row = oci_fetch_array($s, OCI_ASSOC)) {
+ var_dump($row);
+}
+
+if (!oci_execute($s)) {
+ die("oci_execute(select) failed!\n");
+}
+while ($row = oci_fetch_array($s, OCI_BOTH)) {
+ var_dump($row);
+}
+
+if (!oci_execute($s)) {
+ die("oci_execute(select) failed!\n");
+}
+while ($row = oci_fetch_array($s, OCI_RETURN_LOBS)) {
+ var_dump($row);
+}
+
+if (!oci_execute($s)) {
+ die("oci_execute(select) failed!\n");
+}
+while ($row = oci_fetch_array($s, OCI_RETURN_NULLS)) {
+ var_dump($row);
+}
+
+require dirname(__FILE__).'/drop_table.inc';
+
+echo "Done\n";
+?>
+--EXPECT--
+array(4) {
+ [0]=>
+ string(1) "1"
+ ["ID"]=>
+ string(1) "1"
+ [1]=>
+ string(1) "1"
+ ["VALUE"]=>
+ string(1) "1"
+}
+array(4) {
+ [0]=>
+ string(1) "1"
+ ["ID"]=>
+ string(1) "1"
+ [1]=>
+ string(1) "1"
+ ["VALUE"]=>
+ string(1) "1"
+}
+array(4) {
+ [0]=>
+ string(1) "1"
+ ["ID"]=>
+ string(1) "1"
+ [1]=>
+ string(1) "1"
+ ["VALUE"]=>
+ string(1) "1"
+}
+array(2) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(1) "1"
+}
+array(2) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(1) "1"
+}
+array(2) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(1) "1"
+}
+array(2) {
+ ["ID"]=>
+ string(1) "1"
+ ["VALUE"]=>
+ string(1) "1"
+}
+array(2) {
+ ["ID"]=>
+ string(1) "1"
+ ["VALUE"]=>
+ string(1) "1"
+}
+array(2) {
+ ["ID"]=>
+ string(1) "1"
+ ["VALUE"]=>
+ string(1) "1"
+}
+array(4) {
+ [0]=>
+ string(1) "1"
+ ["ID"]=>
+ string(1) "1"
+ [1]=>
+ string(1) "1"
+ ["VALUE"]=>
+ string(1) "1"
+}
+array(4) {
+ [0]=>
+ string(1) "1"
+ ["ID"]=>
+ string(1) "1"
+ [1]=>
+ string(1) "1"
+ ["VALUE"]=>
+ string(1) "1"
+}
+array(4) {
+ [0]=>
+ string(1) "1"
+ ["ID"]=>
+ string(1) "1"
+ [1]=>
+ string(1) "1"
+ ["VALUE"]=>
+ string(1) "1"
+}
+array(2) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(1) "1"
+}
+array(2) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(1) "1"
+}
+array(2) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(1) "1"
+}
+array(5) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(1) "1"
+ [2]=>
+ NULL
+ [3]=>
+ NULL
+ [4]=>
+ NULL
+}
+array(5) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(1) "1"
+ [2]=>
+ NULL
+ [3]=>
+ NULL
+ [4]=>
+ NULL
+}
+array(5) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(1) "1"
+ [2]=>
+ NULL
+ [3]=>
+ NULL
+ [4]=>
+ NULL
+}
+Done
diff --git a/ext/oci8/tests/fetch_assoc.phpt b/ext/oci8/tests/fetch_assoc.phpt
new file mode 100644
index 0000000000..9b6866a100
--- /dev/null
+++ b/ext/oci8/tests/fetch_assoc.phpt
@@ -0,0 +1,69 @@
+--TEST--
+oci_fetch_assoc()
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--ENV--
+return "
+ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
+NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
+";
+--FILE--
+<?php
+
+require dirname(__FILE__)."/connect.inc";
+require dirname(__FILE__).'/create_table.inc';
+
+$insert_sql = "INSERT INTO ".$schema."".$table_name." (id, value) VALUES (1,1)";
+
+if (!($s = oci_parse($c, $insert_sql))) {
+ die("oci_parse(insert) failed!\n");
+}
+
+for ($i = 0; $i<3; $i++) {
+ if (!oci_execute($s)) {
+ die("oci_execute(insert) failed!\n");
+ }
+}
+
+if (!oci_commit($c)) {
+ die("oci_commit() failed!\n");
+}
+
+$select_sql = "SELECT * FROM ".$schema."".$table_name."";
+
+if (!($s = oci_parse($c, $select_sql))) {
+ die("oci_parse(select) failed!\n");
+}
+
+if (!oci_execute($s)) {
+ die("oci_execute(select) failed!\n");
+}
+while ($row = oci_fetch_assoc($s)) {
+ var_dump($row);
+}
+
+require dirname(__FILE__).'/drop_table.inc';
+
+echo "Done\n";
+
+?>
+--EXPECT--
+array(2) {
+ ["ID"]=>
+ string(1) "1"
+ ["VALUE"]=>
+ string(1) "1"
+}
+array(2) {
+ ["ID"]=>
+ string(1) "1"
+ ["VALUE"]=>
+ string(1) "1"
+}
+array(2) {
+ ["ID"]=>
+ string(1) "1"
+ ["VALUE"]=>
+ string(1) "1"
+}
+Done
diff --git a/ext/oci8/tests/fetch_into.phpt b/ext/oci8/tests/fetch_into.phpt
new file mode 100644
index 0000000000..4953a25026
--- /dev/null
+++ b/ext/oci8/tests/fetch_into.phpt
@@ -0,0 +1,87 @@
+--TEST--
+ocifetchinto()
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--ENV--
+return "
+ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
+NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
+";
+--FILE--
+<?php
+
+require dirname(__FILE__)."/connect.inc";
+require dirname(__FILE__).'/create_table.inc';
+
+$insert_sql = "INSERT INTO ".$schema."".$table_name." (id, value) VALUES (1,1)";
+
+if (!($s = oci_parse($c, $insert_sql))) {
+ die("oci_parse(insert) failed!\n");
+}
+
+for ($i = 0; $i<3; $i++) {
+ if (!oci_execute($s)) {
+ die("oci_execute(insert) failed!\n");
+ }
+}
+
+if (!oci_commit($c)) {
+ die("oci_commit() failed!\n");
+}
+
+$select_sql = "SELECT * FROM ".$schema."".$table_name."";
+
+if (!($s = oci_parse($c, $select_sql))) {
+ die("oci_parse(select) failed!\n");
+}
+
+/* oci_fetch_all */
+if (!oci_execute($s)) {
+ die("oci_execute(select) failed!\n");
+}
+var_dump(ocifetchinto($s, $all));
+var_dump($all);
+
+/* oci_fetch_all */
+if (!oci_execute($s)) {
+ die("oci_execute(select) failed!\n");
+}
+var_dump(ocifetchinto($s, $all, OCI_NUM+OCI_ASSOC+OCI_RETURN_NULLS+OCI_RETURN_LOBS));
+var_dump($all);
+
+require dirname(__FILE__).'/drop_table.inc';
+
+echo "Done\n";
+?>
+--EXPECT--
+int(5)
+array(2) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(1) "1"
+}
+int(5)
+array(10) {
+ [0]=>
+ string(1) "1"
+ ["ID"]=>
+ string(1) "1"
+ [1]=>
+ string(1) "1"
+ ["VALUE"]=>
+ string(1) "1"
+ [2]=>
+ NULL
+ ["BLOB"]=>
+ NULL
+ [3]=>
+ NULL
+ ["CLOB"]=>
+ NULL
+ [4]=>
+ NULL
+ ["STRING"]=>
+ NULL
+}
+Done
diff --git a/ext/oci8/tests/fetch_into1.phpt b/ext/oci8/tests/fetch_into1.phpt
new file mode 100644
index 0000000000..91d02e3d5c
--- /dev/null
+++ b/ext/oci8/tests/fetch_into1.phpt
@@ -0,0 +1,197 @@
+--TEST--
+various ocifetchinto() tests
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--ENV--
+return "
+ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
+NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
+";
+--FILE--
+<?php
+
+require dirname(__FILE__)."/connect.inc";
+require dirname(__FILE__).'/create_table.inc';
+
+$insert_sql = "INSERT INTO ".$schema."".$table_name." (id, value, string) VALUES (1, 1, NULL)";
+
+if (!($s = oci_parse($c, $insert_sql))) {
+ die("oci_parse(insert) failed!\n");
+}
+
+for ($i = 0; $i<20; $i++) {
+ if (!oci_execute($s)) {
+ die("oci_execute(insert) failed!\n");
+ }
+}
+
+if (!oci_commit($c)) {
+ die("oci_commit() failed!\n");
+}
+
+$select_sql = "SELECT * FROM ".$schema."".$table_name."";
+
+if (!($s = oci_parse($c, $select_sql))) {
+ die("oci_parse(select) failed!\n");
+}
+
+if (!oci_execute($s)) {
+ die("oci_execute(select) failed!\n");
+}
+var_dump(ocifetchinto($s, $all, OCI_NUM));
+var_dump($all);
+var_dump(ocifetchinto($s, $all, OCI_ASSOC));
+var_dump($all);
+var_dump(ocifetchinto($s, $all, OCI_RETURN_NULLS));
+var_dump($all);
+var_dump(ocifetchinto($s, $all, OCI_RETURN_LOBS));
+var_dump($all);
+var_dump(ocifetchinto($s, $all, OCI_NUM+OCI_ASSOC));
+var_dump($all);
+var_dump(ocifetchinto($s, $all, OCI_NUM+OCI_ASSOC+OCI_RETURN_NULLS));
+var_dump($all);
+var_dump(ocifetchinto($s, $all, OCI_NUM+OCI_ASSOC+OCI_RETURN_NULLS+OCI_RETURN_LOBS));
+var_dump($all);
+var_dump(ocifetchinto($s, $all, OCI_RETURN_NULLS+OCI_RETURN_LOBS));
+var_dump($all);
+var_dump(ocifetchinto($s, $all, OCI_ASSOC+OCI_RETURN_NULLS+OCI_RETURN_LOBS));
+var_dump($all);
+var_dump(ocifetchinto($s, $all, OCI_NUM+OCI_RETURN_NULLS+OCI_RETURN_LOBS));
+var_dump($all);
+
+require dirname(__FILE__).'/drop_table.inc';
+
+echo "Done\n";
+?>
+--EXPECT--
+int(5)
+array(2) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(1) "1"
+}
+int(5)
+array(2) {
+ ["ID"]=>
+ string(1) "1"
+ ["VALUE"]=>
+ string(1) "1"
+}
+int(5)
+array(5) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(1) "1"
+ [2]=>
+ NULL
+ [3]=>
+ NULL
+ [4]=>
+ NULL
+}
+int(5)
+array(2) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(1) "1"
+}
+int(5)
+array(4) {
+ [0]=>
+ string(1) "1"
+ ["ID"]=>
+ string(1) "1"
+ [1]=>
+ string(1) "1"
+ ["VALUE"]=>
+ string(1) "1"
+}
+int(5)
+array(10) {
+ [0]=>
+ string(1) "1"
+ ["ID"]=>
+ string(1) "1"
+ [1]=>
+ string(1) "1"
+ ["VALUE"]=>
+ string(1) "1"
+ [2]=>
+ NULL
+ ["BLOB"]=>
+ NULL
+ [3]=>
+ NULL
+ ["CLOB"]=>
+ NULL
+ [4]=>
+ NULL
+ ["STRING"]=>
+ NULL
+}
+int(5)
+array(10) {
+ [0]=>
+ string(1) "1"
+ ["ID"]=>
+ string(1) "1"
+ [1]=>
+ string(1) "1"
+ ["VALUE"]=>
+ string(1) "1"
+ [2]=>
+ NULL
+ ["BLOB"]=>
+ NULL
+ [3]=>
+ NULL
+ ["CLOB"]=>
+ NULL
+ [4]=>
+ NULL
+ ["STRING"]=>
+ NULL
+}
+int(5)
+array(5) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(1) "1"
+ [2]=>
+ NULL
+ [3]=>
+ NULL
+ [4]=>
+ NULL
+}
+int(5)
+array(5) {
+ ["ID"]=>
+ string(1) "1"
+ ["VALUE"]=>
+ string(1) "1"
+ ["BLOB"]=>
+ NULL
+ ["CLOB"]=>
+ NULL
+ ["STRING"]=>
+ NULL
+}
+int(5)
+array(5) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(1) "1"
+ [2]=>
+ NULL
+ [3]=>
+ NULL
+ [4]=>
+ NULL
+}
+Done
diff --git a/ext/oci8/tests/fetch_into2.phpt b/ext/oci8/tests/fetch_into2.phpt
new file mode 100644
index 0000000000..27c137b429
--- /dev/null
+++ b/ext/oci8/tests/fetch_into2.phpt
@@ -0,0 +1,75 @@
+--TEST--
+ocifetchinto() & wrong number of params
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--ENV--
+return "
+ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
+NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
+";
+--FILE--
+<?php
+
+require dirname(__FILE__)."/connect.inc";
+require dirname(__FILE__).'/create_table.inc';
+
+$insert_sql = "INSERT INTO ".$schema."".$table_name." (id, value, string) VALUES (1, 1, NULL)";
+
+if (!($s = oci_parse($c, $insert_sql))) {
+ die("oci_parse(insert) failed!\n");
+}
+
+for ($i = 0; $i<20; $i++) {
+ if (!oci_execute($s)) {
+ die("oci_execute(insert) failed!\n");
+ }
+}
+
+if (!oci_commit($c)) {
+ die("oci_commit() failed!\n");
+}
+
+$select_sql = "SELECT * FROM ".$schema."".$table_name."";
+
+if (!($s = oci_parse($c, $select_sql))) {
+ die("oci_parse(select) failed!\n");
+}
+
+if (!oci_execute($s)) {
+ die("oci_execute(select) failed!\n");
+}
+var_dump(ocifetchinto($s));
+var_dump($all);
+var_dump(ocifetchinto($s, $all, OCI_ASSOC, 5));
+var_dump($all);
+var_dump(ocifetchinto($c, $all, OCI_RETURN_LOBS));
+var_dump($all);
+var_dump(ocifetchinto($s, $all, 1000000));
+var_dump($all);
+
+require dirname(__FILE__).'/drop_table.inc';
+
+echo "Done\n";
+?>
+--EXPECTF--
+Warning: ocifetchinto() expects at least 2 parameters, 1 given in %s on line %d
+NULL
+
+Notice: Undefined variable: all in %s on line %d
+NULL
+
+Warning: ocifetchinto() expects at most 3 parameters, 4 given in %s on line %d
+NULL
+NULL
+
+Warning: ocifetchinto(): supplied resource is not a valid oci8 statement resource in %s on line %d
+bool(false)
+NULL
+int(5)
+array(2) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(1) "1"
+}
+Done
diff --git a/ext/oci8/tests/fetch_object.phpt b/ext/oci8/tests/fetch_object.phpt
new file mode 100644
index 0000000000..2df0480a39
--- /dev/null
+++ b/ext/oci8/tests/fetch_object.phpt
@@ -0,0 +1,69 @@
+--TEST--
+oci_fetch_object()
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--ENV--
+return "
+ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
+NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
+";
+--FILE--
+<?php
+
+require dirname(__FILE__)."/connect.inc";
+require dirname(__FILE__).'/create_table.inc';
+
+$insert_sql = "INSERT INTO ".$schema."".$table_name." (id, value) VALUES (1,1)";
+
+if (!($s = oci_parse($c, $insert_sql))) {
+ die("oci_parse(insert) failed!\n");
+}
+
+for ($i = 0; $i<3; $i++) {
+ if (!oci_execute($s)) {
+ die("oci_execute(insert) failed!\n");
+ }
+}
+
+if (!oci_commit($c)) {
+ die("oci_commit() failed!\n");
+}
+
+$select_sql = "SELECT * FROM ".$schema."".$table_name."";
+
+if (!($s = oci_parse($c, $select_sql))) {
+ die("oci_parse(select) failed!\n");
+}
+
+if (!oci_execute($s)) {
+ die("oci_execute(select) failed!\n");
+}
+while ($row = oci_fetch_object($s)) {
+ var_dump($row);
+}
+
+require dirname(__FILE__).'/drop_table.inc';
+
+echo "Done\n";
+
+?>
+--EXPECT--
+object(stdClass)#1 (2) {
+ ["ID"]=>
+ string(1) "1"
+ ["VALUE"]=>
+ string(1) "1"
+}
+object(stdClass)#2 (2) {
+ ["ID"]=>
+ string(1) "1"
+ ["VALUE"]=>
+ string(1) "1"
+}
+object(stdClass)#1 (2) {
+ ["ID"]=>
+ string(1) "1"
+ ["VALUE"]=>
+ string(1) "1"
+}
+Done
diff --git a/ext/oci8/tests/fetch_row.phpt b/ext/oci8/tests/fetch_row.phpt
new file mode 100644
index 0000000000..a2c0e883a0
--- /dev/null
+++ b/ext/oci8/tests/fetch_row.phpt
@@ -0,0 +1,69 @@
+--TEST--
+oci_fetch_row()
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--ENV--
+return "
+ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
+NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
+";
+--FILE--
+<?php
+
+require dirname(__FILE__)."/connect.inc";
+require dirname(__FILE__).'/create_table.inc';
+
+$insert_sql = "INSERT INTO ".$schema."".$table_name." (id, value) VALUES (1,1)";
+
+if (!($s = oci_parse($c, $insert_sql))) {
+ die("oci_parse(insert) failed!\n");
+}
+
+for ($i = 0; $i<3; $i++) {
+ if (!oci_execute($s)) {
+ die("oci_execute(insert) failed!\n");
+ }
+}
+
+if (!oci_commit($c)) {
+ die("oci_commit() failed!\n");
+}
+
+$select_sql = "SELECT * FROM ".$schema."".$table_name."";
+
+if (!($s = oci_parse($c, $select_sql))) {
+ die("oci_parse(select) failed!\n");
+}
+
+if (!oci_execute($s)) {
+ die("oci_execute(select) failed!\n");
+}
+while ($row = oci_fetch_row($s)) {
+ var_dump($row);
+}
+
+require dirname(__FILE__).'/drop_table.inc';
+
+echo "Done\n";
+
+?>
+--EXPECT--
+array(2) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(1) "1"
+}
+array(2) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(1) "1"
+}
+array(2) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(1) "1"
+}
+Done
diff --git a/ext/oci8/tests/field_funcs.phpt b/ext/oci8/tests/field_funcs.phpt
new file mode 100644
index 0000000000..bba6632e86
--- /dev/null
+++ b/ext/oci8/tests/field_funcs.phpt
@@ -0,0 +1,110 @@
+--TEST--
+oci_field_*() family
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--ENV--
+return "
+ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
+NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
+";
+--FILE--
+<?php
+
+require dirname(__FILE__)."/connect.inc";
+require dirname(__FILE__).'/create_table.inc';
+
+$insert_sql = "INSERT INTO ".$schema."".$table_name." (id, value) VALUES (1,1)";
+
+if (!($s = oci_parse($c, $insert_sql))) {
+ die("oci_parse(insert) failed!\n");
+}
+
+for ($i = 0; $i<3; $i++) {
+ if (!oci_execute($s)) {
+ die("oci_execute(insert) failed!\n");
+ }
+}
+
+if (!oci_commit($c)) {
+ die("oci_commit() failed!\n");
+}
+
+$select_sql = "SELECT * FROM ".$schema."".$table_name."";
+
+if (!($s = oci_parse($c, $select_sql))) {
+ die("oci_parse(select) failed!\n");
+}
+
+if (!oci_execute($s)) {
+ die("oci_execute(select) failed!\n");
+}
+
+$row = oci_fetch_array($s, OCI_RETURN_NULLS + OCI_RETURN_LOBS);
+var_dump($row);
+
+foreach ($row as $num => $field) {
+ $num++;
+ var_dump(oci_field_is_null($s, $num));
+ var_dump(oci_field_name($s, $num));
+ var_dump(oci_field_type($s, $num));
+ var_dump(oci_field_type_raw($s, $num));
+ var_dump(oci_field_scale($s, $num));
+ var_dump(oci_field_precision($s, $num));
+ var_dump(oci_field_size($s, $num));
+}
+
+
+require dirname(__FILE__).'/drop_table.inc';
+
+echo "Done\n";
+
+?>
+--EXPECT--
+array(5) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(1) "1"
+ [2]=>
+ NULL
+ [3]=>
+ NULL
+ [4]=>
+ NULL
+}
+bool(false)
+string(2) "ID"
+string(6) "NUMBER"
+int(2)
+int(0)
+int(0)
+int(22)
+bool(false)
+string(5) "VALUE"
+string(6) "NUMBER"
+int(2)
+int(0)
+int(0)
+int(22)
+bool(true)
+string(4) "BLOB"
+string(4) "BLOB"
+int(113)
+int(0)
+int(0)
+int(4000)
+bool(true)
+string(4) "CLOB"
+string(4) "CLOB"
+int(112)
+int(0)
+int(0)
+int(4000)
+bool(true)
+string(6) "STRING"
+string(7) "VARCHAR"
+int(1)
+int(0)
+int(0)
+int(10)
+Done
diff --git a/ext/oci8/tests/field_funcs_old.phpt b/ext/oci8/tests/field_funcs_old.phpt
new file mode 100644
index 0000000000..c5339a7502
--- /dev/null
+++ b/ext/oci8/tests/field_funcs_old.phpt
@@ -0,0 +1,110 @@
+--TEST--
+ocicolumn*() family
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--ENV--
+return "
+ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
+NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
+";
+--FILE--
+<?php
+
+require dirname(__FILE__)."/connect.inc";
+require dirname(__FILE__).'/create_table.inc';
+
+$insert_sql = "INSERT INTO ".$schema."".$table_name." (id, value) VALUES (1,1)";
+
+if (!($s = ociparse($c, $insert_sql))) {
+ die("ociparse(insert) failed!\n");
+}
+
+for ($i = 0; $i<3; $i++) {
+ if (!ociexecute($s)) {
+ die("ociexecute(insert) failed!\n");
+ }
+}
+
+if (!ocicommit($c)) {
+ die("ocicommit() failed!\n");
+}
+
+$select_sql = "SELECT * FROM ".$schema."".$table_name."";
+
+if (!($s = ociparse($c, $select_sql))) {
+ die("ociparse(select) failed!\n");
+}
+
+if (!ociexecute($s)) {
+ die("ociexecute(select) failed!\n");
+}
+
+ocifetchinto($s, $row, OCI_NUM + OCI_RETURN_NULLS + OCI_RETURN_LOBS);
+var_dump($row);
+
+foreach ($row as $num => $field) {
+ $num++;
+ var_dump(ocicolumnisnull($s, $num));
+ var_dump(ocicolumnname($s, $num));
+ var_dump(ocicolumntype($s, $num));
+ var_dump(ocicolumntyperaw($s, $num));
+ var_dump(ocicolumnscale($s, $num));
+ var_dump(ocicolumnprecision($s, $num));
+ var_dump(ocicolumnsize($s, $num));
+}
+
+
+require dirname(__FILE__).'/drop_table.inc';
+
+echo "Done\n";
+
+?>
+--EXPECT--
+array(5) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(1) "1"
+ [2]=>
+ NULL
+ [3]=>
+ NULL
+ [4]=>
+ NULL
+}
+bool(false)
+string(2) "ID"
+string(6) "NUMBER"
+int(2)
+int(0)
+int(0)
+int(22)
+bool(false)
+string(5) "VALUE"
+string(6) "NUMBER"
+int(2)
+int(0)
+int(0)
+int(22)
+bool(true)
+string(4) "BLOB"
+string(4) "BLOB"
+int(113)
+int(0)
+int(0)
+int(4000)
+bool(true)
+string(4) "CLOB"
+string(4) "CLOB"
+int(112)
+int(0)
+int(0)
+int(4000)
+bool(true)
+string(6) "STRING"
+string(7) "VARCHAR"
+int(1)
+int(0)
+int(0)
+int(10)
+Done
diff --git a/ext/oci8/tests/lob_001.phpt b/ext/oci8/tests/lob_001.phpt
new file mode 100644
index 0000000000..405b2b814c
--- /dev/null
+++ b/ext/oci8/tests/lob_001.phpt
Binary files differ
diff --git a/ext/oci8/tests/lob_002.phpt b/ext/oci8/tests/lob_002.phpt
new file mode 100644
index 0000000000..c414905f39
--- /dev/null
+++ b/ext/oci8/tests/lob_002.phpt
@@ -0,0 +1,71 @@
+--TEST--
+oci_lob_write() and friends (with errors)
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--ENV--
+return "
+ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
+NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
+";
+--FILE--
+<?php
+
+require dirname(__FILE__).'/connect.inc';
+require dirname(__FILE__).'/create_table.inc';
+
+$ora_sql = "INSERT INTO
+ ".$schema.$table_name." (blob)
+ VALUES (empty_blob())
+ RETURNING
+ blob
+ INTO :v_blob ";
+
+$statement = oci_parse($c,$ora_sql);
+$blob = oci_new_descriptor($c,OCI_D_LOB);
+oci_bind_by_name($statement,":v_blob", $blob,-1,OCI_B_BLOB);
+oci_execute($statement, OCI_DEFAULT);
+
+var_dump($blob);
+
+var_dump($blob->write("test", -1));
+var_dump($blob->write("test", "str"));
+var_dump($blob->write("test", 1000000));
+var_dump($blob->write(str_repeat("test", 10000), 1000000));
+var_dump($blob->tell());
+var_dump($blob->seek("str", -5));
+var_dump($blob->flush());
+
+oci_commit($c);
+
+$select_sql = "SELECT blob FROM ".$schema.$table_name."";
+$s = oci_parse($c, $select_sql);
+oci_execute($s);
+
+$row = oci_fetch_array($s, OCI_RETURN_LOBS);
+
+var_dump(strlen($row[0]));
+
+
+require dirname(__FILE__).'/drop_table.inc';
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+object(OCI-Lob)#%d (1) {
+ ["descriptor"]=>
+ resource(%d) of type (oci8 descriptor)
+}
+int(0)
+
+Warning: OCI-Lob::write() expects parameter 2 to be long, string given in %slob_002.php on line %d
+NULL
+int(4)
+int(40000)
+int(40004)
+
+Warning: OCI-Lob::seek() expects parameter 1 to be long, string given in %slob_002.php on line %d
+NULL
+bool(false)
+int(40004)
+Done
diff --git a/ext/oci8/tests/lob_003.phpt b/ext/oci8/tests/lob_003.phpt
new file mode 100644
index 0000000000..76f1a7e4b0
--- /dev/null
+++ b/ext/oci8/tests/lob_003.phpt
Binary files differ
diff --git a/ext/oci8/tests/lob_004.phpt b/ext/oci8/tests/lob_004.phpt
new file mode 100644
index 0000000000..56ccfbcd4a
--- /dev/null
+++ b/ext/oci8/tests/lob_004.phpt
@@ -0,0 +1,85 @@
+--TEST--
+oci_lob_seek()/rewind()/append()
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--ENV--
+return "
+ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
+NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
+";
+--FILE--
+<?php
+
+require dirname(__FILE__).'/connect.inc';
+require dirname(__FILE__).'/create_table.inc';
+
+$ora_sql = "INSERT INTO
+ ".$schema.$table_name." (blob)
+ VALUES (empty_blob())
+ RETURNING
+ blob
+ INTO :v_blob ";
+
+$statement = oci_parse($c,$ora_sql);
+$blob = oci_new_descriptor($c,OCI_D_LOB);
+oci_bind_by_name($statement,":v_blob", $blob,-1,OCI_B_BLOB);
+oci_execute($statement, OCI_DEFAULT);
+
+var_dump($blob);
+
+var_dump($blob->write("test"));
+var_dump($blob->rewind());
+var_dump($blob->write("str"));
+var_dump($blob->seek(10, OCI_SEEK_SET));
+
+oci_commit($c);
+
+$select_sql = "SELECT blob FROM ".$schema.$table_name." FOR UPDATE";
+$s = oci_parse($c, $select_sql);
+oci_execute($s, OCI_DEFAULT);
+
+var_dump($row = oci_fetch_array($s));
+
+var_dump($row[0]->append($blob));
+var_dump($row[0]->read(10000));
+
+oci_commit($c);
+
+$select_sql = "SELECT blob FROM ".$schema.$table_name." FOR UPDATE";
+$s = oci_parse($c, $select_sql);
+oci_execute($s, OCI_DEFAULT);
+
+$row = oci_fetch_array($s);
+
+var_dump($row[0]->read(10000));
+
+require dirname(__FILE__).'/drop_table.inc';
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+object(OCI-Lob)#%d (1) {
+ ["descriptor"]=>
+ resource(%d) of type (oci8 descriptor)
+}
+int(4)
+bool(true)
+int(3)
+bool(true)
+array(2) {
+ [0]=>
+ object(OCI-Lob)#%d (1) {
+ ["descriptor"]=>
+ resource(%d) of type (oci8 descriptor)
+ }
+ ["BLOB"]=>
+ object(OCI-Lob)#%d (1) {
+ ["descriptor"]=>
+ resource(%d) of type (oci8 descriptor)
+ }
+}
+bool(true)
+string(4) "strt"
+string(8) "strtstrt"
+Done
diff --git a/ext/oci8/tests/lob_005.phpt b/ext/oci8/tests/lob_005.phpt
new file mode 100644
index 0000000000..d82400e47e
--- /dev/null
+++ b/ext/oci8/tests/lob_005.phpt
@@ -0,0 +1,57 @@
+--TEST--
+oci_lob_is_equal()
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--ENV--
+return "
+ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
+NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
+";
+--FILE--
+<?php
+
+require dirname(__FILE__).'/connect.inc';
+require dirname(__FILE__).'/create_table.inc';
+
+$ora_sql = "INSERT INTO
+ ".$schema.$table_name." (blob)
+ VALUES (empty_blob())
+ RETURNING
+ blob
+ INTO :v_blob ";
+
+$statement = oci_parse($c,$ora_sql);
+$blob = oci_new_descriptor($c,OCI_D_LOB);
+oci_bind_by_name($statement,":v_blob", $blob,-1,OCI_B_BLOB);
+oci_execute($statement, OCI_DEFAULT);
+
+oci_commit($c);
+
+$select_sql = "SELECT blob FROM ".$schema.$table_name." FOR UPDATE";
+$s = oci_parse($c, $select_sql);
+oci_execute($s, OCI_DEFAULT);
+
+var_dump($row = oci_fetch_array($s));
+
+var_dump(oci_lob_is_equal($row[0], $row['BLOB']));
+
+require dirname(__FILE__).'/drop_table.inc';
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+array(2) {
+ [0]=>
+ object(OCI-Lob)#%d (1) {
+ ["descriptor"]=>
+ resource(%d) of type (oci8 descriptor)
+ }
+ ["BLOB"]=>
+ object(OCI-Lob)#%d (1) {
+ ["descriptor"]=>
+ resource(%d) of type (oci8 descriptor)
+ }
+}
+bool(true)
+Done
diff --git a/ext/oci8/tests/lob_006.phpt b/ext/oci8/tests/lob_006.phpt
new file mode 100644
index 0000000000..321d948b1a
--- /dev/null
+++ b/ext/oci8/tests/lob_006.phpt
Binary files differ
diff --git a/ext/oci8/tests/lob_007.phpt b/ext/oci8/tests/lob_007.phpt
new file mode 100644
index 0000000000..0f2920414f
--- /dev/null
+++ b/ext/oci8/tests/lob_007.phpt
@@ -0,0 +1,71 @@
+--TEST--
+oci_lob_write()/size()/load()
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--ENV--
+return "
+ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
+NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
+";
+--FILE--
+<?php
+
+require dirname(__FILE__).'/connect.inc';
+require dirname(__FILE__).'/create_table.inc';
+
+$ora_sql = "INSERT INTO
+ ".$schema.$table_name." (blob)
+ VALUES (empty_blob())
+ RETURNING
+ blob
+ INTO :v_blob ";
+
+$statement = oci_parse($c,$ora_sql);
+$blob = oci_new_descriptor($c,OCI_D_LOB);
+oci_bind_by_name($statement,":v_blob", $blob,-1,OCI_B_BLOB);
+oci_execute($statement, OCI_DEFAULT);
+
+var_dump($blob);
+
+var_dump($blob->size());
+var_dump($blob->write(str_repeat("string.", 1000)));
+var_dump($blob->size());
+oci_commit($c);
+
+$select_sql = "SELECT blob FROM ".$schema.$table_name." FOR UPDATE";
+$s = oci_parse($c, $select_sql);
+oci_execute($s, OCI_DEFAULT);
+
+var_dump($row = oci_fetch_array($s));
+
+var_dump($row[0]->size());
+var_dump(strlen($row[0]->load()));
+
+require dirname(__FILE__).'/drop_table.inc';
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+object(OCI-Lob)#%d (1) {
+ ["descriptor"]=>
+ resource(%d) of type (oci8 descriptor)
+}
+int(0)
+int(7000)
+int(7000)
+array(2) {
+ [0]=>
+ object(OCI-Lob)#%d (1) {
+ ["descriptor"]=>
+ resource(%d) of type (oci8 descriptor)
+ }
+ ["BLOB"]=>
+ object(OCI-Lob)#%d (1) {
+ ["descriptor"]=>
+ resource(%d) of type (oci8 descriptor)
+ }
+}
+int(7000)
+int(7000)
+Done
diff --git a/ext/oci8/tests/lob_008.phpt b/ext/oci8/tests/lob_008.phpt
new file mode 100644
index 0000000000..a0b4a557df
--- /dev/null
+++ b/ext/oci8/tests/lob_008.phpt
@@ -0,0 +1,70 @@
+--TEST--
+oci_lob_write()/read()/eof()
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--ENV--
+return "
+ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
+NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
+";
+--FILE--
+<?php
+
+require dirname(__FILE__).'/connect.inc';
+require dirname(__FILE__).'/create_table.inc';
+
+$ora_sql = "INSERT INTO
+ ".$schema.$table_name." (blob)
+ VALUES (empty_blob())
+ RETURNING
+ blob
+ INTO :v_blob ";
+
+$statement = oci_parse($c,$ora_sql);
+$blob = oci_new_descriptor($c,OCI_D_LOB);
+oci_bind_by_name($statement,":v_blob", $blob,-1,OCI_B_BLOB);
+oci_execute($statement, OCI_DEFAULT);
+
+var_dump($blob);
+
+var_dump($blob->write(str_repeat("string.", 1000)));
+oci_commit($c);
+
+$select_sql = "SELECT blob FROM ".$schema.$table_name." FOR UPDATE";
+$s = oci_parse($c, $select_sql);
+oci_execute($s, OCI_DEFAULT);
+
+var_dump($row = oci_fetch_array($s));
+
+
+$len = 0;
+while (!$row[0]->eof()) {
+ $len += strlen($row[0]->read(1024));
+}
+var_dump($len);
+
+require dirname(__FILE__).'/drop_table.inc';
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+object(OCI-Lob)#%d (1) {
+ ["descriptor"]=>
+ resource(%d) of type (oci8 descriptor)
+}
+int(7000)
+array(2) {
+ [0]=>
+ object(OCI-Lob)#%d (1) {
+ ["descriptor"]=>
+ resource(%d) of type (oci8 descriptor)
+ }
+ ["BLOB"]=>
+ object(OCI-Lob)#%d (1) {
+ ["descriptor"]=>
+ resource(%d) of type (oci8 descriptor)
+ }
+}
+int(7000)
+Done
diff --git a/ext/oci8/tests/lob_009.phpt b/ext/oci8/tests/lob_009.phpt
new file mode 100644
index 0000000000..9b467dd12a
--- /dev/null
+++ b/ext/oci8/tests/lob_009.phpt
@@ -0,0 +1,74 @@
+--TEST--
+oci_lob_import()/read()
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--ENV--
+return "
+ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
+NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
+";
+--FILE--
+<?php
+
+require dirname(__FILE__).'/connect.inc';
+require dirname(__FILE__).'/create_table.inc';
+
+$ora_sql = "INSERT INTO
+ ".$schema.$table_name." (blob)
+ VALUES (empty_blob())
+ RETURNING
+ blob
+ INTO :v_blob ";
+
+$statement = oci_parse($c,$ora_sql);
+$blob = oci_new_descriptor($c,OCI_D_LOB);
+oci_bind_by_name($statement,":v_blob", $blob,-1,OCI_B_BLOB);
+oci_execute($statement, OCI_DEFAULT);
+
+var_dump($blob);
+var_dump($blob->seek(10, OCI_SEEK_CUR));
+var_dump($blob->import(dirname(__FILE__)."/lob_009.txt"));
+oci_commit($c);
+
+$select_sql = "SELECT blob FROM ".$schema.$table_name." FOR UPDATE";
+$s = oci_parse($c, $select_sql);
+oci_execute($s, OCI_DEFAULT);
+
+var_dump($row = oci_fetch_array($s));
+
+while (!$row[0]->eof()) {
+ var_dump($row[0]->read(1024));
+}
+
+require dirname(__FILE__).'/drop_table.inc';
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+object(OCI-Lob)#%d (1) {
+ ["descriptor"]=>
+ resource(%d) of type (oci8 descriptor)
+}
+bool(true)
+bool(true)
+array(2) {
+ [0]=>
+ object(OCI-Lob)#%d (1) {
+ ["descriptor"]=>
+ resource(%d) of type (oci8 descriptor)
+ }
+ ["BLOB"]=>
+ object(OCI-Lob)#%d (1) {
+ ["descriptor"]=>
+ resource(%d) of type (oci8 descriptor)
+ }
+}
+string(43) "this
+is
+a
+test
+file for
+test lob_009.phpt
+"
+Done
diff --git a/ext/oci8/tests/lob_009.txt b/ext/oci8/tests/lob_009.txt
new file mode 100644
index 0000000000..f57bc8af37
--- /dev/null
+++ b/ext/oci8/tests/lob_009.txt
@@ -0,0 +1,6 @@
+this
+is
+a
+test
+file for
+test lob_009.phpt
diff --git a/ext/oci8/tests/lob_010.phpt b/ext/oci8/tests/lob_010.phpt
new file mode 100644
index 0000000000..85d37dc738
--- /dev/null
+++ b/ext/oci8/tests/lob_010.phpt
@@ -0,0 +1,51 @@
+--TEST--
+oci_lob_save()
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--ENV--
+return "
+ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
+NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
+";
+--FILE--
+<?php
+
+require dirname(__FILE__).'/connect.inc';
+require dirname(__FILE__).'/create_table.inc';
+
+$ora_sql = "INSERT INTO
+ ".$schema.$table_name." (blob)
+ VALUES (empty_blob())
+ RETURNING
+ blob
+ INTO :v_blob ";
+
+$statement = oci_parse($c,$ora_sql);
+$blob = oci_new_descriptor($c,OCI_D_LOB);
+oci_bind_by_name($statement,":v_blob", $blob,-1,OCI_B_BLOB);
+oci_execute($statement, OCI_DEFAULT);
+
+var_dump($blob->save("string"));
+var_dump($blob->save("string", 3));
+oci_commit($c);
+
+$select_sql = "SELECT blob FROM ".$schema.$table_name." FOR UPDATE";
+$s = oci_parse($c, $select_sql);
+oci_execute($s, OCI_DEFAULT);
+
+$row = oci_fetch_array($s);
+
+while (!$row[0]->eof()) {
+ var_dump($row[0]->read(1024));
+}
+
+require dirname(__FILE__).'/drop_table.inc';
+
+echo "Done\n";
+
+?>
+--EXPECT--
+bool(true)
+bool(true)
+string(9) "strstring"
+Done
diff --git a/ext/oci8/tests/lob_011.phpt b/ext/oci8/tests/lob_011.phpt
new file mode 100644
index 0000000000..41d54cf147
--- /dev/null
+++ b/ext/oci8/tests/lob_011.phpt
@@ -0,0 +1,81 @@
+--TEST--
+oci_lob_copy()
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--ENV--
+return "
+ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
+NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
+";
+--FILE--
+<?php
+
+require dirname(__FILE__).'/connect.inc';
+require dirname(__FILE__).'/create_table.inc';
+
+$ora_sql = "INSERT INTO
+ ".$schema.$table_name." (id, blob)
+ VALUES (1, empty_blob())
+ RETURNING
+ blob
+ INTO :v_blob ";
+
+$statement = oci_parse($c,$ora_sql);
+$blob = oci_new_descriptor($c,OCI_D_LOB);
+oci_bind_by_name($statement,":v_blob", $blob,-1,OCI_B_BLOB);
+oci_execute($statement, OCI_DEFAULT);
+
+var_dump($blob->write("some string here. string, I said"));
+oci_commit($c);
+
+$ora_sql = "INSERT INTO
+ ".$schema.$table_name." (id, blob)
+ VALUES (2, empty_blob())
+ RETURNING
+ blob
+ INTO :v_blob ";
+
+$statement = oci_parse($c,$ora_sql);
+$blob = oci_new_descriptor($c,OCI_D_LOB);
+oci_bind_by_name($statement,":v_blob", $blob,-1,OCI_B_BLOB);
+oci_execute($statement, OCI_DEFAULT);
+
+oci_commit($c);
+
+$select_sql = "SELECT blob FROM ".$schema.$table_name." WHERE id = 1";
+$s = oci_parse($c, $select_sql);
+oci_execute($s);
+
+$row1 = oci_fetch_array($s);
+
+$select_sql = "SELECT blob FROM ".$schema.$table_name." WHERE id = 2 FOR UPDATE";
+$s = oci_parse($c, $select_sql);
+oci_execute($s, OCI_DEFAULT);
+
+$row2 = oci_fetch_array($s);
+
+var_dump(oci_lob_copy($row2[0], $row1[0]));
+var_dump($row1[0]->read(100));
+
+oci_commit($c);
+
+$select_sql = "SELECT blob FROM ".$schema.$table_name." WHERE id = 2 FOR UPDATE";
+$s = oci_parse($c, $select_sql);
+oci_execute($s, OCI_DEFAULT);
+
+var_dump($row2 = oci_fetch_array($s, OCI_RETURN_LOBS));
+
+require dirname(__FILE__).'/drop_table.inc';
+
+echo "Done\n";
+
+?>
+--EXPECT--
+int(32)
+bool(true)
+string(32) "some string here. string, I said"
+array(1) {
+ [0]=>
+ string(32) "some string here. string, I said"
+}
+Done
diff --git a/ext/oci8/tests/lob_012.phpt b/ext/oci8/tests/lob_012.phpt
new file mode 100644
index 0000000000..fb434d9260
--- /dev/null
+++ b/ext/oci8/tests/lob_012.phpt
@@ -0,0 +1,55 @@
+--TEST--
+oci_lob_export()
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--ENV--
+return "
+ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
+NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
+";
+--FILE--
+<?php
+
+require dirname(__FILE__).'/connect.inc';
+require dirname(__FILE__).'/create_table.inc';
+
+$ora_sql = "INSERT INTO
+ ".$schema.$table_name." (blob)
+ VALUES (empty_blob())
+ RETURNING
+ blob
+ INTO :v_blob ";
+
+$statement = oci_parse($c,$ora_sql);
+$blob = oci_new_descriptor($c,OCI_D_LOB);
+oci_bind_by_name($statement,":v_blob", $blob,-1,OCI_B_BLOB);
+oci_execute($statement, OCI_DEFAULT);
+
+$blob;
+
+var_dump($blob->write("test string is here\nnew string"));
+
+oci_commit($c);
+
+$select_sql = "SELECT blob FROM ".$schema.$table_name." FOR UPDATE";
+$s = oci_parse($c, $select_sql);
+oci_execute($s, OCI_DEFAULT);
+
+$row = oci_fetch_array($s);
+
+var_dump($row[0]->export(dirname(__FILE__)."/lob_012.tmp", 3, 10));
+
+var_dump(file_get_contents(dirname(__FILE__)."/lob_012.tmp"));
+
+@unlink(dirname(__FILE__)."/lob_012.tmp");
+
+require dirname(__FILE__).'/drop_table.inc';
+
+echo "Done\n";
+
+?>
+--EXPECT--
+int(30)
+bool(true)
+string(10) "t string i"
+Done
diff --git a/ext/oci8/tests/lob_013.phpt b/ext/oci8/tests/lob_013.phpt
new file mode 100644
index 0000000000..608640c7a1
--- /dev/null
+++ b/ext/oci8/tests/lob_013.phpt
@@ -0,0 +1,59 @@
+--TEST--
+lob buffering
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--ENV--
+return "
+ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
+NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
+";
+--FILE--
+<?php
+
+require dirname(__FILE__).'/connect.inc';
+require dirname(__FILE__).'/create_table.inc';
+
+$ora_sql = "INSERT INTO
+ ".$schema.$table_name." (blob)
+ VALUES (empty_blob())
+ RETURNING
+ blob
+ INTO :v_blob ";
+
+$statement = oci_parse($c,$ora_sql);
+$blob = oci_new_descriptor($c,OCI_D_LOB);
+oci_bind_by_name($statement,":v_blob", $blob,-1,OCI_B_BLOB);
+oci_execute($statement, OCI_DEFAULT);
+
+var_dump($blob->write("test"));
+var_dump($blob->getBuffering());
+var_dump($blob->setBuffering(true));
+var_dump($blob->write("test"));
+var_dump($blob->getBuffering());
+var_dump($blob->flush());
+
+oci_commit($c);
+
+$select_sql = "SELECT blob FROM ".$schema.$table_name."";
+$s = oci_parse($c, $select_sql);
+oci_execute($s);
+
+$row = oci_fetch_array($s, OCI_RETURN_LOBS);
+
+var_dump($row[0]);
+
+
+require dirname(__FILE__).'/drop_table.inc';
+
+echo "Done\n";
+
+?>
+--EXPECT--
+int(4)
+bool(false)
+bool(true)
+int(4)
+bool(true)
+bool(true)
+string(8) "testtest"
+Done
diff --git a/ext/oci8/tests/lob_014.phpt b/ext/oci8/tests/lob_014.phpt
new file mode 100644
index 0000000000..b0e0db5a01
--- /dev/null
+++ b/ext/oci8/tests/lob_014.phpt
@@ -0,0 +1,63 @@
+--TEST--
+oci_lob_free()/close()
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--ENV--
+return "
+ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
+NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
+";
+--FILE--
+<?php
+
+require dirname(__FILE__).'/connect.inc';
+require dirname(__FILE__).'/create_table.inc';
+
+$ora_sql = "INSERT INTO
+ ".$schema.$table_name." (blob)
+ VALUES (empty_blob())
+ RETURNING
+ blob
+ INTO :v_blob ";
+
+$statement = oci_parse($c,$ora_sql);
+$blob = oci_new_descriptor($c,OCI_D_LOB);
+oci_bind_by_name($statement,":v_blob", $blob,-1,OCI_B_BLOB);
+oci_execute($statement, OCI_DEFAULT);
+
+$blob;
+
+var_dump($blob->write("test"));
+var_dump($blob->close());
+var_dump($blob->write("test"));
+var_dump($blob->free());
+var_dump($blob->write("test"));
+
+oci_commit($c);
+
+$select_sql = "SELECT blob FROM ".$schema.$table_name."";
+$s = oci_parse($c, $select_sql);
+oci_execute($s);
+
+var_dump(oci_fetch_array($s, OCI_NUM + OCI_RETURN_LOBS));
+
+require dirname(__FILE__).'/drop_table.inc';
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+int(4)
+
+Warning: OCI-Lob::close(): ORA-22289: cannot perform operation on an unopened file or LOB in %slob_014.php on line %d
+bool(false)
+int(4)
+bool(true)
+
+Warning: OCI-Lob::write(): %d is not a valid oci8 descriptor resource in %slob_014.php on line %d
+bool(false)
+array(1) {
+ [0]=>
+ string(8) "testtest"
+}
+Done
diff --git a/ext/oci8/tests/lob_015.phpt b/ext/oci8/tests/lob_015.phpt
new file mode 100644
index 0000000000..5419087888
--- /dev/null
+++ b/ext/oci8/tests/lob_015.phpt
@@ -0,0 +1,56 @@
+--TEST--
+various tests with wrong param count
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--ENV--
+return "
+ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
+NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
+";
+--FILE--
+<?php
+
+require dirname(__FILE__).'/connect.inc';
+require dirname(__FILE__).'/create_table.inc';
+
+$ora_sql = "INSERT INTO
+ ".$schema.$table_name." (blob)
+ VALUES (empty_blob())
+ RETURNING
+ blob
+ INTO :v_blob ";
+
+$statement = oci_parse($c,$ora_sql);
+$blob = oci_new_descriptor($c,OCI_D_LOB,1,2,3);
+$blob = oci_new_descriptor($c);
+oci_bind_by_name($statement,":v_blob", $blob,-1,OCI_B_BLOB,4);
+oci_bind_by_name($statement,":v_blob", $blob,-1,OCI_B_BLOB,4,5);
+oci_bind_by_name($statement,":v_blob", $blob,-1);
+oci_bind_by_name($statement,":v_blob", $blob);
+oci_bind_by_name($statement,":v_blob");
+oci_bind_by_name($statement);
+oci_execute($statement, OCI_DEFAULT);
+
+var_dump($blob);
+
+require dirname(__FILE__).'/drop_table.inc';
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+Warning: oci_new_descriptor() expects at most 2 parameters, 5 given in %slob_015.php on line %d
+
+Warning: oci_bind_by_name() expects at most 5 parameters, 6 given in %slob_015.php on line %d
+
+Warning: oci_bind_by_name() expects at most 5 parameters, 7 given in %slob_015.php on line %d
+
+Notice: Object of class OCI-Lob to string conversion in %slob_015.php on line %d
+
+Warning: oci_bind_by_name() expects at least 3 parameters, 2 given in %slob_015.php on line %d
+
+Warning: oci_bind_by_name() expects at least 3 parameters, 1 given in %slob_015.php on line %d
+
+Warning: oci_execute(): ORA-00932: inconsistent datatypes: expected NUMBER got BLOB in %slob_015.php on line %d
+string(6) "Object"
+Done
diff --git a/ext/oci8/tests/lob_016.phpt b/ext/oci8/tests/lob_016.phpt
new file mode 100644
index 0000000000..d021cc3ac8
--- /dev/null
+++ b/ext/oci8/tests/lob_016.phpt
@@ -0,0 +1,72 @@
+--TEST--
+returning multiple lobs
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--ENV--
+return "
+ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
+NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
+";
+--FILE--
+<?php
+
+require dirname(__FILE__).'/connect.inc';
+
+$drop = "DROP table lob_test";
+$statement = oci_parse($c, $drop);
+@oci_execute($statement);
+
+$create = "CREATE table lob_test(lob_1 BLOB, lob_2 BLOB)";
+$statement = oci_parse($c, $create);
+oci_execute($statement);
+
+$init = "INSERT INTO lob_test VALUES(EMPTY_BLOB(), EMPTY_BLOB())";
+$statement = oci_parse($c, $init);
+oci_execute($statement);
+
+$select = "SELECT * FROM lob_test FOR UPDATE";
+$statement = oci_parse($c, $select);
+oci_execute($statement, OCI_DEFAULT);
+
+$row = oci_fetch_assoc($statement);
+
+$row['LOB_1']->write("first");
+$row['LOB_2']->write("second");
+
+unset($row);
+
+oci_commit($c);
+
+$select = "SELECT * FROM lob_test FOR UPDATE";
+$statement = oci_parse($c, $select);
+oci_execute($statement, OCI_DEFAULT);
+
+$row = oci_fetch_assoc($statement);
+
+var_dump($row);
+var_dump($row['LOB_1']->load());
+var_dump($row['LOB_2']->load());
+
+$drop = "DROP table lob_test";
+$statement = oci_parse($c, $drop);
+@oci_execute($statement);
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+array(2) {
+ ["LOB_1"]=>
+ object(OCI-Lob)#%d (1) {
+ ["descriptor"]=>
+ resource(%d) of type (oci8 descriptor)
+ }
+ ["LOB_2"]=>
+ object(OCI-Lob)#%d (1) {
+ ["descriptor"]=>
+ resource(%d) of type (oci8 descriptor)
+ }
+}
+string(5) "first"
+string(6) "second"
+Done
diff --git a/ext/oci8/tests/lob_017.phpt b/ext/oci8/tests/lob_017.phpt
new file mode 100644
index 0000000000..43b4a513b3
--- /dev/null
+++ b/ext/oci8/tests/lob_017.phpt
@@ -0,0 +1,74 @@
+--TEST--
+returning multiple lobs (using persistent connection)
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--ENV--
+return "
+ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
+NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
+";
+--FILE--
+<?php
+
+require dirname(__FILE__).'/connect.inc';
+
+$c = oci_pconnect($user, $password, $dbase);
+
+$drop = "DROP table lob_test";
+$statement = oci_parse($c, $drop);
+@oci_execute($statement);
+
+$create = "CREATE table lob_test(lob_1 BLOB, lob_2 BLOB)";
+$statement = oci_parse($c, $create);
+oci_execute($statement);
+
+$init = "INSERT INTO lob_test VALUES(EMPTY_BLOB(), EMPTY_BLOB())";
+$statement = oci_parse($c, $init);
+oci_execute($statement);
+
+$select = "SELECT * FROM lob_test FOR UPDATE";
+$statement = oci_parse($c, $select);
+oci_execute($statement, OCI_DEFAULT);
+
+$row = oci_fetch_assoc($statement);
+
+$row['LOB_1']->write("first");
+$row['LOB_2']->write("second");
+
+unset($row);
+
+oci_commit($c);
+
+$select = "SELECT * FROM lob_test FOR UPDATE";
+$statement = oci_parse($c, $select);
+oci_execute($statement, OCI_DEFAULT);
+
+$row = oci_fetch_assoc($statement);
+
+var_dump($row);
+var_dump($row['LOB_1']->load());
+var_dump($row['LOB_2']->load());
+
+$drop = "DROP table lob_test";
+$statement = oci_parse($c, $drop);
+@oci_execute($statement);
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+array(2) {
+ ["LOB_1"]=>
+ object(OCI-Lob)#%d (1) {
+ ["descriptor"]=>
+ resource(%d) of type (oci8 descriptor)
+ }
+ ["LOB_2"]=>
+ object(OCI-Lob)#%d (1) {
+ ["descriptor"]=>
+ resource(%d) of type (oci8 descriptor)
+ }
+}
+string(5) "first"
+string(6) "second"
+Done
diff --git a/ext/oci8/tests/lob_018.phpt b/ext/oci8/tests/lob_018.phpt
new file mode 100644
index 0000000000..360f50f387
--- /dev/null
+++ b/ext/oci8/tests/lob_018.phpt
@@ -0,0 +1,72 @@
+--TEST--
+fetching the same lob several times
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--ENV--
+return "
+ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
+NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
+";
+--FILE--
+<?php
+
+require dirname(__FILE__).'/connect.inc';
+
+$drop = "DROP table lob_test";
+$statement = oci_parse($c, $drop);
+@oci_execute($statement);
+
+$create = "CREATE table lob_test(mykey NUMBER, lob_1 CLOB)";
+$statement = oci_parse($c, $create);
+oci_execute($statement);
+
+$init = "INSERT INTO lob_test (mykey, lob_1) VALUES(1, EMPTY_CLOB()) RETURNING lob_1 INTO :mylob";
+$statement = oci_parse($c, $init);
+$clob = oci_new_descriptor($c, OCI_D_LOB);
+oci_bind_by_name($statement, ":mylob", $clob, -1, OCI_B_CLOB);
+oci_execute($statement, OCI_DEFAULT);
+$clob->save("data");
+
+oci_commit($c);
+
+$init = "INSERT INTO lob_test (mykey, lob_1) VALUES(2, EMPTY_CLOB()) RETURNING lob_1 INTO :mylob";
+$statement = oci_parse($c, $init);
+$clob = oci_new_descriptor($c, OCI_D_LOB);
+oci_bind_by_name($statement, ":mylob", $clob, -1, OCI_B_CLOB);
+oci_execute($statement, OCI_DEFAULT);
+$clob->save("long data");
+
+oci_commit($c);
+
+
+$query = 'SELECT * FROM lob_test ORDER BY mykey ASC';
+$statement = oci_parse ($c, $query);
+oci_execute($statement, OCI_DEFAULT);
+
+while ($row = oci_fetch_array($statement, OCI_ASSOC)) {
+ $result = $row['LOB_1']->load();
+ var_dump($result);
+}
+
+$query = 'SELECT * FROM lob_test ORDER BY mykey DESC';
+$statement = oci_parse ($c, $query);
+oci_execute($statement, OCI_DEFAULT);
+
+while ($row = oci_fetch_array($statement, OCI_ASSOC)) {
+ $result = $row['LOB_1']->load();
+ var_dump($result);
+}
+
+$drop = "DROP table lob_test";
+$statement = oci_parse($c, $drop);
+@oci_execute($statement);
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+string(4) "data"
+string(9) "long data"
+string(9) "long data"
+string(4) "data"
+Done
diff --git a/ext/oci8/tests/lob_temp.phpt b/ext/oci8/tests/lob_temp.phpt
new file mode 100644
index 0000000000..4532d53630
--- /dev/null
+++ b/ext/oci8/tests/lob_temp.phpt
@@ -0,0 +1,41 @@
+--TEST--
+temporary lobs
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--ENV--
+return "
+ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
+NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
+";
+--FILE--
+<?php
+
+require dirname(__FILE__).'/connect.inc';
+
+$blob = oci_new_descriptor($c,OCI_D_LOB);
+var_dump($blob->writeTemporary("test"));
+var_dump($blob->load());
+var_dump($blob->seek(0, SEEK_SET));
+var_dump($blob->read(2));
+
+$c = oci_pconnect($user, $password, $dbase);
+
+$blob = oci_new_descriptor($c,OCI_D_LOB);
+var_dump($blob->writeTemporary("test"));
+var_dump($blob->load());
+var_dump($blob->seek(0, SEEK_SET));
+var_dump($blob->read(2));
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+bool(true)
+string(4) "test"
+bool(true)
+string(2) "te"
+bool(true)
+string(4) "test"
+bool(true)
+string(2) "te"
+Done
diff --git a/ext/oci8/tests/lob_temp1.phpt b/ext/oci8/tests/lob_temp1.phpt
new file mode 100644
index 0000000000..563a7e1f26
--- /dev/null
+++ b/ext/oci8/tests/lob_temp1.phpt
@@ -0,0 +1,37 @@
+--TEST--
+closing temporary lobs
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--ENV--
+return "
+ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
+NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
+";
+--FILE--
+<?php
+
+require dirname(__FILE__).'/connect.inc';
+
+$blob = oci_new_descriptor($c,OCI_D_LOB);
+var_dump($blob->writeTemporary("test"));
+var_dump($blob->load());
+var_dump($blob->close());
+
+$c = oci_pconnect($user, $password, $dbase);
+
+$blob = oci_new_descriptor($c,OCI_D_LOB);
+var_dump($blob->writeTemporary("test"));
+var_dump($blob->load());
+var_dump($blob->close());
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+bool(true)
+string(4) "test"
+bool(true)
+bool(true)
+string(4) "test"
+bool(true)
+Done
diff --git a/ext/oci8/tests/num.phpt b/ext/oci8/tests/num.phpt
new file mode 100644
index 0000000000..34b1a9c07d
--- /dev/null
+++ b/ext/oci8/tests/num.phpt
@@ -0,0 +1,71 @@
+--TEST--
+oci_num_*() family
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--ENV--
+return "
+ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
+NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
+";
+--FILE--
+<?php
+
+require dirname(__FILE__)."/connect.inc";
+require dirname(__FILE__).'/create_table.inc';
+
+$insert_sql = "INSERT INTO ".$schema.$table_name." (id, value) VALUES (1,1)";
+
+if (!($s = oci_parse($c, $insert_sql))) {
+ die("oci_parse(insert) failed!\n");
+}
+
+for ($i = 0; $i<3; $i++) {
+ if (!oci_execute($s)) {
+ die("oci_execute(insert) failed!\n");
+ }
+}
+
+if (!oci_commit($c)) {
+ die("oci_commit() failed!\n");
+}
+
+$select_sql = "SELECT * FROM ".$schema.$table_name."";
+
+if (!($s = oci_parse($c, $select_sql))) {
+ die("oci_parse(select) failed!\n");
+}
+
+if (!oci_execute($s)) {
+ die("oci_execute(select) failed!\n");
+}
+
+var_dump(ocirowcount($s));
+var_dump(oci_num_rows($s));
+var_dump(ocinumcols($s));
+var_dump(oci_num_fields($s));
+
+$delete_sql = "DELETE FROM ".$schema.$table_name."";
+
+if (!($s = oci_parse($c, $delete_sql))) {
+ die("oci_parse(delete) failed!\n");
+}
+
+if (!oci_execute($s)) {
+ die("oci_execute(delete) failed!\n");
+}
+oci_commit($c);
+
+var_dump(oci_num_rows($s));
+
+require dirname(__FILE__).'/drop_table.inc';
+
+echo "Done\n";
+
+?>
+--EXPECT--
+int(0)
+int(0)
+int(5)
+int(5)
+int(3)
+Done
diff --git a/ext/oci8/tests/oci_execute_segfault.phpt b/ext/oci8/tests/oci_execute_segfault.phpt
new file mode 100644
index 0000000000..b7f0b62c85
--- /dev/null
+++ b/ext/oci8/tests/oci_execute_segfault.phpt
@@ -0,0 +1,35 @@
+--TEST--
+oci_execute() segfault after repeated bind
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--ENV--
+return "
+ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
+NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
+";
+--FILE--
+<?php
+
+require dirname(__FILE__).'/connect.inc';
+require dirname(__FILE__).'/create_table.inc';
+
+$ora_sql = "INSERT INTO
+ ".$table_name." (blob, clob)
+ VALUES (empty_blob(), empty_clob())
+ RETURNING
+ blob
+ INTO :v_blob ";
+
+$s = oci_parse($c,$ora_sql);
+$blob = oci_new_descriptor($c,OCI_D_LOB);
+oci_bind_by_name($s,":v_blob", $blob,-1,OCI_B_BLOB);
+oci_execute($s);
+
+oci_bind_by_name($s,":v_blob", $blob,-1,OCI_B_BLOB);
+oci_execute($s);
+
+echo "Done\n";
+
+?>
+--EXPECT--
+Done
diff --git a/ext/oci8/tests/old_oci_close.phpt b/ext/oci8/tests/old_oci_close.phpt
new file mode 100644
index 0000000000..beb1b34ab5
--- /dev/null
+++ b/ext/oci8/tests/old_oci_close.phpt
@@ -0,0 +1,28 @@
+--TEST--
+oci8.old_oci_close_semantics On
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--INI--
+oci8.old_oci_close_semantics=1
+--ENV--
+return "
+ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
+NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
+";
+--FILE--
+<?php
+
+require dirname(__FILE__)."/connect.inc";
+
+var_dump($c);
+var_dump(oci_close($c));
+var_dump(oci_parse($c, "select 1 from dual"));
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+resource(%d) of type (oci8 connection)
+NULL
+resource(%d) of type (oci8 statement)
+Done
diff --git a/ext/oci8/tests/old_oci_close1.phpt b/ext/oci8/tests/old_oci_close1.phpt
new file mode 100644
index 0000000000..c79eb077be
--- /dev/null
+++ b/ext/oci8/tests/old_oci_close1.phpt
@@ -0,0 +1,30 @@
+--TEST--
+oci8.old_oci_close_semantics Off
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--INI--
+oci8.old_oci_close_semantics=0
+--ENV--
+return "
+ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
+NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
+";
+--FILE--
+<?php
+
+require dirname(__FILE__)."/connect.inc";
+
+var_dump($c);
+var_dump(oci_close($c));
+var_dump(oci_parse($c, "select 1 from dual"));
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+resource(%d) of type (oci8 connection)
+bool(true)
+
+Warning: oci_parse() expects parameter 1 to be resource, null given in %s on line %d
+NULL
+Done
diff --git a/ext/oci8/tests/password.phpt b/ext/oci8/tests/password.phpt
new file mode 100644
index 0000000000..37f586cd4f
--- /dev/null
+++ b/ext/oci8/tests/password.phpt
@@ -0,0 +1,35 @@
+--TEST--
+oci_password_change()
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--ENV--
+return "
+ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
+NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
+";
+--FILE--
+<?php
+
+require dirname(__FILE__)."/connect.inc";
+
+$new_password = "test";
+var_dump(oci_password_change($dbase, $user, $password, $new_password));
+
+if (!empty($dbase)) {
+ var_dump($new_c = ocilogon($user,$new_password,$dbase));
+}
+else {
+ var_dump($new_c = ocilogon($user,$new_password));
+}
+
+var_dump(oci_password_change($dbase, $user, $new_password, $password));
+
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+resource(%d) of type (oci8 connection)
+resource(%d) of type (oci8 connection)
+resource(%d) of type (oci8 connection)
+Done
diff --git a/ext/oci8/tests/password_new.phpt b/ext/oci8/tests/password_new.phpt
new file mode 100644
index 0000000000..37f586cd4f
--- /dev/null
+++ b/ext/oci8/tests/password_new.phpt
@@ -0,0 +1,35 @@
+--TEST--
+oci_password_change()
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--ENV--
+return "
+ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
+NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
+";
+--FILE--
+<?php
+
+require dirname(__FILE__)."/connect.inc";
+
+$new_password = "test";
+var_dump(oci_password_change($dbase, $user, $password, $new_password));
+
+if (!empty($dbase)) {
+ var_dump($new_c = ocilogon($user,$new_password,$dbase));
+}
+else {
+ var_dump($new_c = ocilogon($user,$new_password));
+}
+
+var_dump(oci_password_change($dbase, $user, $new_password, $password));
+
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+resource(%d) of type (oci8 connection)
+resource(%d) of type (oci8 connection)
+resource(%d) of type (oci8 connection)
+Done
diff --git a/ext/oci8/tests/password_old.phpt b/ext/oci8/tests/password_old.phpt
new file mode 100644
index 0000000000..3e715785b5
--- /dev/null
+++ b/ext/oci8/tests/password_old.phpt
@@ -0,0 +1,35 @@
+--TEST--
+ocipasswordchange()
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--ENV--
+return "
+ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
+NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
+";
+--FILE--
+<?php
+
+require dirname(__FILE__)."/connect.inc";
+
+$new_password = "test";
+var_dump(ocipasswordchange($c, $user, $password, $new_password));
+
+if (!empty($dbase)) {
+ var_dump($new_c = ocilogon($user,$new_password,$dbase));
+}
+else {
+ var_dump($new_c = ocilogon($user,$new_password));
+}
+
+var_dump(ocipasswordchange($new_c, $user, $new_password, $password));
+
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+bool(true)
+resource(%d) of type (oci8 connection)
+bool(true)
+Done
diff --git a/ext/oci8/tests/persistent.phpt b/ext/oci8/tests/persistent.phpt
new file mode 100644
index 0000000000..088689c722
--- /dev/null
+++ b/ext/oci8/tests/persistent.phpt
@@ -0,0 +1,32 @@
+--TEST--
+reusing persistent connections
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--ENV--
+return "
+ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
+NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
+TNS_ADMIN=".(isset($_ENV['TNS_ADMIN']) ? $_ENV['TNS_ADMIN'] : '')."
+";
+--FILE--
+<?php
+
+require dirname(__FILE__)."/connect.inc";
+
+var_dump(oci_pconnect($user, $password, $dbase));
+var_dump(oci_pconnect($user, $password, $dbase));
+var_dump(oci_pconnect($user, $password, $dbase));
+var_dump(oci_connect($user, $password, $dbase));
+var_dump(oci_connect($user, $password, $dbase));
+var_dump(oci_connect($user, $password, $dbase));
+
+echo "Done\n";
+?>
+--EXPECTF--
+resource(%d) of type (oci8 persistent connection)
+resource(%d) of type (oci8 persistent connection)
+resource(%d) of type (oci8 persistent connection)
+resource(%d) of type (oci8 connection)
+resource(%d) of type (oci8 connection)
+resource(%d) of type (oci8 connection)
+Done
diff --git a/ext/oci8/tests/prefetch.phpt b/ext/oci8/tests/prefetch.phpt
new file mode 100644
index 0000000000..45d51bd4c3
--- /dev/null
+++ b/ext/oci8/tests/prefetch.phpt
@@ -0,0 +1,56 @@
+--TEST--
+oci_set_prefetch()
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--ENV--
+return "
+ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
+NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
+";
+--FILE--
+<?php
+
+require dirname(__FILE__)."/connect.inc";
+require dirname(__FILE__).'/create_table.inc';
+
+$insert_sql = "INSERT INTO ".$schema.$table_name." (id, value) VALUES (1,1)";
+
+if (!($s = oci_parse($c, $insert_sql))) {
+ die("oci_parse(insert) failed!\n");
+}
+
+for ($i = 0; $i<3; $i++) {
+ if (!oci_execute($s)) {
+ die("oci_execute(insert) failed!\n");
+ }
+}
+
+if (!oci_commit($c)) {
+ die("oci_commit() failed!\n");
+}
+
+$select_sql = "SELECT * FROM ".$schema.$table_name."";
+
+if (!($s = oci_parse($c, $select_sql))) {
+ die("oci_parse(select) failed!\n");
+}
+
+var_dump(oci_set_prefetch($s, 10));
+
+if (!oci_execute($s)) {
+ die("oci_execute(select) failed!\n");
+}
+
+var_dump(oci_fetch($s));
+
+var_dump(oci_num_rows($s));
+
+require dirname(__FILE__).'/drop_table.inc';
+
+echo "Done\n";
+?>
+--EXPECT--
+bool(true)
+bool(true)
+int(1)
+Done
diff --git a/ext/oci8/tests/prefetch_old.phpt b/ext/oci8/tests/prefetch_old.phpt
new file mode 100644
index 0000000000..189511d051
--- /dev/null
+++ b/ext/oci8/tests/prefetch_old.phpt
@@ -0,0 +1,56 @@
+--TEST--
+ocisetprefetch()
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--ENV--
+return "
+ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
+NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
+";
+--FILE--
+<?php
+
+require dirname(__FILE__)."/connect.inc";
+require dirname(__FILE__).'/create_table.inc';
+
+$insert_sql = "INSERT INTO ".$schema.$table_name." (id, value) VALUES (1,1)";
+
+if (!($s = ociparse($c, $insert_sql))) {
+ die("ociparse(insert) failed!\n");
+}
+
+for ($i = 0; $i<3; $i++) {
+ if (!ociexecute($s)) {
+ die("ociexecute(insert) failed!\n");
+ }
+}
+
+if (!ocicommit($c)) {
+ die("ocicommit() failed!\n");
+}
+
+$select_sql = "SELECT * FROM ".$schema.$table_name."";
+
+if (!($s = ociparse($c, $select_sql))) {
+ die("ociparse(select) failed!\n");
+}
+
+var_dump(ocisetprefetch($s, 10));
+
+if (!ociexecute($s)) {
+ die("ociexecute(select) failed!\n");
+}
+
+var_dump(ocifetch($s));
+
+var_dump(ocirowcount($s));
+
+require dirname(__FILE__).'/drop_table.inc';
+
+echo "Done\n";
+?>
+--EXPECT--
+bool(true)
+bool(true)
+int(1)
+Done
diff --git a/ext/oci8/tests/privileged_connect.phpt b/ext/oci8/tests/privileged_connect.phpt
new file mode 100644
index 0000000000..aef94b79e1
--- /dev/null
+++ b/ext/oci8/tests/privileged_connect.phpt
@@ -0,0 +1,31 @@
+--TEST--
+privileged connect tests
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--ENV--
+return "
+ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
+NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
+TNS_ADMIN=".(isset($_ENV['TNS_ADMIN']) ? $_ENV['TNS_ADMIN'] : '')."
+";
+--FILE--
+<?php
+
+require dirname(__FILE__)."/connect.inc";
+
+oci_connect("", "", "", false, OCI_SYSOPER);
+oci_connect("", "", "", false, OCI_SYSDBA);
+oci_connect("", "", "", false, -1);
+oci_connect("", "", "", false, "qwe");
+
+echo "Done\n";
+?>
+--EXPECTF--
+Warning: oci_connect(): Privileged connect is disabled. Enable oci8.privileged_connect to be able to connect as SYSOPER or SYSDBA in %s on line %d
+
+Warning: oci_connect(): Privileged connect is disabled. Enable oci8.privileged_connect to be able to connect as SYSOPER or SYSDBA in %s on line %d
+
+Warning: oci_connect(): Invalid session mode specified (-1) in %s on line %d
+
+Warning: oci_connect() expects parameter 5 to be long, string given in %s on line %d
+Done
diff --git a/ext/oci8/tests/privileged_connect1.phpt b/ext/oci8/tests/privileged_connect1.phpt
new file mode 100644
index 0000000000..208d0853c4
--- /dev/null
+++ b/ext/oci8/tests/privileged_connect1.phpt
@@ -0,0 +1,33 @@
+--TEST--
+privileged connect tests
+--INI--
+oci8.privileged_connect=1
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--ENV--
+return "
+ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
+NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
+TNS_ADMIN=".(isset($_ENV['TNS_ADMIN']) ? $_ENV['TNS_ADMIN'] : '')."
+";
+--FILE--
+<?php
+
+require dirname(__FILE__)."/connect.inc";
+
+oci_connect("", "", "", false, OCI_SYSOPER);
+oci_connect("", "", "", false, OCI_SYSDBA);
+oci_connect("", "", "", false, -1);
+oci_connect("", "", "", false, "qwe");
+
+echo "Done\n";
+?>
+--EXPECTF--
+Warning: oci_connect(): ORA-01031: insufficient privileges in %s on line %d
+
+Warning: oci_connect(): ORA-01031: insufficient privileges in %s on line %d
+
+Warning: oci_connect(): Invalid session mode specified (-1) in %s on line %d
+
+Warning: oci_connect() expects parameter 5 to be long, string given in %s on line %d
+Done
diff --git a/ext/oci8/tests/serverversion.phpt b/ext/oci8/tests/serverversion.phpt
new file mode 100644
index 0000000000..0a8059964b
--- /dev/null
+++ b/ext/oci8/tests/serverversion.phpt
@@ -0,0 +1,35 @@
+--TEST--
+oci_server_version()
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--ENV--
+return "
+ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
+NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
+";
+--FILE--
+<?php
+
+require dirname(__FILE__)."/connect.inc";
+
+if (!empty($dbase)) {
+ var_dump($c = oci_connect($user, $password, $dbase));
+}
+else {
+ var_dump($c = oci_connect($user, $password));
+}
+
+$v = oci_server_version($c);
+var_dump(str_replace("\n", "", $v));
+
+$v = ociserverversion($c);
+var_dump(str_replace("\n", "", $v));
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+resource(%d) of type (oci8 connection)
+string(%d) "%s"
+string(%d) "%s"
+Done
diff --git a/ext/oci8/tests/statement_cache.phpt b/ext/oci8/tests/statement_cache.phpt
new file mode 100644
index 0000000000..dc49c427f2
--- /dev/null
+++ b/ext/oci8/tests/statement_cache.phpt
@@ -0,0 +1,40 @@
+--TEST--
+statement cache
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--ENV--
+return "
+ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
+NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
+";
+--FILE--
+<?php
+
+require dirname(__FILE__)."/connect.inc";
+
+$pc = oci_pconnect($user, $password, $dbase);
+
+$stmt = oci_parse($pc, "select 1+3 from dual", true);
+oci_execute($stmt);
+var_dump(oci_fetch_array($stmt));
+
+$stmt = oci_parse($pc, "select 1+3 from dual", true);
+oci_execute($stmt);
+var_dump(oci_fetch_array($stmt));
+
+echo "Done\n";
+?>
+--EXPECTF--
+array(2) {
+ [0]=>
+ string(1) "4"
+ ["1+3"]=>
+ string(1) "4"
+}
+array(2) {
+ [0]=>
+ string(1) "4"
+ ["1+3"]=>
+ string(1) "4"
+}
+Done
diff --git a/ext/oci8/tests/statement_type.phpt b/ext/oci8/tests/statement_type.phpt
new file mode 100644
index 0000000000..f3215ec31e
--- /dev/null
+++ b/ext/oci8/tests/statement_type.phpt
@@ -0,0 +1,51 @@
+--TEST--
+oci_statement_type()
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--ENV--
+return "
+ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
+NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
+";
+--FILE--
+<?php
+
+require dirname(__FILE__)."/connect.inc";
+
+if (!empty($dbase)) {
+ var_dump($c = oci_connect($user, $password, $dbase));
+}
+else {
+ var_dump($c = oci_connect($user, $password));
+}
+
+$sqls = Array(
+ "SELECT * FROM table",
+ "DELETE FROM table WHERE id = 1",
+ "INSERT INTO table VALUES(1)",
+ "UPDATE table SET id = 1",
+ "DROP TABLE table",
+ "CREATE TABLE table (id NUMBER)",
+ "WRONG SYNTAX",
+ ""
+);
+
+foreach ($sqls as $sql) {
+ $s = oci_parse($c, $sql);
+ var_dump(oci_statement_type($s));
+}
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+resource(%d) of type (oci8 connection)
+string(6) "SELECT"
+string(6) "DELETE"
+string(6) "INSERT"
+string(6) "UPDATE"
+string(4) "DROP"
+string(6) "CREATE"
+string(7) "UNKNOWN"
+string(7) "UNKNOWN"
+Done
diff --git a/ext/oci8/tests/statement_type_old.phpt b/ext/oci8/tests/statement_type_old.phpt
new file mode 100644
index 0000000000..587beb4f2c
--- /dev/null
+++ b/ext/oci8/tests/statement_type_old.phpt
@@ -0,0 +1,51 @@
+--TEST--
+ocistatementtype()
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--ENV--
+return "
+ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
+NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
+";
+--FILE--
+<?php
+
+require dirname(__FILE__)."/connect.inc";
+
+if (!empty($dbase)) {
+ var_dump($c = ocilogon($user, $password, $dbase));
+}
+else {
+ var_dump($c = ocilogon($user, $password));
+}
+
+$sqls = Array(
+ "SELECT * FROM table",
+ "DELETE FROM table WHERE id = 1",
+ "INSERT INTO table VALUES(1)",
+ "UPDATE table SET id = 1",
+ "DROP TABLE table",
+ "CREATE TABLE table (id NUMBER)",
+ "WRONG SYNTAX",
+ ""
+);
+
+foreach ($sqls as $sql) {
+ $s = ociparse($c, $sql);
+ var_dump(ocistatementtype($s));
+}
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+resource(%d) of type (oci8 connection)
+string(6) "SELECT"
+string(6) "DELETE"
+string(6) "INSERT"
+string(6) "UPDATE"
+string(4) "DROP"
+string(6) "CREATE"
+string(7) "UNKNOWN"
+string(7) "UNKNOWN"
+Done
diff --git a/ext/oci8/tests/uncommitted.phpt b/ext/oci8/tests/uncommitted.phpt
new file mode 100644
index 0000000000..297b7b0d06
--- /dev/null
+++ b/ext/oci8/tests/uncommitted.phpt
@@ -0,0 +1,22 @@
+--TEST--
+uncommitted connection
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--ENV--
+return "
+ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
+NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
+TNS_ADMIN=".(isset($_ENV['TNS_ADMIN']) ? $_ENV['TNS_ADMIN'] : '')."
+";
+--FILE--
+<?php
+
+require dirname(__FILE__)."/connect.inc";
+
+$stmt = oci_parse($c, "select 1 from dual");
+oci_execute($stmt, OCI_DEFAULT);
+
+echo "Done\n";
+?>
+--EXPECTF--
+Done