summaryrefslogtreecommitdiff
path: root/ext/oci8
diff options
context:
space:
mode:
authorAntony Dovgal <tony2001@php.net>2007-03-01 23:29:38 +0000
committerAntony Dovgal <tony2001@php.net>2007-03-01 23:29:38 +0000
commit7a069b81d80c74436344a3852062d3bb3589b574 (patch)
tree5d2f86fcbfa53c170cc5c2922b07cc511f149c3b /ext/oci8
parent37b4db2d00d7c3145019244c9c44a2c8e84a03cc (diff)
downloadphp-git-7a069b81d80c74436344a3852062d3bb3589b574.tar.gz
new tests
Diffstat (limited to 'ext/oci8')
-rw-r--r--ext/oci8/tests/bug40415.phpt200
-rw-r--r--ext/oci8/tests/fetch_all3.phpt577
-rw-r--r--ext/oci8/tests/lob_037.phpt68
-rw-r--r--ext/oci8/tests/lob_038.phpt189
-rw-r--r--ext/oci8/tests/lob_039.phpt65
5 files changed, 1099 insertions, 0 deletions
diff --git a/ext/oci8/tests/bug40415.phpt b/ext/oci8/tests/bug40415.phpt
new file mode 100644
index 0000000000..1ebc249d38
--- /dev/null
+++ b/ext/oci8/tests/bug40415.phpt
@@ -0,0 +1,200 @@
+--TEST--
+Bug #40415 (Using oci_fetchall with nested cursors)
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+require dirname(__FILE__)."/connect.inc";
+
+// Setup
+
+$create_1 = "CREATE TABLE t1 (id1 INTEGER)";
+$create_2 = "CREATE TABLE t2 (id2 INTEGER)";
+$drop_1 = "DROP TABLE t1";
+$drop_2 = "DROP TABLE t2";
+
+$s1 = oci_parse($c, $drop_1);
+$s2 = oci_parse($c, $drop_2);
+@oci_execute($s1);
+@oci_execute($s2);
+
+$s1 = oci_parse($c, $create_1);
+$s2 = oci_parse($c, $create_2);
+oci_execute($s1);
+oci_execute($s2);
+
+for($i=1; $i < 4; $i++) {
+ $insert = "INSERT INTO t1 VALUES(1".$i.")";
+ $s = oci_parse($c, $insert);
+ oci_execute($s);
+}
+
+for($i=1; $i < 4; $i++) {
+ $insert = "INSERT INTO t2 VALUES(2".$i.")";
+ $s = oci_parse($c, $insert);
+ oci_execute($s);
+}
+
+
+function do_assoc($c)
+{
+ $query = "SELECT t1.*, CURSOR( SELECT * FROM t2 ) AS CURSOR FROM t1";
+
+ $stmt = oci_parse($c, $query);
+ oci_execute($stmt);
+
+ while ($row = oci_fetch_assoc($stmt)) {
+ print "Got row \"".$row['ID1']."\". Now getting nested cursor:\n";
+ var_dump(oci_execute($row['CURSOR']));
+ while ($row_n = oci_fetch_assoc($row['CURSOR']) ) {
+ var_dump($row_n);
+ }
+ }
+}
+
+function do_all($c)
+{
+ $query = "SELECT t1.*, CURSOR( SELECT * FROM t2 ) AS CURSOR FROM t1";
+
+ $stmt = oci_parse($c, $query);
+ oci_execute($stmt);
+
+ $rc1 = oci_fetch_all($stmt, $res);
+
+ echo "Rows returned $rc1\n";
+
+ var_dump($res);
+
+ foreach ($res['CURSOR'] as $cv) {
+ echo "Getting nested cursor\n";
+ var_dump(oci_execute($cv));
+ $rc2 = oci_fetch_all($cv, $res2);
+ var_dump($res2);
+ }
+}
+
+
+
+echo "Test 1: Associate fetch of nested cursor\n";
+do_assoc($c);
+
+echo "\nTest 2: fetchall of nested cursor\n";
+do_all($c);
+
+
+// Cleanup
+$s1 = oci_parse($c, $drop_1);
+$s2 = oci_parse($c, $drop_2);
+@oci_execute($s1);
+@oci_execute($s2);
+
+echo "Done\n";
+?>
+--EXPECTF--
+Test 1: Associate fetch of nested cursor
+Got row "11". Now getting nested cursor:
+bool(true)
+array(1) {
+ ["ID2"]=>
+ string(2) "21"
+}
+array(1) {
+ ["ID2"]=>
+ string(2) "22"
+}
+array(1) {
+ ["ID2"]=>
+ string(2) "23"
+}
+Got row "12". Now getting nested cursor:
+bool(true)
+array(1) {
+ ["ID2"]=>
+ string(2) "21"
+}
+array(1) {
+ ["ID2"]=>
+ string(2) "22"
+}
+array(1) {
+ ["ID2"]=>
+ string(2) "23"
+}
+Got row "13". Now getting nested cursor:
+bool(true)
+array(1) {
+ ["ID2"]=>
+ string(2) "21"
+}
+array(1) {
+ ["ID2"]=>
+ string(2) "22"
+}
+array(1) {
+ ["ID2"]=>
+ string(2) "23"
+}
+
+Test 2: fetchall of nested cursor
+Rows returned 3
+array(2) {
+ ["ID1"]=>
+ array(3) {
+ [0]=>
+ string(2) "11"
+ [1]=>
+ string(2) "12"
+ [2]=>
+ string(2) "13"
+ }
+ ["CURSOR"]=>
+ array(3) {
+ [0]=>
+ resource(%d) of type (oci8 statement)
+ [1]=>
+ resource(%d) of type (oci8 statement)
+ [2]=>
+ resource(%d) of type (oci8 statement)
+ }
+}
+Getting nested cursor
+bool(true)
+array(1) {
+ ["ID2"]=>
+ array(3) {
+ [0]=>
+ string(2) "21"
+ [1]=>
+ string(2) "22"
+ [2]=>
+ string(2) "23"
+ }
+}
+Getting nested cursor
+bool(true)
+array(1) {
+ ["ID2"]=>
+ array(3) {
+ [0]=>
+ string(2) "21"
+ [1]=>
+ string(2) "22"
+ [2]=>
+ string(2) "23"
+ }
+}
+Getting nested cursor
+bool(true)
+array(1) {
+ ["ID2"]=>
+ array(3) {
+ [0]=>
+ string(2) "21"
+ [1]=>
+ string(2) "22"
+ [2]=>
+ string(2) "23"
+ }
+}
+Done
diff --git a/ext/oci8/tests/fetch_all3.phpt b/ext/oci8/tests/fetch_all3.phpt
new file mode 100644
index 0000000000..503e5dd88e
--- /dev/null
+++ b/ext/oci8/tests/fetch_all3.phpt
@@ -0,0 +1,577 @@
+--TEST--
+oci_fetch_all() - all combinations of flags
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+require dirname(__FILE__)."/connect.inc";
+require dirname(__FILE__).'/create_table.inc';
+
+$insert_sql = "INSERT INTO ".$schema."".$table_name." (id, value) VALUES (:idbv,:vbv)";
+
+$s = oci_parse($c, $insert_sql);
+oci_bind_by_name($s, ":idbv", $idbv, SQLT_INT);
+oci_bind_by_name($s, ":vbv", $vbv, SQLT_INT);
+
+for ($i = 1; $i <= 4; $i++) {
+ $idbv = $i;
+ $vbv = -$i;
+ oci_execute($s, OCI_DEFAULT);
+}
+
+oci_commit($c);
+
+$select_sql = "SELECT ID, VALUE FROM ".$schema."".$table_name." order by id";
+
+$s = oci_parse($c, $select_sql);
+
+echo "None\n";
+oci_execute($s);
+var_dump(oci_fetch_all($s, $all, 0, -1));
+var_dump($all);
+
+echo "OCI_ASSOC\n";
+oci_execute($s);
+var_dump(oci_fetch_all($s, $all, 0, -1, OCI_ASSOC));
+var_dump($all);
+
+echo "OCI_FETCHSTATEMENT_BY_COLUMN\n";
+oci_execute($s);
+var_dump(oci_fetch_all($s, $all, 0, -1, OCI_FETCHSTATEMENT_BY_COLUMN));
+var_dump($all);
+
+echo "OCI_FETCHSTATEMENT_BY_COLUMN|OCI_ASSOC\n";
+oci_execute($s);
+var_dump(oci_fetch_all($s, $all, 0, -1, OCI_FETCHSTATEMENT_BY_COLUMN|OCI_ASSOC));
+var_dump($all);
+
+echo "OCI_FETCHSTATEMENT_BY_COLUMN|OCI_NUM\n";
+oci_execute($s);
+var_dump(oci_fetch_all($s, $all, 0, -1, OCI_FETCHSTATEMENT_BY_COLUMN|OCI_NUM));
+var_dump($all);
+
+echo "OCI_FETCHSTATEMENT_BY_COLUMN|OCI_NUM|OCI_ASSOC\n";
+oci_execute($s);
+var_dump(oci_fetch_all($s, $all, 0, -1, OCI_FETCHSTATEMENT_BY_COLUMN|OCI_NUM|OCI_ASSOC));
+var_dump($all);
+
+echo "OCI_FETCHSTATEMENT_BY_ROW\n";
+oci_execute($s);
+var_dump(oci_fetch_all($s, $all, 0, -1, OCI_FETCHSTATEMENT_BY_ROW));
+var_dump($all);
+
+echo "OCI_FETCHSTATEMENT_BY_ROW|OCI_ASSOC\n";
+oci_execute($s);
+var_dump(oci_fetch_all($s, $all, 0, -1, OCI_FETCHSTATEMENT_BY_ROW|OCI_ASSOC));
+var_dump($all);
+
+echo "OCI_FETCHSTATEMENT_BY_ROW|OCI_FETCHSTATEMENT_BY_COLUMN\n";
+oci_execute($s);
+var_dump(oci_fetch_all($s, $all, 0, -1, OCI_FETCHSTATEMENT_BY_ROW|OCI_FETCHSTATEMENT_BY_COLUMN));
+var_dump($all);
+
+echo "OCI_FETCHSTATEMENT_BY_ROW|OCI_FETCHSTATEMENT_BY_COLUMN|OCI_ASSOC\n";
+oci_execute($s);
+var_dump(oci_fetch_all($s, $all, 0, -1, OCI_FETCHSTATEMENT_BY_ROW|OCI_FETCHSTATEMENT_BY_COLUMN|OCI_ASSOC));
+var_dump($all);
+
+echo "OCI_FETCHSTATEMENT_BY_ROW|OCI_FETCHSTATEMENT_BY_COLUMN|OCI_NUM\n";
+oci_execute($s);
+var_dump(oci_fetch_all($s, $all, 0, -1, OCI_FETCHSTATEMENT_BY_ROW|OCI_FETCHSTATEMENT_BY_COLUMN|OCI_NUM));
+var_dump($all);
+
+echo "OCI_FETCHSTATEMENT_BY_ROW|OCI_FETCHSTATEMENT_BY_COLUMN|OCI_NUM|OCI_ASSOC\n";
+oci_execute($s);
+var_dump(oci_fetch_all($s, $all, 0, -1, OCI_FETCHSTATEMENT_BY_ROW|OCI_FETCHSTATEMENT_BY_COLUMN|OCI_NUM|OCI_ASSOC));
+var_dump($all);
+
+echo "OCI_FETCHSTATEMENT_BY_ROW|OCI_NUM\n";
+oci_execute($s);
+var_dump(oci_fetch_all($s, $all, 0, -1, OCI_FETCHSTATEMENT_BY_ROW|OCI_NUM));
+var_dump($all);
+
+echo "OCI_FETCHSTATEMENT_BY_ROW|OCI_NUM|OCI_ASSOC\n";
+oci_execute($s);
+var_dump(oci_fetch_all($s, $all, 0, -1, OCI_FETCHSTATEMENT_BY_ROW|OCI_NUM|OCI_ASSOC));
+var_dump($all);
+
+echo "OCI_NUM\n";
+oci_execute($s);
+var_dump(oci_fetch_all($s, $all, 0, -1, OCI_NUM));
+var_dump($all);
+
+echo "OCI_NUM|OCI_ASSOC\n";
+oci_execute($s);
+var_dump(oci_fetch_all($s, $all, 0, -1, OCI_NUM|OCI_ASSOC));
+var_dump($all);
+require dirname(__FILE__).'/drop_table.inc';
+
+echo "Done\n";
+?>
+--EXPECT--
+None
+int(4)
+array(2) {
+ ["ID"]=>
+ array(4) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(1) "2"
+ [2]=>
+ string(1) "3"
+ [3]=>
+ string(1) "4"
+ }
+ ["VALUE"]=>
+ array(4) {
+ [0]=>
+ string(2) "-1"
+ [1]=>
+ string(2) "-2"
+ [2]=>
+ string(2) "-3"
+ [3]=>
+ string(2) "-4"
+ }
+}
+OCI_ASSOC
+int(4)
+array(2) {
+ ["ID"]=>
+ array(4) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(1) "2"
+ [2]=>
+ string(1) "3"
+ [3]=>
+ string(1) "4"
+ }
+ ["VALUE"]=>
+ array(4) {
+ [0]=>
+ string(2) "-1"
+ [1]=>
+ string(2) "-2"
+ [2]=>
+ string(2) "-3"
+ [3]=>
+ string(2) "-4"
+ }
+}
+OCI_FETCHSTATEMENT_BY_COLUMN
+int(4)
+array(2) {
+ ["ID"]=>
+ array(4) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(1) "2"
+ [2]=>
+ string(1) "3"
+ [3]=>
+ string(1) "4"
+ }
+ ["VALUE"]=>
+ array(4) {
+ [0]=>
+ string(2) "-1"
+ [1]=>
+ string(2) "-2"
+ [2]=>
+ string(2) "-3"
+ [3]=>
+ string(2) "-4"
+ }
+}
+OCI_FETCHSTATEMENT_BY_COLUMN|OCI_ASSOC
+int(4)
+array(2) {
+ ["ID"]=>
+ array(4) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(1) "2"
+ [2]=>
+ string(1) "3"
+ [3]=>
+ string(1) "4"
+ }
+ ["VALUE"]=>
+ array(4) {
+ [0]=>
+ string(2) "-1"
+ [1]=>
+ string(2) "-2"
+ [2]=>
+ string(2) "-3"
+ [3]=>
+ string(2) "-4"
+ }
+}
+OCI_FETCHSTATEMENT_BY_COLUMN|OCI_NUM
+int(4)
+array(2) {
+ [0]=>
+ array(4) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(1) "2"
+ [2]=>
+ string(1) "3"
+ [3]=>
+ string(1) "4"
+ }
+ [1]=>
+ array(4) {
+ [0]=>
+ string(2) "-1"
+ [1]=>
+ string(2) "-2"
+ [2]=>
+ string(2) "-3"
+ [3]=>
+ string(2) "-4"
+ }
+}
+OCI_FETCHSTATEMENT_BY_COLUMN|OCI_NUM|OCI_ASSOC
+int(4)
+array(2) {
+ [0]=>
+ array(4) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(1) "2"
+ [2]=>
+ string(1) "3"
+ [3]=>
+ string(1) "4"
+ }
+ [1]=>
+ array(4) {
+ [0]=>
+ string(2) "-1"
+ [1]=>
+ string(2) "-2"
+ [2]=>
+ string(2) "-3"
+ [3]=>
+ string(2) "-4"
+ }
+}
+OCI_FETCHSTATEMENT_BY_ROW
+int(4)
+array(4) {
+ [0]=>
+ array(2) {
+ ["ID"]=>
+ string(1) "1"
+ ["VALUE"]=>
+ string(2) "-1"
+ }
+ [1]=>
+ array(2) {
+ ["ID"]=>
+ string(1) "2"
+ ["VALUE"]=>
+ string(2) "-2"
+ }
+ [2]=>
+ array(2) {
+ ["ID"]=>
+ string(1) "3"
+ ["VALUE"]=>
+ string(2) "-3"
+ }
+ [3]=>
+ array(2) {
+ ["ID"]=>
+ string(1) "4"
+ ["VALUE"]=>
+ string(2) "-4"
+ }
+}
+OCI_FETCHSTATEMENT_BY_ROW|OCI_ASSOC
+int(4)
+array(4) {
+ [0]=>
+ array(2) {
+ ["ID"]=>
+ string(1) "1"
+ ["VALUE"]=>
+ string(2) "-1"
+ }
+ [1]=>
+ array(2) {
+ ["ID"]=>
+ string(1) "2"
+ ["VALUE"]=>
+ string(2) "-2"
+ }
+ [2]=>
+ array(2) {
+ ["ID"]=>
+ string(1) "3"
+ ["VALUE"]=>
+ string(2) "-3"
+ }
+ [3]=>
+ array(2) {
+ ["ID"]=>
+ string(1) "4"
+ ["VALUE"]=>
+ string(2) "-4"
+ }
+}
+OCI_FETCHSTATEMENT_BY_ROW|OCI_FETCHSTATEMENT_BY_COLUMN
+int(4)
+array(4) {
+ [0]=>
+ array(2) {
+ ["ID"]=>
+ string(1) "1"
+ ["VALUE"]=>
+ string(2) "-1"
+ }
+ [1]=>
+ array(2) {
+ ["ID"]=>
+ string(1) "2"
+ ["VALUE"]=>
+ string(2) "-2"
+ }
+ [2]=>
+ array(2) {
+ ["ID"]=>
+ string(1) "3"
+ ["VALUE"]=>
+ string(2) "-3"
+ }
+ [3]=>
+ array(2) {
+ ["ID"]=>
+ string(1) "4"
+ ["VALUE"]=>
+ string(2) "-4"
+ }
+}
+OCI_FETCHSTATEMENT_BY_ROW|OCI_FETCHSTATEMENT_BY_COLUMN|OCI_ASSOC
+int(4)
+array(4) {
+ [0]=>
+ array(2) {
+ ["ID"]=>
+ string(1) "1"
+ ["VALUE"]=>
+ string(2) "-1"
+ }
+ [1]=>
+ array(2) {
+ ["ID"]=>
+ string(1) "2"
+ ["VALUE"]=>
+ string(2) "-2"
+ }
+ [2]=>
+ array(2) {
+ ["ID"]=>
+ string(1) "3"
+ ["VALUE"]=>
+ string(2) "-3"
+ }
+ [3]=>
+ array(2) {
+ ["ID"]=>
+ string(1) "4"
+ ["VALUE"]=>
+ string(2) "-4"
+ }
+}
+OCI_FETCHSTATEMENT_BY_ROW|OCI_FETCHSTATEMENT_BY_COLUMN|OCI_NUM
+int(4)
+array(4) {
+ [0]=>
+ array(2) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(2) "-1"
+ }
+ [1]=>
+ array(2) {
+ [0]=>
+ string(1) "2"
+ [1]=>
+ string(2) "-2"
+ }
+ [2]=>
+ array(2) {
+ [0]=>
+ string(1) "3"
+ [1]=>
+ string(2) "-3"
+ }
+ [3]=>
+ array(2) {
+ [0]=>
+ string(1) "4"
+ [1]=>
+ string(2) "-4"
+ }
+}
+OCI_FETCHSTATEMENT_BY_ROW|OCI_FETCHSTATEMENT_BY_COLUMN|OCI_NUM|OCI_ASSOC
+int(4)
+array(4) {
+ [0]=>
+ array(2) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(2) "-1"
+ }
+ [1]=>
+ array(2) {
+ [0]=>
+ string(1) "2"
+ [1]=>
+ string(2) "-2"
+ }
+ [2]=>
+ array(2) {
+ [0]=>
+ string(1) "3"
+ [1]=>
+ string(2) "-3"
+ }
+ [3]=>
+ array(2) {
+ [0]=>
+ string(1) "4"
+ [1]=>
+ string(2) "-4"
+ }
+}
+OCI_FETCHSTATEMENT_BY_ROW|OCI_NUM
+int(4)
+array(4) {
+ [0]=>
+ array(2) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(2) "-1"
+ }
+ [1]=>
+ array(2) {
+ [0]=>
+ string(1) "2"
+ [1]=>
+ string(2) "-2"
+ }
+ [2]=>
+ array(2) {
+ [0]=>
+ string(1) "3"
+ [1]=>
+ string(2) "-3"
+ }
+ [3]=>
+ array(2) {
+ [0]=>
+ string(1) "4"
+ [1]=>
+ string(2) "-4"
+ }
+}
+OCI_FETCHSTATEMENT_BY_ROW|OCI_NUM|OCI_ASSOC
+int(4)
+array(4) {
+ [0]=>
+ array(2) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(2) "-1"
+ }
+ [1]=>
+ array(2) {
+ [0]=>
+ string(1) "2"
+ [1]=>
+ string(2) "-2"
+ }
+ [2]=>
+ array(2) {
+ [0]=>
+ string(1) "3"
+ [1]=>
+ string(2) "-3"
+ }
+ [3]=>
+ array(2) {
+ [0]=>
+ string(1) "4"
+ [1]=>
+ string(2) "-4"
+ }
+}
+OCI_NUM
+int(4)
+array(2) {
+ [0]=>
+ array(4) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(1) "2"
+ [2]=>
+ string(1) "3"
+ [3]=>
+ string(1) "4"
+ }
+ [1]=>
+ array(4) {
+ [0]=>
+ string(2) "-1"
+ [1]=>
+ string(2) "-2"
+ [2]=>
+ string(2) "-3"
+ [3]=>
+ string(2) "-4"
+ }
+}
+OCI_NUM|OCI_ASSOC
+int(4)
+array(2) {
+ [0]=>
+ array(4) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(1) "2"
+ [2]=>
+ string(1) "3"
+ [3]=>
+ string(1) "4"
+ }
+ [1]=>
+ array(4) {
+ [0]=>
+ string(2) "-1"
+ [1]=>
+ string(2) "-2"
+ [2]=>
+ string(2) "-3"
+ [3]=>
+ string(2) "-4"
+ }
+}
+Done
diff --git a/ext/oci8/tests/lob_037.phpt b/ext/oci8/tests/lob_037.phpt
new file mode 100644
index 0000000000..228f5e8123
--- /dev/null
+++ b/ext/oci8/tests/lob_037.phpt
@@ -0,0 +1,68 @@
+--TEST--
+Fetching two different lobs and using them after fetch
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+require dirname(__FILE__).'/connect.inc';
+require dirname(__FILE__).'/create_table.inc';
+
+/* insert the first LOB */
+$ora_sql = "INSERT INTO
+ ".$schema.$table_name." (blob)
+ VALUES (empty_blob())
+ RETURNING
+ blob
+ INTO :v_blob ";
+
+$s = oci_parse($c,$ora_sql);
+$blob = oci_new_descriptor($c,OCI_DTYPE_LOB);
+
+oci_bind_by_name($s,":v_blob", $blob,-1,OCI_B_BLOB);
+oci_execute($s, OCI_DEFAULT);
+
+var_dump($blob->write("first lob data"));
+oci_commit($c);
+
+/* insert the second LOB */
+$ora_sql = "INSERT INTO
+ ".$schema.$table_name." (blob)
+ VALUES (empty_blob())
+ RETURNING
+ blob
+ INTO :v_blob ";
+
+$s = oci_parse($c,$ora_sql);
+$blob = oci_new_descriptor($c,OCI_DTYPE_LOB);
+
+oci_bind_by_name($s,":v_blob", $blob,-1,OCI_B_BLOB);
+oci_execute($s, OCI_DEFAULT);
+
+var_dump($blob->write("second lob data"));
+oci_commit($c);
+
+/* select both */
+
+$ora_sql = "SELECT blob FROM ".$schema.$table_name;
+$s = oci_parse($c,$ora_sql);
+oci_execute($s, OCI_DEFAULT);
+
+$rows = array();
+$rows[0] = oci_fetch_assoc($s);
+$rows[1] = oci_fetch_assoc($s);
+
+var_dump($rows[0]['BLOB']->read(1000));
+var_dump($rows[1]['BLOB']->read(1000));
+
+require dirname(__FILE__).'/drop_table.inc';
+
+echo "Done\n";
+
+?>
+--EXPECT--
+int(14)
+int(15)
+string(14) "first lob data"
+string(15) "second lob data"
+Done
diff --git a/ext/oci8/tests/lob_038.phpt b/ext/oci8/tests/lob_038.phpt
new file mode 100644
index 0000000000..91dac66c0d
--- /dev/null
+++ b/ext/oci8/tests/lob_038.phpt
@@ -0,0 +1,189 @@
+--TEST--
+Array fetch CLOB and BLOB
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+require dirname(__FILE__).'/connect.inc';
+require dirname(__FILE__).'/create_table.inc';
+
+echo "Test 1: CLOB\n";
+
+$ora_sql = "INSERT INTO
+ ".$schema.$table_name." (clob)
+ VALUES (empty_clob())
+ RETURNING
+ clob
+ INTO :v_clob ";
+
+$s = oci_parse($c,$ora_sql);
+$clob = oci_new_descriptor($c,OCI_DTYPE_LOB);
+
+
+oci_bind_by_name($s,":v_clob", $clob,-1,OCI_B_CLOB);
+
+oci_execute($s, OCI_DEFAULT);
+var_dump($clob->save("clob test 1"));
+
+oci_execute($s, OCI_DEFAULT);
+var_dump($clob->save("clob test 2"));
+
+oci_execute($s, OCI_DEFAULT);
+var_dump($clob->save("clob test 3"));
+
+
+$s = oci_parse($c,"select clob from ".$schema.$table_name);
+var_dump(oci_execute($s));
+
+oci_fetch_all($s, $res);
+
+var_dump($res);
+
+
+echo "Test 1b\n";
+
+$s = oci_parse($c, "select clob from ".$schema.$table_name);
+var_dump(oci_execute($s, OCI_DEFAULT));
+while ($row = oci_fetch_array($s, OCI_ASSOC)) {
+ var_dump($row);
+ $result = $row['CLOB']->load();
+ var_dump($result);
+}
+
+
+require dirname(__FILE__).'/drop_table.inc';
+
+echo "Test 2: BLOB\n";
+
+require dirname(__FILE__).'/create_table.inc';
+
+$ora_sql = "INSERT INTO
+ ".$schema.$table_name." (blob)
+ VALUES (empty_blob())
+ RETURNING
+ blob
+ INTO :v_blob ";
+
+$s = oci_parse($c,$ora_sql);
+$blob = oci_new_descriptor($c,OCI_DTYPE_LOB);
+
+
+oci_bind_by_name($s,":v_blob", $blob,-1,OCI_B_BLOB);
+
+oci_execute($s, OCI_DEFAULT);
+var_dump($blob->save("blob test 1"));
+
+oci_execute($s, OCI_DEFAULT);
+var_dump($blob->save("blob test 2"));
+
+oci_execute($s, OCI_DEFAULT);
+var_dump($blob->save("blob test 3"));
+
+$s = oci_parse($c, "select blob from ".$schema.$table_name);
+var_dump(oci_execute($s));
+oci_fetch_all($s, $res);
+var_dump($res);
+
+echo "Test 2b\n";
+
+$s = oci_parse($c, "select blob from ".$schema.$table_name);
+var_dump(oci_execute($s, OCI_DEFAULT));
+while ($row = oci_fetch_array($s, OCI_ASSOC)) {
+ var_dump($row);
+ $result = $row['BLOB']->load();
+ var_dump($result);
+}
+
+
+require dirname(__FILE__).'/drop_table.inc';
+
+echo "Done\n";
+
+?>
+--EXPECTF--
+Test 1: CLOB
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+array(1) {
+ ["CLOB"]=>
+ array(3) {
+ [0]=>
+ string(11) "clob test 1"
+ [1]=>
+ string(11) "clob test 2"
+ [2]=>
+ string(11) "clob test 3"
+ }
+}
+Test 1b
+bool(true)
+array(1) {
+ ["CLOB"]=>
+ object(OCI-Lob)#2 (1) {
+ ["descriptor"]=>
+ resource(%d) of type (oci8 descriptor)
+ }
+}
+string(11) "clob test 1"
+array(1) {
+ ["CLOB"]=>
+ object(OCI-Lob)#3 (1) {
+ ["descriptor"]=>
+ resource(%d) of type (oci8 descriptor)
+ }
+}
+string(11) "clob test 2"
+array(1) {
+ ["CLOB"]=>
+ object(OCI-Lob)#2 (1) {
+ ["descriptor"]=>
+ resource(%d) of type (oci8 descriptor)
+ }
+}
+string(11) "clob test 3"
+Test 2: BLOB
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+array(1) {
+ ["BLOB"]=>
+ array(3) {
+ [0]=>
+ string(11) "blob test 1"
+ [1]=>
+ string(11) "blob test 2"
+ [2]=>
+ string(11) "blob test 3"
+ }
+}
+Test 2b
+bool(true)
+array(1) {
+ ["BLOB"]=>
+ object(OCI-Lob)#3 (1) {
+ ["descriptor"]=>
+ resource(%d) of type (oci8 descriptor)
+ }
+}
+string(11) "blob test 1"
+array(1) {
+ ["BLOB"]=>
+ object(OCI-Lob)#4 (1) {
+ ["descriptor"]=>
+ resource(%d) of type (oci8 descriptor)
+ }
+}
+string(11) "blob test 2"
+array(1) {
+ ["BLOB"]=>
+ object(OCI-Lob)#3 (1) {
+ ["descriptor"]=>
+ resource(%d) of type (oci8 descriptor)
+ }
+}
+string(11) "blob test 3"
+Done \ No newline at end of file
diff --git a/ext/oci8/tests/lob_039.phpt b/ext/oci8/tests/lob_039.phpt
new file mode 100644
index 0000000000..93251c8d80
--- /dev/null
+++ b/ext/oci8/tests/lob_039.phpt
@@ -0,0 +1,65 @@
+--TEST--
+Test CLOB->write() for multiple inserts
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+require dirname(__FILE__).'/connect.inc';
+require dirname(__FILE__).'/create_table.inc';
+
+echo "Test 1: CLOB\n";
+
+$ora_sql = "INSERT INTO
+ ".$schema.$table_name." (clob)
+ VALUES (empty_clob())
+ RETURNING
+ clob
+ INTO :v_clob ";
+
+$s = oci_parse($c,$ora_sql);
+$clob = oci_new_descriptor($c,OCI_DTYPE_LOB);
+
+
+oci_bind_by_name($s,":v_clob", $clob,-1,OCI_B_CLOB);
+
+oci_execute($s, OCI_DEFAULT);
+var_dump($clob->write("clob test 1"));
+
+oci_execute($s, OCI_DEFAULT);
+var_dump($clob->write("clob test 2"));
+
+oci_execute($s, OCI_DEFAULT);
+var_dump($clob->write("clob test 3"));
+
+$s = oci_parse($c,"select clob from ".$schema.$table_name);
+var_dump(oci_execute($s));
+
+oci_fetch_all($s, $res);
+
+var_dump($res);
+
+
+require dirname(__FILE__).'/drop_table.inc';
+
+echo "Done\n";
+
+?>
+--EXPECT--
+Test 1: CLOB
+int(11)
+int(11)
+int(11)
+bool(true)
+array(1) {
+ ["CLOB"]=>
+ array(3) {
+ [0]=>
+ string(11) "clob test 1"
+ [1]=>
+ string(11) "clob test 2"
+ [2]=>
+ string(11) "clob test 3"
+ }
+}
+Done