diff options
author | Mark A. Hershberger <mah@debian.(none)> | 2009-03-25 00:35:28 -0400 |
---|---|---|
committer | Mark A. Hershberger <mah@debian.(none)> | 2009-03-25 00:35:28 -0400 |
commit | ba50031707469046407a35b77a3cd81351e951b3 (patch) | |
tree | 5c03e723bdbfabae09d41a3ab1253dff41eeed4a /ext/oci8/tests | |
parent | 0a36161e13484a99ccf69bb38f206462d27cc6d6 (diff) | |
download | php-ba50031707469046407a35b77a3cd81351e951b3.tar.gz |
Imported Upstream version 5.1.5upstream/5.1.5
Diffstat (limited to 'ext/oci8/tests')
23 files changed, 366 insertions, 39 deletions
diff --git a/ext/oci8/tests/bind_empty.phpt b/ext/oci8/tests/bind_empty.phpt index dc993016a..9c602b32c 100644 --- a/ext/oci8/tests/bind_empty.phpt +++ b/ext/oci8/tests/bind_empty.phpt @@ -18,13 +18,13 @@ oci_execute($statement); $name = null; $stmt = oci_parse($c, "UPDATE bind_test SET name=:name"); -oci_bind_by_name($stmt, ":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); +oci_bind_by_name($stmt, ":name", $name); $res = oci_execute($stmt); diff --git a/ext/oci8/tests/bind_long.phpt b/ext/oci8/tests/bind_long.phpt new file mode 100644 index 000000000..58590f145 --- /dev/null +++ b/ext/oci8/tests/bind_long.phpt @@ -0,0 +1,38 @@ +--TEST-- +bind LONG field +--SKIPIF-- +<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> +--FILE-- +<?php + +require dirname(__FILE__)."/connect.inc"; + +$stmt = oci_parse($c, "create table phptestlng( id number(10), fileimage long)"); +oci_execute($stmt); + +$stmt = oci_parse ($c, "insert into phptestlng (id, fileimage) values (:id, :fileimage)"); +$i=1; +$fileimage = file_get_contents( dirname(__FILE__)."/test.gif"); + +oci_bind_by_name( $stmt, ":id", $i, -1); +oci_bind_by_name( $stmt, ":fileimage", $fileimage, -1, SQLT_LNG); +oci_execute($stmt, OCI_DEFAULT); +oci_commit($c); + +$stmt = oci_parse($c, "SELECT fileimage FROM phptestlng"); +oci_execute($stmt); + +$row = oci_fetch_row($stmt); +var_dump(md5($row[0])); +var_dump(strlen($row[0])); + +$stmt = oci_parse($c, "drop table phptestlng"); +oci_execute($stmt); + +echo "Done\n"; + +?> +--EXPECT-- +string(32) "d04e7036e2f4221abc88fd14e960a45b" +int(2523) +Done diff --git a/ext/oci8/tests/bind_long_raw.phpt b/ext/oci8/tests/bind_long_raw.phpt new file mode 100644 index 000000000..2a9962eac --- /dev/null +++ b/ext/oci8/tests/bind_long_raw.phpt @@ -0,0 +1,38 @@ +--TEST-- +bind LONG RAW field +--SKIPIF-- +<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> +--FILE-- +<?php + +require dirname(__FILE__)."/connect.inc"; + +$stmt = oci_parse($c, "create table phptestlngraw( id number(10), fileimage long raw)"); +oci_execute($stmt); + +$stmt = oci_parse ($c, "insert into phptestlngraw (id, fileimage) values (:id, :fileimage)"); +$i=1; +$fileimage = file_get_contents( dirname(__FILE__)."/test.gif"); + +oci_bind_by_name( $stmt, ":id", $i, -1); +oci_bind_by_name( $stmt, ":fileimage", $fileimage, -1, SQLT_LBI); +oci_execute($stmt, OCI_DEFAULT); +oci_commit($c); + +$stmt = oci_parse($c, "SELECT fileimage FROM phptestlngraw"); +oci_execute($stmt); + +$row = oci_fetch_row($stmt); +var_dump(md5($row[0])); +var_dump(strlen($row[0])); + +$stmt = oci_parse($c, "drop table phptestlngraw"); +oci_execute($stmt); + +echo "Done\n"; + +?> +--EXPECT-- +string(32) "614fcbba1effb7caa27ef0ef25c27fcf" +int(2523) +Done diff --git a/ext/oci8/tests/bind_raw.phpt b/ext/oci8/tests/bind_raw.phpt new file mode 100644 index 000000000..c9087e552 --- /dev/null +++ b/ext/oci8/tests/bind_raw.phpt @@ -0,0 +1,39 @@ +--TEST-- +bind RAW field +--SKIPIF-- +<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> +--FILE-- +<?php + +require dirname(__FILE__)."/connect.inc"; + +$stmt = oci_parse($c, "create table phptestrawtable( id number(10), fileimage raw(1000))"); +oci_execute($stmt); + +$stmt = oci_parse ($c, "insert into phptestrawtable (id, fileimage) values (:id, :fileimage)"); +$i=1; +$fileimage = file_get_contents( dirname(__FILE__)."/test.gif"); +$fileimage = substr($fileimage, 0, 300); + +oci_bind_by_name( $stmt, ":id", $i, -1); +oci_bind_by_name( $stmt, ":fileimage", $fileimage, -1, SQLT_BIN); +oci_execute($stmt, OCI_DEFAULT); +oci_commit($c); + +$stmt = oci_parse($c, "SELECT fileimage FROM phptestrawtable"); +oci_execute($stmt); + +$row = oci_fetch_row($stmt); +var_dump(md5($row[0])); +var_dump(strlen($row[0])); + +$stmt = oci_parse($c, "drop table phptestrawtable"); +oci_execute($stmt); + +echo "Done\n"; + +?> +--EXPECT-- +string(32) "88b274d7a257ac6f70435b83abd4e26e" +int(300) +Done diff --git a/ext/oci8/tests/bug36010.phpt b/ext/oci8/tests/bug36010.phpt new file mode 100644 index 000000000..ef435496a --- /dev/null +++ b/ext/oci8/tests/bug36010.phpt @@ -0,0 +1,26 @@ +--TEST-- +bug #36010 (Crash when executing SQL statment with lob parameter twice) +--SKIPIF-- +<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> +--FILE-- +<?php + +require dirname(__FILE__).'/connect.inc'; + +function f($conn) +{ + $sql = "begin :p_clob := 'lob string'; end;"; + $stid = oci_parse($conn, $sql); + $clob = oci_new_descriptor($conn, OCI_D_LOB); + oci_bind_by_name($stid, ":p_clob", $clob, -1, OCI_B_CLOB); + $r = oci_execute($stid, OCI_DEFAULT); +} + +f($c); +f($c); + +echo "Done\n"; + +?> +--EXPECT-- +Done diff --git a/ext/oci8/tests/bug36096.phpt b/ext/oci8/tests/bug36096.phpt new file mode 100644 index 000000000..44b3a6ddc --- /dev/null +++ b/ext/oci8/tests/bug36096.phpt @@ -0,0 +1,28 @@ +--TEST-- +Bug #36096 (oci_result() returns garbage after oci_fetch() failed) +--SKIPIF-- +<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> +--FILE-- +<?php + +require dirname(__FILE__)."/connect.inc"; + +$sql = "SELECT 'ABC' FROM DUAL WHERE 1<>1"; +$stmt = oci_parse($c, $sql); + +if(oci_execute($stmt, OCI_COMMIT_ON_SUCCESS)){ + var_dump(oci_fetch($stmt)); + var_dump(oci_result($stmt, 1)); + var_dump(oci_field_name($stmt, 1)); + var_dump(oci_field_type($stmt, 1)); +} + +echo "Done\n"; + +?> +--EXPECT-- +bool(false) +bool(false) +string(5) "'ABC'" +string(4) "CHAR" +Done diff --git a/ext/oci8/tests/cursors.phpt b/ext/oci8/tests/cursors.phpt index 6c92a2b91..22c89c9c5 100644 --- a/ext/oci8/tests/cursors.phpt +++ b/ext/oci8/tests/cursors.phpt @@ -45,15 +45,21 @@ echo "Done\n"; ?> --EXPECTF-- -array(2) { +array(5) { ["ID"]=> string(1) "1" ["VALUE"]=> string(1) "1" + ["BLOB"]=> + NULL + ["CLOB"]=> + NULL + ["STRING"]=> + NULL } bool(true) -Warning: oci_fetch_assoc()%sORA-01002: fetch out of sequence in %scursors.php on line %d +Warning: oci_fetch_assoc(): ORA-01002: fetch out of sequence in %s on line %d bool(false) bool(true) Done diff --git a/ext/oci8/tests/debug.phpt b/ext/oci8/tests/debug.phpt index a3e393240..cc771d531 100644 --- a/ext/oci8/tests/debug.phpt +++ b/ext/oci8/tests/debug.phpt @@ -20,12 +20,14 @@ echo "Done\n"; ?> --EXPECTF-- -OCI8 DEBUG: OCINlsEnvironmentVariableGet in php_oci_do_connect_ex() (%s/oci8.c:%d) +OCI8 DEBUG: OCINlsEnvironmentVariableGet at (%s:%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) +OCI8 DEBUG: OCISessionEnd at (%s:%d) +OCI8 DEBUG: OCIHandleFree at (%s:%d) +OCI8 DEBUG: OCIServerDetach at (%s:%d) +OCI8 DEBUG: OCIHandleFree at (%s:%d) +OCI8 DEBUG: OCIHandleFree at (%s:%d) +OCI8 DEBUG: OCIHandleFree at (%s:%d) +OCI8 DEBUG: OCIHandleFree at (%s:%d) +OCI8 DEBUG: OCIHandleFree at (%s:%d) +OCI8 DEBUG: OCIHandleFree at (%s:%d) diff --git a/ext/oci8/tests/error1.phpt b/ext/oci8/tests/error1.phpt index 28408f9c9..8b358b612 100644 --- a/ext/oci8/tests/error1.phpt +++ b/ext/oci8/tests/error1.phpt @@ -12,7 +12,16 @@ echo "Done\n"; ?> --EXPECTF-- -Warning: oci_connect(): ORA-12154: TNS:could not resolve the connect identifier specified in %s on line %d -bool(false) +Warning: oci_connect(): ORA-12154: TNS:could not resolve service name in %s on line %d bool(false) +array(4) { + ["code"]=> + int(12154) + ["message"]=> + string(45) "ORA-12154: TNS:could not resolve service name" + ["offset"]=> + int(0) + ["sqltext"]=> + string(0) "" +} Done diff --git a/ext/oci8/tests/exec_fetch.phpt b/ext/oci8/tests/exec_fetch.phpt index 6734f6169..83aae69f7 100644 --- a/ext/oci8/tests/exec_fetch.phpt +++ b/ext/oci8/tests/exec_fetch.phpt @@ -16,4 +16,9 @@ var_dump(oci_fetch_array($stmt)); echo "Done\n"; ?> --EXPECTF-- +Warning: oci_execute(): ORA-00942: table or view does not exist in %s on line %d +bool(false) + +Warning: oci_fetch_array(): ORA-24374: define not done before fetch or execute and fetch in %s on line %d +bool(false) Done diff --git a/ext/oci8/tests/fetch_array.phpt b/ext/oci8/tests/fetch_array.phpt index bfffd4e7d..e2f32483d 100644 --- a/ext/oci8/tests/fetch_array.phpt +++ b/ext/oci8/tests/fetch_array.phpt @@ -77,7 +77,7 @@ require dirname(__FILE__).'/drop_table.inc'; echo "Done\n"; ?> --EXPECT-- -array(4) { +array(10) { [0]=> string(1) "1" ["ID"]=> @@ -86,8 +86,20 @@ array(4) { string(1) "1" ["VALUE"]=> string(1) "1" + [2]=> + NULL + ["BLOB"]=> + NULL + [3]=> + NULL + ["CLOB"]=> + NULL + [4]=> + NULL + ["STRING"]=> + NULL } -array(4) { +array(10) { [0]=> string(1) "1" ["ID"]=> @@ -96,8 +108,20 @@ array(4) { string(1) "1" ["VALUE"]=> string(1) "1" + [2]=> + NULL + ["BLOB"]=> + NULL + [3]=> + NULL + ["CLOB"]=> + NULL + [4]=> + NULL + ["STRING"]=> + NULL } -array(4) { +array(10) { [0]=> string(1) "1" ["ID"]=> @@ -106,6 +130,18 @@ array(4) { string(1) "1" ["VALUE"]=> string(1) "1" + [2]=> + NULL + ["BLOB"]=> + NULL + [3]=> + NULL + ["CLOB"]=> + NULL + [4]=> + NULL + ["STRING"]=> + NULL } array(2) { [0]=> @@ -173,58 +209,100 @@ array(4) { ["VALUE"]=> string(1) "1" } -array(2) { +array(4) { [0]=> string(1) "1" + ["ID"]=> + string(1) "1" [1]=> string(1) "1" + ["VALUE"]=> + string(1) "1" } -array(2) { +array(4) { [0]=> string(1) "1" + ["ID"]=> + string(1) "1" [1]=> string(1) "1" + ["VALUE"]=> + string(1) "1" } -array(2) { +array(4) { [0]=> string(1) "1" + ["ID"]=> + string(1) "1" [1]=> string(1) "1" + ["VALUE"]=> + string(1) "1" } -array(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 } -array(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 } -array(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_assoc.phpt b/ext/oci8/tests/fetch_assoc.phpt index 2c9590db5..7dacf2e5b 100644 --- a/ext/oci8/tests/fetch_assoc.phpt +++ b/ext/oci8/tests/fetch_assoc.phpt @@ -43,22 +43,40 @@ echo "Done\n"; ?> --EXPECT-- -array(2) { +array(5) { ["ID"]=> string(1) "1" ["VALUE"]=> string(1) "1" + ["BLOB"]=> + NULL + ["CLOB"]=> + NULL + ["STRING"]=> + NULL } -array(2) { +array(5) { ["ID"]=> string(1) "1" ["VALUE"]=> string(1) "1" + ["BLOB"]=> + NULL + ["CLOB"]=> + NULL + ["STRING"]=> + NULL } -array(2) { +array(5) { ["ID"]=> string(1) "1" ["VALUE"]=> string(1) "1" + ["BLOB"]=> + NULL + ["CLOB"]=> + NULL + ["STRING"]=> + NULL } Done diff --git a/ext/oci8/tests/fetch_object.phpt b/ext/oci8/tests/fetch_object.phpt index d6b2714b9..57b7fc03d 100644 --- a/ext/oci8/tests/fetch_object.phpt +++ b/ext/oci8/tests/fetch_object.phpt @@ -42,23 +42,41 @@ require dirname(__FILE__).'/drop_table.inc'; echo "Done\n"; ?> ---EXPECT-- -object(stdClass)#1 (2) { +--EXPECTF-- +object(stdClass)#%d (5) { ["ID"]=> string(1) "1" ["VALUE"]=> string(1) "1" + ["BLOB"]=> + NULL + ["CLOB"]=> + NULL + ["STRING"]=> + NULL } -object(stdClass)#2 (2) { +object(stdClass)#%d (5) { ["ID"]=> string(1) "1" ["VALUE"]=> string(1) "1" + ["BLOB"]=> + NULL + ["CLOB"]=> + NULL + ["STRING"]=> + NULL } -object(stdClass)#1 (2) { +object(stdClass)#%d (5) { ["ID"]=> string(1) "1" ["VALUE"]=> string(1) "1" + ["BLOB"]=> + NULL + ["CLOB"]=> + NULL + ["STRING"]=> + NULL } Done diff --git a/ext/oci8/tests/fetch_row.phpt b/ext/oci8/tests/fetch_row.phpt index d8a68cabb..a637ecc6f 100644 --- a/ext/oci8/tests/fetch_row.phpt +++ b/ext/oci8/tests/fetch_row.phpt @@ -43,22 +43,40 @@ echo "Done\n"; ?> --EXPECT-- -array(2) { +array(5) { [0]=> string(1) "1" [1]=> string(1) "1" + [2]=> + NULL + [3]=> + NULL + [4]=> + NULL } -array(2) { +array(5) { [0]=> string(1) "1" [1]=> string(1) "1" + [2]=> + NULL + [3]=> + NULL + [4]=> + NULL } -array(2) { +array(5) { [0]=> string(1) "1" [1]=> string(1) "1" + [2]=> + NULL + [3]=> + NULL + [4]=> + NULL } Done diff --git a/ext/oci8/tests/field_funcs.phpt b/ext/oci8/tests/field_funcs.phpt index 2f1dbd710..988e5f7a1 100644 --- a/ext/oci8/tests/field_funcs.phpt +++ b/ext/oci8/tests/field_funcs.phpt @@ -34,7 +34,7 @@ if (!oci_execute($s)) { die("oci_execute(select) failed!\n"); } -$row = oci_fetch_array($s, OCI_RETURN_NULLS + OCI_RETURN_LOBS); +$row = oci_fetch_array($s, OCI_NUM + OCI_RETURN_NULLS + OCI_RETURN_LOBS); var_dump($row); foreach ($row as $num => $field) { @@ -97,7 +97,7 @@ int(0) int(4000) bool(true) string(6) "STRING" -string(7) "VARCHAR" +string(8) "VARCHAR2" int(1) int(0) int(0) diff --git a/ext/oci8/tests/field_funcs1.phpt b/ext/oci8/tests/field_funcs1.phpt index 68986e051..b41e743e4 100644 --- a/ext/oci8/tests/field_funcs1.phpt +++ b/ext/oci8/tests/field_funcs1.phpt @@ -34,7 +34,7 @@ if (!oci_execute($s)) { die("oci_execute(select) failed!\n"); } -$row = oci_fetch_array($s, OCI_RETURN_NULLS + OCI_RETURN_LOBS); +$row = oci_fetch_array($s, OCI_NUM + OCI_RETURN_NULLS + OCI_RETURN_LOBS); var_dump($row); var_dump(oci_field_is_null($s, -1)); diff --git a/ext/oci8/tests/field_funcs_old.phpt b/ext/oci8/tests/field_funcs_old.phpt index 8627f6a78..34af09429 100644 --- a/ext/oci8/tests/field_funcs_old.phpt +++ b/ext/oci8/tests/field_funcs_old.phpt @@ -97,7 +97,7 @@ int(0) int(4000) bool(true) string(6) "STRING" -string(7) "VARCHAR" +string(8) "VARCHAR2" int(1) int(0) int(0) diff --git a/ext/oci8/tests/lob_001.phpt b/ext/oci8/tests/lob_001.phpt Binary files differindex 029888469..cbcb92e7e 100644 --- a/ext/oci8/tests/lob_001.phpt +++ b/ext/oci8/tests/lob_001.phpt diff --git a/ext/oci8/tests/lob_011.phpt b/ext/oci8/tests/lob_011.phpt index 2dd78985f..b074e1730 100644 --- a/ext/oci8/tests/lob_011.phpt +++ b/ext/oci8/tests/lob_011.phpt @@ -69,8 +69,10 @@ echo "Done\n"; int(32) bool(true) string(32) "some string here. string, I said" -array(1) { +array(2) { [0]=> string(32) "some string here. string, I said" + ["BLOB"]=> + string(32) "some string here. string, I said" } Done diff --git a/ext/oci8/tests/lob_019.phpt b/ext/oci8/tests/lob_019.phpt Binary files differnew file mode 100644 index 000000000..fb9a3c818 --- /dev/null +++ b/ext/oci8/tests/lob_019.phpt diff --git a/ext/oci8/tests/lob_020.phpt b/ext/oci8/tests/lob_020.phpt Binary files differnew file mode 100644 index 000000000..edd0f0249 --- /dev/null +++ b/ext/oci8/tests/lob_020.phpt diff --git a/ext/oci8/tests/select_null.phpt b/ext/oci8/tests/select_null.phpt index 20307b3e2..87c5b815f 100644 --- a/ext/oci8/tests/select_null.phpt +++ b/ext/oci8/tests/select_null.phpt @@ -16,8 +16,10 @@ var_dump(oci_fetch_array($stmt, OCI_RETURN_NULLS)); echo "Done\n"; ?> --EXPECT-- -array(1) { +array(2) { [0]=> NULL + ["NULL"]=> + NULL } Done diff --git a/ext/oci8/tests/test.gif b/ext/oci8/tests/test.gif Binary files differnew file mode 100644 index 000000000..f352c7308 --- /dev/null +++ b/ext/oci8/tests/test.gif |