diff options
24 files changed, 2275 insertions, 340 deletions
diff --git a/ext/oci8/tests/bind_char_1.phpt b/ext/oci8/tests/bind_char_1.phpt index 36574dbfbb..71cccbfc50 100644 --- a/ext/oci8/tests/bind_char_1.phpt +++ b/ext/oci8/tests/bind_char_1.phpt @@ -5,14 +5,17 @@ SELECT oci_bind_by_name with SQLT_AFC aka CHAR if (!extension_loaded('oci8')) die ("skip no oci8 extension"); require(dirname(__FILE__)."/connect.inc"); $sv = oci_server_version($c); -$sv = preg_match('/Release 1[12]\./', $sv, $matches); +$sv = preg_match('/Release 1[01]\.2\./', $sv, $matches); if ($sv !== 1) { - die ("skip expected output only valid when using Oracle 11g+ database"); + die ("skip expected output only valid when using Oracle 10gR2 or 11gR2 databases"); } ?> --FILE-- <?php +// Note: expected output is valid for 32bit clients to 32bit 10gR2 XE or 11.2.0.1 64bit DBs. +// It will diff on the undefined cases with a 32bit 11.2.0.1 DB + require(dirname(__FILE__).'/connect.inc'); // Initialization @@ -219,7 +222,9 @@ Test 1.2: Type: AFC. Length: default :: Test 1.3: Type: AFC: Length: 0 Querying: - Oci_execute error ORA-1460 Exiting Query + :1: + :abc : + :: Test 1.4: Type: AFC: Length: strlen Querying: :1: @@ -227,7 +232,9 @@ Test 1.4: Type: AFC: Length: strlen :: Test 1.5: Type: AFC. Length: strlen-1 Querying: - Oci_execute error ORA-1460 Exiting Query + :1: + :abc : + :: Test 1.6: Type: AFC. Length: strlen+1 Querying: :1: @@ -263,7 +270,9 @@ Test 3.2: Type: AFC. Length: default :abc: Test 3.3: Type: AFC: Length: 0 Querying: - Oci_execute error ORA-1460 Exiting Query + :2: + :: + :abc: Test 3.4: Type: AFC: Length: strlen Querying: :2: @@ -271,7 +280,9 @@ Test 3.4: Type: AFC: Length: strlen :abc: Test 3.5: Type: AFC. Length: strlen-1 Querying: - Oci_execute error ORA-1460 Exiting Query + :2: + :: + :abc: Test 3.6: Type: AFC. Length: strlen+1 Querying: :2: diff --git a/ext/oci8/tests/bind_char_1_11gR1.phpt b/ext/oci8/tests/bind_char_1_11gR1.phpt new file mode 100644 index 0000000000..60b7142ff1 --- /dev/null +++ b/ext/oci8/tests/bind_char_1_11gR1.phpt @@ -0,0 +1,297 @@ +--TEST-- +SELECT oci_bind_by_name with SQLT_AFC aka CHAR +--SKIPIF-- +<?php +if (!extension_loaded('oci8')) die ("skip no oci8 extension"); +require(dirname(__FILE__)."/connect.inc"); +$sv = oci_server_version($c); +$sv = preg_match('/Release 11\.1\./', $sv, $matches); +if ($sv !== 1) { + die ("skip expected output only valid when using Oracle 11gR1 database"); +} +?> +--FILE-- +<?php + +// Output is for 32 bit client to 64bit 11.1.0.6 + +require(dirname(__FILE__).'/connect.inc'); + +// Initialization + +$stmtarray = array( + "drop table bind_char_tab", + "create table bind_char_tab (id number, c1 char(10), c2 varchar2(10))", + "insert into bind_char_tab values (1, 'abc', NULL)", + "insert into bind_char_tab values (2, NULL, 'abc')", + "insert into bind_char_tab values (3, NULL, 'abc ')" +); + +foreach ($stmtarray as $stmt) { + $s = oci_parse($c, $stmt); + @oci_execute($s); +} + +// Run Test + +echo "*** Non-null Data Tests against CHAR***\n"; + +$bv1 = 'abc'; + +echo "Test 1.1: Type: default. Length: default\n"; +$s = oci_parse($c, "select * from bind_char_tab where c1 = :bv"); +$r = oci_bind_by_name($s, ":bv", $bv1); +if ($r) + do_e_q($s); + +echo "Test 1.2: Type: AFC. Length: default\n"; +$r = oci_bind_by_name($s, ":bv", $bv1, -1, SQLT_AFC); +if ($r) + do_e_q($s); + +echo "Test 1.3: Type: AFC: Length: 0\n"; +$r = oci_bind_by_name($s, ":bv", $bv1, 0, SQLT_AFC); +if ($r) + do_e_q($s); + +echo "Test 1.4: Type: AFC: Length: strlen\n"; +$r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1), SQLT_AFC); +if ($r) + do_e_q($s); + +echo "Test 1.5: Type: AFC. Length: strlen-1\n"; +$r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1)-1, SQLT_AFC); +if ($r) + do_e_q($s); + +echo "Test 1.6: Type: AFC. Length: strlen+1\n"; +$r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1)+1, SQLT_AFC); +if ($r) + do_e_q($s); + +echo "\n\n*** NULL data tests against CHAR ***\n"; + +$bv1 = null; + +echo "Test 2.1: Type: default. Length: default\n"; +$s = oci_parse($c, "select * from bind_char_tab where c1 = :bv"); +$r = oci_bind_by_name($s, ":bv", $bv1); +if ($r) + do_e_q($s); + +echo "Test 2.2: Type: AFC. Length: default\n"; +$r = oci_bind_by_name($s, ":bv", $bv1, -1, SQLT_AFC); +if ($r) + do_e_q($s); + +echo "Test 2.3: Type: AFC: Length: 0\n"; +$r = oci_bind_by_name($s, ":bv", $bv1, 0, SQLT_AFC); +if ($r) + do_e_q($s); + +echo "Test 2.4: Type: AFC: Length: strlen\n"; +$r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1), SQLT_AFC); +if ($r) + do_e_q($s); + +echo "Test 2.5: Type: AFC. Length: strlen-1\n"; +$r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1)-1, SQLT_AFC); +if ($r) + do_e_q($s); + +echo "Test 2.6: Type: AFC. Length: strlen+1\n"; +$r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1)+1, SQLT_AFC); +if ($r) + do_e_q($s); + + +echo "\n\n*** Non-null Data Tests against VARCHAR2***\n"; + +$bv1 = 'abc'; + +echo "Test 3.1: Type: default. Length: default\n"; +$s = oci_parse($c, "select * from bind_char_tab where c2 = :bv"); +$r = oci_bind_by_name($s, ":bv", $bv1); +if ($r) + do_e_q($s); + +echo "Test 3.2: Type: AFC. Length: default\n"; +$r = oci_bind_by_name($s, ":bv", $bv1, -1, SQLT_AFC); +if ($r) + do_e_q($s); + +echo "Test 3.3: Type: AFC: Length: 0\n"; +$r = oci_bind_by_name($s, ":bv", $bv1, 0, SQLT_AFC); +if ($r) + do_e_q($s); + +echo "Test 3.4: Type: AFC: Length: strlen\n"; +$r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1), SQLT_AFC); +if ($r) + do_e_q($s); + +echo "Test 3.5: Type: AFC. Length: strlen-1\n"; +$r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1)-1, SQLT_AFC); +if ($r) + do_e_q($s); + +echo "Test 3.6: Type: AFC. Length: strlen+1\n"; +$r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1)+1, SQLT_AFC); +if ($r) + do_e_q($s); + + +echo "\n\n*** NULL data tests against VARCHAR2 ***\n"; + +$bv1 = null; + +echo "Test 4.1: Type: default. Length: default\n"; +$s = oci_parse($c, "select * from bind_char_tab where c2 = :bv"); +$r = oci_bind_by_name($s, ":bv", $bv1); +if ($r) + do_e_q($s); + +echo "Test 4.2: Type: AFC. Length: default\n"; +$r = oci_bind_by_name($s, ":bv", $bv1, -1, SQLT_AFC); +if ($r) + do_e_q($s); + +echo "Test 4.3: Type: AFC: Length: 0\n"; +$r = oci_bind_by_name($s, ":bv", $bv1, 0, SQLT_AFC); +if ($r) + do_e_q($s); + +echo "Test 4.4: Type: AFC: Length: strlen\n"; +$r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1), SQLT_AFC); +if ($r) + do_e_q($s); + +echo "Test 4.5: Type: AFC. Length: strlen-1\n"; +$r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1)-1, SQLT_AFC); +if ($r) + do_e_q($s); + +echo "Test 4.6: Type: AFC. Length: strlen+1\n"; +$r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1)+1, SQLT_AFC); +if ($r) + do_e_q($s); + + + +function do_e_q($s) +{ + echo " Querying:\n"; + + $r = @oci_execute($s); + if (!$r) { + $m = oci_error($s); + echo " Oci_execute error ORA-".$m['code']." Exiting Query\n"; + return; + } + while ($row = oci_fetch_array($s, OCI_ASSOC+OCI_RETURN_NULLS)) { + foreach ($row as $item) { + echo " :" . $item . ":\n"; + } + } +} + +// Cleanup +$stmtarray = array( + "drop table bind_char_tab" +); + +foreach ($stmtarray as $stmt) { + $s = oci_parse($c, $stmt); + oci_execute($s); +} + +oci_close($c); + +echo "Done\n"; + +?> +--EXPECT-- +*** Non-null Data Tests against CHAR*** +Test 1.1: Type: default. Length: default + Querying: +Test 1.2: Type: AFC. Length: default + Querying: + :1: + :abc : + :: +Test 1.3: Type: AFC: Length: 0 + Querying: + Oci_execute error ORA-1460 Exiting Query +Test 1.4: Type: AFC: Length: strlen + Querying: + :1: + :abc : + :: +Test 1.5: Type: AFC. Length: strlen-1 + Querying: + Oci_execute error ORA-1460 Exiting Query +Test 1.6: Type: AFC. Length: strlen+1 + Querying: + :1: + :abc : + :: + + +*** NULL data tests against CHAR *** +Test 2.1: Type: default. Length: default + Querying: +Test 2.2: Type: AFC. Length: default + Querying: +Test 2.3: Type: AFC: Length: 0 + Querying: +Test 2.4: Type: AFC: Length: strlen + Querying: +Test 2.5: Type: AFC. Length: strlen-1 + Querying: +Test 2.6: Type: AFC. Length: strlen+1 + Querying: + + +*** Non-null Data Tests against VARCHAR2*** +Test 3.1: Type: default. Length: default + Querying: + :2: + :: + :abc: +Test 3.2: Type: AFC. Length: default + Querying: + :2: + :: + :abc: +Test 3.3: Type: AFC: Length: 0 + Querying: + Oci_execute error ORA-1460 Exiting Query +Test 3.4: Type: AFC: Length: strlen + Querying: + :2: + :: + :abc: +Test 3.5: Type: AFC. Length: strlen-1 + Querying: + Oci_execute error ORA-1460 Exiting Query +Test 3.6: Type: AFC. Length: strlen+1 + Querying: + :2: + :: + :abc: + + +*** NULL data tests against VARCHAR2 *** +Test 4.1: Type: default. Length: default + Querying: +Test 4.2: Type: AFC. Length: default + Querying: +Test 4.3: Type: AFC: Length: 0 + Querying: +Test 4.4: Type: AFC: Length: strlen + Querying: +Test 4.5: Type: AFC. Length: strlen-1 + Querying: +Test 4.6: Type: AFC. Length: strlen+1 + Querying: +Done diff --git a/ext/oci8/tests/bind_char_2.phpt b/ext/oci8/tests/bind_char_2.phpt index f0f41663f5..6c7dbafcc5 100644 --- a/ext/oci8/tests/bind_char_2.phpt +++ b/ext/oci8/tests/bind_char_2.phpt @@ -5,14 +5,17 @@ SELECT oci_bind_by_name with SQLT_AFC aka CHAR and dates if (!extension_loaded('oci8')) die ("skip no oci8 extension"); require(dirname(__FILE__)."/connect.inc"); $sv = oci_server_version($c); -$sv = preg_match('/Release 1[12]\./', $sv, $matches); +$sv = preg_match('/Release 1[01]\.2\./', $sv, $matches); if ($sv !== 1) { - die ("skip expected output only valid when using Oracle 11g+ database"); + die ("skip expected output only valid when using Oracle 10gR2 or 11gR2 databases"); } ?> --FILE-- <?php +// Note: expected output is valid for 32bit clients to 32bit 10gR2 XE or 11.2.0.1 64bit DBs. +// It will diff on the undefined cases with a 32bit 11.2.0.1 DB + require(dirname(__FILE__).'/connect.inc'); // Initialization @@ -115,7 +118,8 @@ Test 1.4: Type: AFC: Length: strlen :2008-04-20: Test 1.5: Type: AFC. Length: strlen-1 Querying: - Oci_execute error ORA-1460 Exiting Query + :1: + :2008-04-20: Test 1.6: Type: AFC. Length: strlen+1 Querying: :1: diff --git a/ext/oci8/tests/bind_char_2_11gR1.phpt b/ext/oci8/tests/bind_char_2_11gR1.phpt new file mode 100644 index 0000000000..68a872fc46 --- /dev/null +++ b/ext/oci8/tests/bind_char_2_11gR1.phpt @@ -0,0 +1,123 @@ +--TEST-- +SELECT oci_bind_by_name with SQLT_AFC aka CHAR and dates +--SKIPIF-- +<?php +if (!extension_loaded('oci8')) die ("skip no oci8 extension"); +require(dirname(__FILE__)."/connect.inc"); +$sv = oci_server_version($c); +$sv = preg_match('/Release 11\.1\./', $sv, $matches); +if ($sv !== 1) { + die ("skip expected output only valid when using Oracle 11gR1 database"); +} +?> +--FILE-- +<?php + +require(dirname(__FILE__).'/connect.inc'); + +// Initialization + +$stmtarray = array( + "alter session set nls_date_format='YYYY-MM-DD'", + "drop table bind_char_tab", + "create table bind_char_tab (id number, c1 date)", + "insert into bind_char_tab values (1, '2008-04-20')", +); + +foreach ($stmtarray as $stmt) { + $s = oci_parse($c, $stmt); + @oci_execute($s); +} + +// Run Test + +$bv1 = '2008-04-20'; + +echo "Test 1.1: Type: default. Length: default\n"; +$s = oci_parse($c, "select * from bind_char_tab where c1 = :bv"); +$r = oci_bind_by_name($s, ":bv", $bv1); +if ($r) + do_e_q($s); + +echo "Test 1.2: Type: AFC. Length: default\n"; +$r = oci_bind_by_name($s, ":bv", $bv1, -1, SQLT_AFC); +if ($r) + do_e_q($s); + +echo "Test 1.3: Type: AFC: Length: 0\n"; +$r = oci_bind_by_name($s, ":bv", $bv1, 0, SQLT_AFC); +if ($r) + do_e_q($s); + +echo "Test 1.4: Type: AFC: Length: strlen\n"; +$r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1), SQLT_AFC); +if ($r) + do_e_q($s); + +echo "Test 1.5: Type: AFC. Length: strlen-1\n"; +$r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1)-1, SQLT_AFC); +if ($r) + do_e_q($s); + +echo "Test 1.6: Type: AFC. Length: strlen+1\n"; +$r = oci_bind_by_name($s, ":bv", $bv1, strlen($bv1)+1, SQLT_AFC); +if ($r) + do_e_q($s); + + +function do_e_q($s) +{ + echo " Querying:\n"; + + $r = @oci_execute($s); + if (!$r) { + $m = oci_error($s); + echo " Oci_execute error ORA-".$m['code']." Exiting Query\n"; + return; + } + while ($row = oci_fetch_array($s, OCI_ASSOC+OCI_RETURN_NULLS)) { + foreach ($row as $item) { + echo " :" . $item . ":\n"; + } + } +} + +// Cleanup +$stmtarray = array( + "drop table bind_char_tab" +); + +foreach ($stmtarray as $stmt) { + $s = oci_parse($c, $stmt); + oci_execute($s); +} + +oci_close($c); + +echo "Done\n"; + +?> +--EXPECT-- +Test 1.1: Type: default. Length: default + Querying: + :1: + :2008-04-20: +Test 1.2: Type: AFC. Length: default + Querying: + :1: + :2008-04-20: +Test 1.3: Type: AFC: Length: 0 + Querying: + Oci_execute error ORA-1460 Exiting Query +Test 1.4: Type: AFC: Length: strlen + Querying: + :1: + :2008-04-20: +Test 1.5: Type: AFC. Length: strlen-1 + Querying: + Oci_execute error ORA-1460 Exiting Query +Test 1.6: Type: AFC. Length: strlen+1 + Querying: + :1: + :2008-04-20: +Done diff --git a/ext/oci8/tests/bind_char_3.phpt b/ext/oci8/tests/bind_char_3.phpt index 6d1b31150f..8d4e95f6bf 100644 --- a/ext/oci8/tests/bind_char_3.phpt +++ b/ext/oci8/tests/bind_char_3.phpt @@ -5,14 +5,17 @@ PL/SQL oci_bind_by_name with SQLT_AFC aka CHAR to CHAR parameter if (!extension_loaded('oci8')) die ("skip no oci8 extension"); require(dirname(__FILE__)."/connect.inc"); $sv = oci_server_version($c); -$sv = preg_match('/Release 1[12]\./', $sv, $matches); +$sv = preg_match('/Release 1[01]\.2\./', $sv, $matches); if ($sv !== 1) { - die ("skip expected output only valid when using Oracle 11g+ database"); + die ("skip expected output only valid when using Oracle 10gR2 11gR2 databases"); } ?> --FILE-- <?php +// Note: expected output is valid for 32bit clients to 32bit 10gR2 XE or 11.2.0.1 64bit DBs. +// It will diff on the undefined cases with a 32bit 11.2.0.1 DB + require(dirname(__FILE__).'/connect.inc'); // Initialization @@ -254,9 +257,8 @@ echo "Done\n"; --EXPECTF-- Test 1.1 In Length: default. In Type: default. Out Length: default. Out Type: default Executing: - Oci_execute error ORA-6502 string(3) "abc" -NULL +string(3) "abc" Test 1.2 In Length: default. In Type: default. Out Length: 10. Out Type: default Executing: string(3) "abc" @@ -268,20 +270,19 @@ string(3) "abc" Test 1.4 In Length: -1. In Type: AFC. Out Length: 10. Out Type: AFC Executing: string(3) "abc" -string(10) "abc " +string(30) "abc " Test 1.5 In Length: strlen. In Type: AFC. Out Length: strlen(input). Out Type: AFC Executing: string(3) "abc" -string(3) "abc" +string(9) "abc " Test 1.6 In Length: strlen. In Type: AFC. Out Length: strlen(input)-1. Out Type: AFC Executing: - Oci_execute error ORA-6502 -string(3) "abc" string(3) "abc" +string(6) "abc " Test 1.7 In Length: strlen. In Type: AFC. Out Length: strlen(input)+1. Out Type: AFC Executing: string(3) "abc" -string(4) "abc " +string(12) "abc " Tests with '' diff --git a/ext/oci8/tests/bind_char_3_11gR1.phpt b/ext/oci8/tests/bind_char_3_11gR1.phpt new file mode 100644 index 0000000000..aaa5371195 --- /dev/null +++ b/ext/oci8/tests/bind_char_3_11gR1.phpt @@ -0,0 +1,344 @@ +--TEST-- +PL/SQL oci_bind_by_name with SQLT_AFC aka CHAR to CHAR parameter +--SKIPIF-- +<?php +if (!extension_loaded('oci8')) die ("skip no oci8 extension"); +require(dirname(__FILE__)."/connect.inc"); +$sv = oci_server_version($c); +$sv = preg_match('/Release 11\.1\./', $sv, $matches); +if ($sv !== 1) { + die ("skip expected output only valid when using Oracle 11gR1 database"); +} +?> +--FILE-- +<?php + +require(dirname(__FILE__).'/connect.inc'); + +// Initialization + +$stmtarray = array( + "create or replace function bind_char_3_fn(p1 char) return char as begin return p1; end;", +); + +foreach ($stmtarray as $stmt) { + $s = oci_parse($c, $stmt); + @oci_execute($s); +} + +// Run Test + +echo "Test 1.1 In Length: default. In Type: default. Out Length: default. Out Type: default\n"; + +$s = oci_parse($c, "begin :bv2 := bind_char_3_fn(:bv1); end;"); +$bv1 = 'abc'; +$r = oci_bind_by_name($s, ':bv1', $bv1) && oci_bind_by_name($s, ':bv2', $bv2); +if ($r) + do_e($s); +var_dump($bv1, $bv2); + +echo "Test 1.2 In Length: default. In Type: default. Out Length: 10. Out Type: default\n"; + +$bv1 = 'abc'; +$r = oci_bind_by_name($s, ':bv1', $bv1) && oci_bind_by_name($s, ':bv2', $bv2, 10); +if ($r) + do_e($s); +var_dump($bv1, $bv2); + + +echo "Test 1.3 In Length: -1. In Type: AFC. Out Length: 10. Out Type: default\n"; + +$bv1 = 'abc'; +$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10); +if ($r) + do_e($s); +var_dump($bv1, $bv2); + + + +echo "Test 1.4 In Length: -1. In Type: AFC. Out Length: 10. Out Type: AFC\n"; + +$bv1 = 'abc'; +$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10, SQLT_AFC); +if ($r) + do_e($s); +var_dump($bv1, $bv2); + + +echo "Test 1.5 In Length: strlen. In Type: AFC. Out Length: strlen(input). Out Type: AFC\n"; + +$bv1 = 'abc'; +$r = oci_bind_by_name($s, ':bv1', $bv1, strlen($bv1), SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, strlen($bv1), SQLT_AFC); +if ($r) + do_e($s); +var_dump($bv1, $bv2); + + +echo "Test 1.6 In Length: strlen. In Type: AFC. Out Length: strlen(input)-1. Out Type: AFC\n"; + +$bv1 = 'abc'; +$r = oci_bind_by_name($s, ':bv1', $bv1, strlen($bv1), SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, strlen($bv1)-1, SQLT_AFC); +if ($r) + do_e($s); +var_dump($bv1, $bv2); + + +echo "Test 1.7 In Length: strlen. In Type: AFC. Out Length: strlen(input)+1. Out Type: AFC\n"; + +$bv1 = 'abc'; +$r = oci_bind_by_name($s, ':bv1', $bv1, strlen($bv1), SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, strlen($bv1)+1, SQLT_AFC); +if ($r) + do_e($s); +var_dump($bv1, $bv2); + + +echo "\n\nTests with ''\n\n"; + +echo "Test 2.1 In Length: -1. In Type: AFC. Out Length: 10. Out Type: AFC\n"; + +$bv1 = ''; +$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10, SQLT_AFC); +if ($r) + do_e($s); +var_dump($bv1, $bv2); + + +echo "Test 2.2 In Length: default. In Type: default. Out Length: 10. Out Type: default\n"; + +$r = oci_bind_by_name($s, ':bv1', $bv1) && oci_bind_by_name($s, ':bv2', $bv2, 10); +if ($r) + do_e($s); +var_dump($bv1, $bv2); + + + +echo "Test 2.3 In Length: -1. In Type: AFC. Out Length: 10. Out Type: default\n"; + +$bv1 = ''; +$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10); +if ($r) + do_e($s); +var_dump($bv1, $bv2); + + + +echo "Test 2.4 In Length: -1. In Type: AFC. Out Length: 10. Out Type: AFC\n"; + +$bv1 = ''; +$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10, SQLT_AFC); +if ($r) + do_e($s); +var_dump($bv1, $bv2); + + + +echo "Test 2.5 In Length: -1. In Type: AFC. Out Length: 0. Out Type: AFC\n"; + +$bv1 = ''; +$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 0, SQLT_AFC); +if ($r) + do_e($s); +var_dump($bv1, $bv2); + + + +echo "Test 2.6 In Length: 0. In Type: AFC. Out Length: 0. Out Type: AFC\n"; + +$bv1 = ''; +$r = oci_bind_by_name($s, ':bv1', $bv1, 0, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 0, SQLT_AFC); +if ($r) + do_e($s); +var_dump($bv1, $bv2); + + + +echo "Test 2.7 In Length: 1. In Type: AFC. Out Length: 1. Out Type: AFC\n"; + +$bv1 = ''; +$r = oci_bind_by_name($s, ':bv1', $bv1, 1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 1, SQLT_AFC); +if ($r) + do_e($s); +var_dump($bv1, $bv2); + + + +echo "\n\nTests with NULL\n"; + +echo "Test 3.1 In Length: -1. In Type: AFC. Out Length: 10. Out Type: AFC\n"; + +$bv1 = null; +$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10, SQLT_AFC); +if ($r) + do_e($s); +var_dump($bv1, $bv2); + + +echo "Test 3.2 In Length: default. In Type: default. Out Length: 10. Out Type: default\n"; + +$bv1 = null; +$r = oci_bind_by_name($s, ':bv1', $bv1) && oci_bind_by_name($s, ':bv2', $bv2, 10); +if ($r) + do_e($s); +var_dump($bv1, $bv2); + + + +echo "Test 3.3 In Length: -1. In Type: AFC. Out Length: 10. Out Type: default\n"; + +$bv1 = null; +$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10); +if ($r) + do_e($s); +var_dump($bv1, $bv2); + + + +echo "Test 3.4 In Length: -1. In Type: AFC. Out Length: 10. Out Type: AFC\n"; + +$bv1 = null; +$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10, SQLT_AFC); +if ($r) + do_e($s); +var_dump($bv1, $bv2); + + +echo "Test 3.5 In Length: -1. In Type: AFC. Out Length: 0. Out Type: AFC\n"; + +$bv1 = null; +$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 0, SQLT_AFC); +if ($r) + do_e($s); +var_dump($bv1, $bv2); + + + +echo "Test 3.6 In Length: -1. In Type: AFC. Out Length: 1. Out Type: AFC\n"; + +$bv1 = null; +$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 1, SQLT_AFC); +if ($r) + do_e($s); +var_dump($bv1, $bv2); + + +function do_e($s) +{ + echo " Executing:\n"; + + $r = @oci_execute($s); + if (!$r) { + $m = oci_error($s); + echo " Oci_execute error ORA-".$m['code']."\n"; + return; + } +} + +// Cleanup + +//require(dirname(__FILE__).'/drop_table.inc'); + +$stmtarray = array( + "drop function bind_char_3_fn" +); + +foreach ($stmtarray as $stmt) { + $s = oci_parse($c, $stmt); + oci_execute($s); +} + +oci_close($c); + +echo "Done\n"; + +?> +--EXPECTF-- +Test 1.1 In Length: default. In Type: default. Out Length: default. Out Type: default + Executing: + Oci_execute error ORA-6502 +string(3) "abc" +NULL +Test 1.2 In Length: default. In Type: default. Out Length: 10. Out Type: default + Executing: +string(3) "abc" +string(3) "abc" +Test 1.3 In Length: -1. In Type: AFC. Out Length: 10. Out Type: default + Executing: +string(3) "abc" +string(3) "abc" +Test 1.4 In Length: -1. In Type: AFC. Out Length: 10. Out Type: AFC + Executing: +string(3) "abc" +string(10) "abc " +Test 1.5 In Length: strlen. In Type: AFC. Out Length: strlen(input). Out Type: AFC + Executing: +string(3) "abc" +string(3) "abc" +Test 1.6 In Length: strlen. In Type: AFC. Out Length: strlen(input)-1. Out Type: AFC + Executing: + Oci_execute error ORA-6502 +string(3) "abc" +string(3) "abc" +Test 1.7 In Length: strlen. In Type: AFC. Out Length: strlen(input)+1. Out Type: AFC + Executing: +string(3) "abc" +string(4) "abc " + + +Tests with '' + +Test 2.1 In Length: -1. In Type: AFC. Out Length: 10. Out Type: AFC + Executing: +string(0) "" +NULL +Test 2.2 In Length: default. In Type: default. Out Length: 10. Out Type: default + Executing: +string(0) "" +NULL +Test 2.3 In Length: -1. In Type: AFC. Out Length: 10. Out Type: default + Executing: +string(0) "" +NULL +Test 2.4 In Length: -1. In Type: AFC. Out Length: 10. Out Type: AFC + Executing: +string(0) "" +NULL +Test 2.5 In Length: -1. In Type: AFC. Out Length: 0. Out Type: AFC + Executing: +string(0) "" +NULL +Test 2.6 In Length: 0. In Type: AFC. Out Length: 0. Out Type: AFC + Executing: +string(0) "" +NULL +Test 2.7 In Length: 1. In Type: AFC. Out Length: 1. Out Type: AFC + Executing: +string(0) "" +NULL + + +Tests with NULL +Test 3.1 In Length: -1. In Type: AFC. Out Length: 10. Out Type: AFC + Executing: +NULL +NULL +Test 3.2 In Length: default. In Type: default. Out Length: 10. Out Type: default + Executing: +NULL +NULL +Test 3.3 In Length: -1. In Type: AFC. Out Length: 10. Out Type: default + Executing: +NULL +NULL +Test 3.4 In Length: -1. In Type: AFC. Out Length: 10. Out Type: AFC + Executing: +NULL +NULL +Test 3.5 In Length: -1. In Type: AFC. Out Length: 0. Out Type: AFC + Executing: +NULL +NULL +Test 3.6 In Length: -1. In Type: AFC. Out Length: 1. Out Type: AFC + Executing: +NULL +NULL +Done diff --git a/ext/oci8/tests/bind_char_4.phpt b/ext/oci8/tests/bind_char_4.phpt index 7377604b0c..40221b266f 100644 --- a/ext/oci8/tests/bind_char_4.phpt +++ b/ext/oci8/tests/bind_char_4.phpt @@ -5,14 +5,17 @@ PL/SQL oci_bind_by_name with SQLT_AFC aka CHAR to VARCHAR2 parameter if (!extension_loaded('oci8')) die ("skip no oci8 extension"); require(dirname(__FILE__)."/connect.inc"); $sv = oci_server_version($c); -$sv = preg_match('/Release 1[12]\./', $sv, $matches); +$sv = preg_match('/Release 1[01]\.2\./', $sv, $matches); if ($sv !== 1) { - die ("skip expected output only valid when using Oracle 11g+ database"); + die ("skip expected output only valid when using Oracle 10gR2 or 11gR2 databases"); } ?> --FILE-- <?php +// Note: expected output is valid for 32bit clients to 32bit 10gR2 XE or 11.2.0.1 64bit DBs. +// It will diff on the undefined cases with a 32bit 11.2.0.1 DB + // Same test as bind_char_3 but the PL/SQL function uses VARCHAR2 instead of CHAR require(dirname(__FILE__).'/connect.inc'); @@ -256,9 +259,8 @@ echo "Done\n"; --EXPECTF-- Test 1.1 In Length: default. In Type: default. Out Length: default. Out Type: default Executing: - Oci_execute error ORA-6502 string(3) "abc" -NULL +string(3) "abc" Test 1.2 In Length: default. In Type: default. Out Length: 10. Out Type: default Executing: string(3) "abc" @@ -270,20 +272,19 @@ string(3) "abc" Test 1.4 In Length: -1. In Type: AFC. Out Length: 10. Out Type: AFC Executing: string(3) "abc" -string(10) "abc " +string(30) "abc " Test 1.5 In Length: strlen. In Type: AFC. Out Length: strlen(input). Out Type: AFC Executing: string(3) "abc" -string(3) "abc" +string(9) "abc " Test 1.6 In Length: strlen. In Type: AFC. Out Length: strlen(input)-1. Out Type: AFC Executing: - Oci_execute error ORA-6502 -string(3) "abc" string(3) "abc" +string(6) "abc " Test 1.7 In Length: strlen. In Type: AFC. Out Length: strlen(input)+1. Out Type: AFC Executing: string(3) "abc" -string(4) "abc " +string(12) "abc " Tests with '' diff --git a/ext/oci8/tests/bind_char_4_11gR1.phpt b/ext/oci8/tests/bind_char_4_11gR1.phpt new file mode 100644 index 0000000000..c4f7968e14 --- /dev/null +++ b/ext/oci8/tests/bind_char_4_11gR1.phpt @@ -0,0 +1,346 @@ +--TEST-- +PL/SQL oci_bind_by_name with SQLT_AFC aka CHAR to VARCHAR2 parameter +--SKIPIF-- +<?php +if (!extension_loaded('oci8')) die ("skip no oci8 extension"); +require(dirname(__FILE__)."/connect.inc"); +$sv = oci_server_version($c); +$sv = preg_match('/Release 11\.1\./', $sv, $matches); +if ($sv !== 1) { + die ("skip expected output only valid when using Oracle 11gR1 database"); +} +?> +--FILE-- +<?php + +// Same test as bind_char_3 but the PL/SQL function uses VARCHAR2 instead of CHAR + +require(dirname(__FILE__).'/connect.inc'); + +// Initialization + +$stmtarray = array( + "create or replace function bind_char_3_fn(p1 varchar2) return varchar2 as begin return p1; end;", +); + +foreach ($stmtarray as $stmt) { + $s = oci_parse($c, $stmt); + @oci_execute($s); +} + +// Run Test + +echo "Test 1.1 In Length: default. In Type: default. Out Length: default. Out Type: default\n"; + +$s = oci_parse($c, "begin :bv2 := bind_char_3_fn(:bv1); end;"); +$bv1 = 'abc'; +$r = oci_bind_by_name($s, ':bv1', $bv1) && oci_bind_by_name($s, ':bv2', $bv2); +if ($r) + do_e($s); +var_dump($bv1, $bv2); + +echo "Test 1.2 In Length: default. In Type: default. Out Length: 10. Out Type: default\n"; + +$bv1 = 'abc'; +$r = oci_bind_by_name($s, ':bv1', $bv1) && oci_bind_by_name($s, ':bv2', $bv2, 10); +if ($r) + do_e($s); +var_dump($bv1, $bv2); + + +echo "Test 1.3 In Length: -1. In Type: AFC. Out Length: 10. Out Type: default\n"; + +$bv1 = 'abc'; +$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10); +if ($r) + do_e($s); +var_dump($bv1, $bv2); + + + +echo "Test 1.4 In Length: -1. In Type: AFC. Out Length: 10. Out Type: AFC\n"; + +$bv1 = 'abc'; +$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10, SQLT_AFC); +if ($r) + do_e($s); +var_dump($bv1, $bv2); + + +echo "Test 1.5 In Length: strlen. In Type: AFC. Out Length: strlen(input). Out Type: AFC\n"; + +$bv1 = 'abc'; +$r = oci_bind_by_name($s, ':bv1', $bv1, strlen($bv1), SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, strlen($bv1), SQLT_AFC); +if ($r) + do_e($s); +var_dump($bv1, $bv2); + + +echo "Test 1.6 In Length: strlen. In Type: AFC. Out Length: strlen(input)-1. Out Type: AFC\n"; + +$bv1 = 'abc'; +$r = oci_bind_by_name($s, ':bv1', $bv1, strlen($bv1), SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, strlen($bv1)-1, SQLT_AFC); +if ($r) + do_e($s); +var_dump($bv1, $bv2); + + +echo "Test 1.7 In Length: strlen. In Type: AFC. Out Length: strlen(input)+1. Out Type: AFC\n"; + +$bv1 = 'abc'; +$r = oci_bind_by_name($s, ':bv1', $bv1, strlen($bv1), SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, strlen($bv1)+1, SQLT_AFC); +if ($r) + do_e($s); +var_dump($bv1, $bv2); + + +echo "\n\nTests with ''\n\n"; + +echo "Test 2.1 In Length: -1. In Type: AFC. Out Length: 10. Out Type: AFC\n"; + +$bv1 = ''; +$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10, SQLT_AFC); +if ($r) + do_e($s); +var_dump($bv1, $bv2); + + +echo "Test 2.2 In Length: default. In Type: default. Out Length: 10. Out Type: default\n"; + +$r = oci_bind_by_name($s, ':bv1', $bv1) && oci_bind_by_name($s, ':bv2', $bv2, 10); +if ($r) + do_e($s); +var_dump($bv1, $bv2); + + + +echo "Test 2.3 In Length: -1. In Type: AFC. Out Length: 10. Out Type: default\n"; + +$bv1 = ''; +$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10); +if ($r) + do_e($s); +var_dump($bv1, $bv2); + + + +echo "Test 2.4 In Length: -1. In Type: AFC. Out Length: 10. Out Type: AFC\n"; + +$bv1 = ''; +$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10, SQLT_AFC); +if ($r) + do_e($s); +var_dump($bv1, $bv2); + + + +echo "Test 2.5 In Length: -1. In Type: AFC. Out Length: 0. Out Type: AFC\n"; + +$bv1 = ''; +$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 0, SQLT_AFC); +if ($r) + do_e($s); +var_dump($bv1, $bv2); + + + +echo "Test 2.6 In Length: 0. In Type: AFC. Out Length: 0. Out Type: AFC\n"; + +$bv1 = ''; +$r = oci_bind_by_name($s, ':bv1', $bv1, 0, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 0, SQLT_AFC); +if ($r) + do_e($s); +var_dump($bv1, $bv2); + + + +echo "Test 2.7 In Length: 1. In Type: AFC. Out Length: 1. Out Type: AFC\n"; + +$bv1 = ''; +$r = oci_bind_by_name($s, ':bv1', $bv1, 1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 1, SQLT_AFC); +if ($r) + do_e($s); +var_dump($bv1, $bv2); + + + +echo "\n\nTests with NULL\n"; + +echo "Test 3.1 In Length: -1. In Type: AFC. Out Length: 10. Out Type: AFC\n"; + +$bv1 = null; +$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10, SQLT_AFC); +if ($r) + do_e($s); +var_dump($bv1, $bv2); + + +echo "Test 3.2 In Length: default. In Type: default. Out Length: 10. Out Type: default\n"; + +$bv1 = null; +$r = oci_bind_by_name($s, ':bv1', $bv1) && oci_bind_by_name($s, ':bv2', $bv2, 10); +if ($r) + do_e($s); +var_dump($bv1, $bv2); + + + +echo "Test 3.3 In Length: -1. In Type: AFC. Out Length: 10. Out Type: default\n"; + +$bv1 = null; +$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10); +if ($r) + do_e($s); +var_dump($bv1, $bv2); + + + +echo "Test 3.4 In Length: -1. In Type: AFC. Out Length: 10. Out Type: AFC\n"; + +$bv1 = null; +$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 10, SQLT_AFC); +if ($r) + do_e($s); +var_dump($bv1, $bv2); + + +echo "Test 3.5 In Length: -1. In Type: AFC. Out Length: 0. Out Type: AFC\n"; + +$bv1 = null; +$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 0, SQLT_AFC); +if ($r) + do_e($s); +var_dump($bv1, $bv2); + + + +echo "Test 3.6 In Length: -1. In Type: AFC. Out Length: 1. Out Type: AFC\n"; + +$bv1 = null; +$r = oci_bind_by_name($s, ':bv1', $bv1, -1, SQLT_AFC) && oci_bind_by_name($s, ':bv2', $bv2, 1, SQLT_AFC); +if ($r) + do_e($s); +var_dump($bv1, $bv2); + + +function do_e($s) +{ + echo " Executing:\n"; + + $r = @oci_execute($s); + if (!$r) { + $m = oci_error($s); + echo " Oci_execute error ORA-".$m['code']."\n"; + return; + } +} + +// Cleanup + +//require(dirname(__FILE__).'/drop_table.inc'); + +$stmtarray = array( + "drop function bind_char_3_fn" +); + +foreach ($stmtarray as $stmt) { + $s = oci_parse($c, $stmt); + oci_execute($s); +} + +oci_close($c); + +echo "Done\n"; + +?> +--EXPECTF-- +Test 1.1 In Length: default. In Type: default. Out Length: default. Out Type: default + Executing: + Oci_execute error ORA-6502 +string(3) "abc" +NULL +Test 1.2 In Length: default. In Type: default. Out Length: 10. Out Type: default + Executing: +string(3) "abc" +string(3) "abc" +Test 1.3 In Length: -1. In Type: AFC. Out Length: 10. Out Type: default + Executing: +string(3) "abc" +string(3) "abc" +Test 1.4 In Length: -1. In Type: AFC. Out Length: 10. Out Type: AFC + Executing: +string(3) "abc" +string(10) "abc " +Test 1.5 In Length: strlen. In Type: AFC. Out Length: strlen(input). Out Type: AFC + Executing: +string(3) "abc" +string(3) "abc" +Test 1.6 In Length: strlen. In Type: AFC. Out Length: strlen(input)-1. Out Type: AFC + Executing: + Oci_execute error ORA-6502 +string(3) "abc" +string(3) "abc" +Test 1.7 In Length: strlen. In Type: AFC. Out Length: strlen(input)+1. Out Type: AFC + Executing: +string(3) "abc" +string(4) "abc " + + +Tests with '' + +Test 2.1 In Length: -1. In Type: AFC. Out Length: 10. Out Type: AFC + Executing: +string(0) "" +NULL +Test 2.2 In Length: default. In Type: default. Out Length: 10. Out Type: default + Executing: +string(0) "" +NULL +Test 2.3 In Length: -1. In Type: AFC. Out Length: 10. Out Type: default + Executing: +string(0) "" +NULL +Test 2.4 In Length: -1. In Type: AFC. Out Length: 10. Out Type: AFC + Executing: +string(0) "" +NULL +Test 2.5 In Length: -1. In Type: AFC. Out Length: 0. Out Type: AFC + Executing: +string(0) "" +NULL +Test 2.6 In Length: 0. In Type: AFC. Out Length: 0. Out Type: AFC + Executing: +string(0) "" +NULL +Test 2.7 In Length: 1. In Type: AFC. Out Length: 1. Out Type: AFC + Executing: +string(0) "" +NULL + + +Tests with NULL +Test 3.1 In Length: -1. In Type: AFC. Out Length: 10. Out Type: AFC + Executing: +NULL +NULL +Test 3.2 In Length: default. In Type: default. Out Length: 10. Out Type: default + Executing: +NULL +NULL +Test 3.3 In Length: -1. In Type: AFC. Out Length: 10. Out Type: default + Executing: +NULL +NULL +Test 3.4 In Length: -1. In Type: AFC. Out Length: 10. Out Type: AFC + Executing: +NULL +NULL +Test 3.5 In Length: -1. In Type: AFC. Out Length: 0. Out Type: AFC + Executing: +NULL +NULL +Test 3.6 In Length: -1. In Type: AFC. Out Length: 1. Out Type: AFC + Executing: +NULL +NULL +Done diff --git a/ext/oci8/tests/bind_long.phpt b/ext/oci8/tests/bind_long.phpt index 065a5f1439..ba6bd4d044 100644 --- a/ext/oci8/tests/bind_long.phpt +++ b/ext/oci8/tests/bind_long.phpt @@ -5,7 +5,10 @@ bind LONG field --FILE-- <?php -require dirname(__FILE__)."/connect.inc"; +require(dirname(__FILE__)."/connect.inc"); + +$stmt = oci_parse($c, "drop table phptestlng"); +@oci_execute($stmt); $stmt = oci_parse($c, "create table phptestlng( id number(10), filetxt long)"); oci_execute($stmt); diff --git a/ext/oci8/tests/bug27303_1.phpt b/ext/oci8/tests/bug27303_1.phpt new file mode 100644 index 0000000000..82c2d6f506 --- /dev/null +++ b/ext/oci8/tests/bug27303_1.phpt @@ -0,0 +1,261 @@ +--TEST-- +Bug #27303 (OCIBindByName binds numeric PHP values as characters) +--SKIPIF-- +<?php +if (!extension_loaded('oci8')) die ("skip no oci8 extension"); +require(dirname(__FILE__)."/connect.inc"); +$sv = oci_server_version($c); +$sv = preg_match('/Release 1[01]\.2\./', $sv, $matches); +if ($sv !== 1) { + die ("skip expected output only valid when using Oracle 19gR2 or 11gR2 databases"); +} +?> +--FILE-- +<?php + +// Note: expected output is valid for 32bit clients to 32bit 10gR2 XE or 11.2.0.1 64bit DBs. +// It will diff with a 32bit 11.2.0.1 DB + +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); + +$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; } + +$r = OCIBindByName($stid, ':MYBV', $mybv); +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"; +?> +--EXPECT-- +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
\ No newline at end of file diff --git a/ext/oci8/tests/bug27303.phpt b/ext/oci8/tests/bug27303_1_11gR1.phpt index 4dce84463f..fe5c17c3ee 100644 --- a/ext/oci8/tests/bug27303.phpt +++ b/ext/oci8/tests/bug27303_1_11gR1.phpt @@ -5,9 +5,9 @@ Bug #27303 (OCIBindByName binds numeric PHP values as characters) if (!extension_loaded('oci8')) die ("skip no oci8 extension"); require(dirname(__FILE__)."/connect.inc"); $sv = oci_server_version($c); -$sv = preg_match('/Release 1[12]\./', $sv, $matches); +$sv = preg_match('/Release 11\.1\./', $sv, $matches); if ($sv !== 1) { - die ("skip expected output only valid when using Oracle 11g+ database"); + die ("skip expected output only valid when using Oracle 11gR1 database"); } ?> --FILE-- @@ -27,15 +27,13 @@ foreach ($create_st as $statement) { } 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 +$r = OCIBindByName($stid, ':MYBV', $mybv); if (!$r) { echo "Bind error"; die; } for ($i = 1; $i < MYLIMIT; $i++) { diff --git a/ext/oci8/tests/bug27303_2.phpt b/ext/oci8/tests/bug27303_2.phpt index 63200ed52e..44b9ce6c61 100644 --- a/ext/oci8/tests/bug27303_2.phpt +++ b/ext/oci8/tests/bug27303_2.phpt @@ -5,14 +5,17 @@ Bug #27303 (OCIBindByName binds numeric PHP values as characters) if (!extension_loaded('oci8')) die ("skip no oci8 extension"); require(dirname(__FILE__)."/connect.inc"); $sv = oci_server_version($c); -$sv = preg_match('/Release 1[12]\./', $sv, $matches); +$sv = preg_match('/Release 1[01]\.2\./', $sv, $matches); if ($sv !== 1) { - die ("skip expected output only valid when using Oracle 11g+ database"); + die ("skip expected output only valid when using Oracle 10gR2 or 11gR2 database"); } ?> --FILE-- <?php +// Note: expected output is valid for 32bit clients to 32bit 10gR2 XE or 11.2.0.1 64bit DBs. +// It will diff with a 32bit 11.2.0.1 DB + require dirname(__FILE__).'/connect.inc'; $create_st = array(); @@ -34,8 +37,8 @@ $stmt = "insert into mytab (mydata, seqcol) values ('Some data', myseq.nextval) $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 +$mybv = INITMYBV; +$r = OCIBindByName($stid, ':MYBV', $mybv); if (!$r) { echo "Bind error"; die; } for ($i = 1; $i < MYLIMIT; $i++) { @@ -157,104 +160,104 @@ string(2) "96" string(2) "97" string(2) "98" string(2) "99" -string(2) "10" -string(2) "10" -string(2) "10" -string(2) "10" -string(2) "10" -string(2) "10" -string(2) "10" -string(2) "10" -string(2) "10" -string(2) "10" -string(2) "11" -string(2) "11" -string(2) "11" -string(2) "11" -string(2) "11" -string(2) "11" -string(2) "11" -string(2) "11" -string(2) "11" -string(2) "11" -string(2) "12" -string(2) "12" -string(2) "12" -string(2) "12" -string(2) "12" -string(2) "12" -string(2) "12" -string(2) "12" -string(2) "12" -string(2) "12" -string(2) "13" -string(2) "13" -string(2) "13" -string(2) "13" -string(2) "13" -string(2) "13" -string(2) "13" -string(2) "13" -string(2) "13" -string(2) "13" -string(2) "14" -string(2) "14" -string(2) "14" -string(2) "14" -string(2) "14" -string(2) "14" -string(2) "14" -string(2) "14" -string(2) "14" -string(2) "14" -string(2) "15" -string(2) "15" -string(2) "15" -string(2) "15" -string(2) "15" -string(2) "15" -string(2) "15" -string(2) "15" -string(2) "15" -string(2) "15" -string(2) "16" -string(2) "16" -string(2) "16" -string(2) "16" -string(2) "16" -string(2) "16" -string(2) "16" -string(2) "16" -string(2) "16" -string(2) "16" -string(2) "17" -string(2) "17" -string(2) "17" -string(2) "17" -string(2) "17" -string(2) "17" -string(2) "17" -string(2) "17" -string(2) "17" -string(2) "17" -string(2) "18" -string(2) "18" -string(2) "18" -string(2) "18" -string(2) "18" -string(2) "18" -string(2) "18" -string(2) "18" -string(2) "18" -string(2) "18" -string(2) "19" -string(2) "19" -string(2) "19" -string(2) "19" -string(2) "19" -string(2) "19" -string(2) "19" -string(2) "19" -string(2) "19" -string(2) "19" -Done +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
\ No newline at end of file diff --git a/ext/oci8/tests/bug27303_2_11gR1.phpt b/ext/oci8/tests/bug27303_2_11gR1.phpt new file mode 100644 index 0000000000..e1daef0537 --- /dev/null +++ b/ext/oci8/tests/bug27303_2_11gR1.phpt @@ -0,0 +1,260 @@ +--TEST-- +Bug #27303 (OCIBindByName binds numeric PHP values as characters) +--SKIPIF-- +<?php +if (!extension_loaded('oci8')) die ("skip no oci8 extension"); +require(dirname(__FILE__)."/connect.inc"); +$sv = oci_server_version($c); +$sv = preg_match('/Release 11\.1\./', $sv, $matches); +if ($sv !== 1) { + die ("skip expected output only valid when using Oracle 11gR1 database"); +} +?> +--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; +$r = OCIBindByName($stid, ':MYBV', $mybv); +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"; +?> +--EXPECT-- +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(2) "10" +string(2) "10" +string(2) "10" +string(2) "10" +string(2) "10" +string(2) "10" +string(2) "10" +string(2) "10" +string(2) "10" +string(2) "10" +string(2) "11" +string(2) "11" +string(2) "11" +string(2) "11" +string(2) "11" +string(2) "11" +string(2) "11" +string(2) "11" +string(2) "11" +string(2) "11" +string(2) "12" +string(2) "12" +string(2) "12" +string(2) "12" +string(2) "12" +string(2) "12" +string(2) "12" +string(2) "12" +string(2) "12" +string(2) "12" +string(2) "13" +string(2) "13" +string(2) "13" +string(2) "13" +string(2) "13" +string(2) "13" +string(2) "13" +string(2) "13" +string(2) "13" +string(2) "13" +string(2) "14" +string(2) "14" +string(2) "14" +string(2) "14" +string(2) "14" +string(2) "14" +string(2) "14" +string(2) "14" +string(2) "14" +string(2) "14" +string(2) "15" +string(2) "15" +string(2) "15" +string(2) "15" +string(2) "15" +string(2) "15" +string(2) "15" +string(2) "15" +string(2) "15" +string(2) "15" +string(2) "16" +string(2) "16" +string(2) "16" +string(2) "16" +string(2) "16" +string(2) "16" +string(2) "16" +string(2) "16" +string(2) "16" +string(2) "16" +string(2) "17" +string(2) "17" +string(2) "17" +string(2) "17" +string(2) "17" +string(2) "17" +string(2) "17" +string(2) "17" +string(2) "17" +string(2) "17" +string(2) "18" +string(2) "18" +string(2) "18" +string(2) "18" +string(2) "18" +string(2) "18" +string(2) "18" +string(2) "18" +string(2) "18" +string(2) "18" +string(2) "19" +string(2) "19" +string(2) "19" +string(2) "19" +string(2) "19" +string(2) "19" +string(2) "19" +string(2) "19" +string(2) "19" +string(2) "19" +Done diff --git a/ext/oci8/tests/bug27303_3.phpt b/ext/oci8/tests/bug27303_3.phpt index f290010f15..6395388471 100644 --- a/ext/oci8/tests/bug27303_3.phpt +++ b/ext/oci8/tests/bug27303_3.phpt @@ -26,8 +26,8 @@ $stmt = "insert into mytab (mydata, seqcol) values ('Some data', myseq.nextval) $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 +$mybv = INITMYBV; +$r = OCIBindByName($stid, ':MYBV', $mybv, 5, SQLT_INT); if (!$r) { echo "Bind error"; die; } for ($i = 1; $i < MYLIMIT; $i++) { diff --git a/ext/oci8/tests/bug27303_4.phpt b/ext/oci8/tests/bug27303_4.phpt index 031f0d1e12..3c35c65b77 100644 --- a/ext/oci8/tests/bug27303_4.phpt +++ b/ext/oci8/tests/bug27303_4.phpt @@ -5,14 +5,17 @@ Bug #27303 (OCIBindByName binds numeric PHP values as characters) if (!extension_loaded('oci8')) die ("skip no oci8 extension"); require(dirname(__FILE__)."/connect.inc"); $sv = oci_server_version($c); -$sv = preg_match('/Release 1[12]\./', $sv, $matches); +$sv = preg_match('/Release 1[01]\.2\./', $sv, $matches); if ($sv !== 1) { - die ("skip expected output only valid when using Oracle 11g+ database"); + die ("skip expected output only valid when using Oracle 10gR2 or 11gR2 databases"); } ?> --FILE-- <?php +// Note: expected output is valid for 32bit clients to 32bit 10gR2 XE or 11.2.0.1 64bit DBs. +// It will diff with a 32bit 11.2.0.1 DB + require dirname(__FILE__).'/connect.inc'; $create_st = array(); @@ -27,15 +30,13 @@ foreach ($create_st as $statement) { } 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 +$r = OCIBindByName($stid, ':MYBV', $mybv, 0 ); if (!$r) { echo "Bind error"; die; } for ($i = 1; $i < MYLIMIT; $i++) { @@ -67,194 +68,194 @@ string(1) "6" string(1) "7" string(1) "8" string(1) "9" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "2" -string(1) "2" -string(1) "2" -string(1) "2" -string(1) "2" -string(1) "2" -string(1) "2" -string(1) "2" -string(1) "2" -string(1) "2" -string(1) "3" -string(1) "3" -string(1) "3" -string(1) "3" -string(1) "3" -string(1) "3" -string(1) "3" -string(1) "3" -string(1) "3" -string(1) "3" -string(1) "4" -string(1) "4" -string(1) "4" -string(1) "4" -string(1) "4" -string(1) "4" -string(1) "4" -string(1) "4" -string(1) "4" -string(1) "4" -string(1) "5" -string(1) "5" -string(1) "5" -string(1) "5" -string(1) "5" -string(1) "5" -string(1) "5" -string(1) "5" -string(1) "5" -string(1) "5" -string(1) "6" -string(1) "6" -string(1) "6" -string(1) "6" -string(1) "6" -string(1) "6" -string(1) "6" -string(1) "6" -string(1) "6" -string(1) "6" -string(1) "7" -string(1) "7" -string(1) "7" -string(1) "7" -string(1) "7" -string(1) "7" -string(1) "7" -string(1) "7" -string(1) "7" -string(1) "7" -string(1) "8" -string(1) "8" -string(1) "8" -string(1) "8" -string(1) "8" -string(1) "8" -string(1) "8" -string(1) "8" -string(1) "8" -string(1) "8" -string(1) "9" -string(1) "9" -string(1) "9" -string(1) "9" -string(1) "9" -string(1) "9" -string(1) "9" -string(1) "9" -string(1) "9" -string(1) "9" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" -string(1) "1" +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_4_11gR1.phpt b/ext/oci8/tests/bug27303_4_11gR1.phpt new file mode 100644 index 0000000000..0c88360be2 --- /dev/null +++ b/ext/oci8/tests/bug27303_4_11gR1.phpt @@ -0,0 +1,258 @@ +--TEST-- +Bug #27303 (OCIBindByName binds numeric PHP values as characters) +--SKIPIF-- +<?php +if (!extension_loaded('oci8')) die ("skip no oci8 extension"); +require(dirname(__FILE__)."/connect.inc"); +$sv = oci_server_version($c); +$sv = preg_match('/Release 11\.1\./', $sv, $matches); +if ($sv !== 1) { + die ("skip expected output only valid when using Oracle 11gR1 database"); +} +?> +--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); + +$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; } + +$r = OCIBindByName($stid, ':MYBV', $mybv, 0 ); +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"; +?> +--EXPECT-- +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(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "2" +string(1) "2" +string(1) "2" +string(1) "2" +string(1) "2" +string(1) "2" +string(1) "2" +string(1) "2" +string(1) "2" +string(1) "2" +string(1) "3" +string(1) "3" +string(1) "3" +string(1) "3" +string(1) "3" +string(1) "3" +string(1) "3" +string(1) "3" +string(1) "3" +string(1) "3" +string(1) "4" +string(1) "4" +string(1) "4" +string(1) "4" +string(1) "4" +string(1) "4" +string(1) "4" +string(1) "4" +string(1) "4" +string(1) "4" +string(1) "5" +string(1) "5" +string(1) "5" +string(1) "5" +string(1) "5" +string(1) "5" +string(1) "5" +string(1) "5" +string(1) "5" +string(1) "5" +string(1) "6" +string(1) "6" +string(1) "6" +string(1) "6" +string(1) "6" +string(1) "6" +string(1) "6" +string(1) "6" +string(1) "6" +string(1) "6" +string(1) "7" +string(1) "7" +string(1) "7" +string(1) "7" +string(1) "7" +string(1) "7" +string(1) "7" +string(1) "7" +string(1) "7" +string(1) "7" +string(1) "8" +string(1) "8" +string(1) "8" +string(1) "8" +string(1) "8" +string(1) "8" +string(1) "8" +string(1) "8" +string(1) "8" +string(1) "8" +string(1) "9" +string(1) "9" +string(1) "9" +string(1) "9" +string(1) "9" +string(1) "9" +string(1) "9" +string(1) "9" +string(1) "9" +string(1) "9" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +string(1) "1" +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/bug44113.phpt b/ext/oci8/tests/bug44113.phpt index d6c2978635..eee21c3aef 100644 --- a/ext/oci8/tests/bug44113.phpt +++ b/ext/oci8/tests/bug44113.phpt @@ -1,7 +1,11 @@ --TEST-- Bug #44113 (New collection creation can fail with OCI-22303) --SKIPIF-- -<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?> +<?php +if (!extension_loaded('oci8')) die ("skip no oci8 extension"); +require(dirname(__FILE__).'/details.inc'); +if ($stress_test !== true) die ('skip Slow test not run when $stress_test is FALSE'); +?> --FILE-- <?php diff --git a/ext/oci8/tests/commit_002.phpt b/ext/oci8/tests/commit_002.phpt index 510c7decda..d46ea29922 100644 --- a/ext/oci8/tests/commit_002.phpt +++ b/ext/oci8/tests/commit_002.phpt @@ -80,11 +80,11 @@ oci_close($c); <?php exit(0); ?> --EXPECTF-- First Insert -Could not execute: ORA-02290: check constraint (SYSTEM.COMMIT_002_TAB_CHECK_X) violated +Could not execute: ORA-02290: %s (SYSTEM.COMMIT_002_TAB_CHECK_X) %s Second Insert -Warning: oci_commit(): ORA-02091: transaction rolled back +Warning: oci_commit(): ORA-02091: %s ORA-02290: %s (SYSTEM.COMMIT_002_TAB_CHECK_Y) %s in %scommit_002.php on line %d -Could not commit: ORA-02091: transaction rolled back +Could not commit: ORA-02091: %s ORA-02290: %s (SYSTEM.COMMIT_002_TAB_CHECK_Y) %s ===DONE=== diff --git a/ext/oci8/tests/conn_attr_4.phpt b/ext/oci8/tests/conn_attr_4.phpt index 2ef2673fd1..9f55f53263 100644 --- a/ext/oci8/tests/conn_attr_4.phpt +++ b/ext/oci8/tests/conn_attr_4.phpt @@ -5,6 +5,7 @@ Set and get of connection attributes with errors. require(dirname(__FILE__)."/connect.inc"); if (strcasecmp($user, "system") && strcasecmp($user, "sys")) die("skip needs to be run as a DBA user"); if ($test_drcp) die("skip output might vary with DRCP"); +if ($stress_test !== true) die ('skip Slow test not run when $stress_test is FALSE'); $sv = oci_server_version($c); $sv = preg_match('/Release 1[012]\./', $sv, $matches); diff --git a/ext/oci8/tests/details.inc b/ext/oci8/tests/details.inc index 75a136ce34..922b8c4f49 100644 --- a/ext/oci8/tests/details.inc +++ b/ext/oci8/tests/details.inc @@ -12,6 +12,9 @@ * greater, and $dbase should be set to the tnsnames.ora entry * corresponding to the POOLED server instance or an Easy Connect * string like hostname:port/service_name:POOLED + * + * Set $stress_test to TRUE if you want to run some longer/slower/more + * memory intensive tests. */ if (file_exists(dirname(__FILE__)."/details_local.inc")) { @@ -33,12 +36,19 @@ if (file_exists(dirname(__FILE__)."/details_local.inc")) { } else { $oracle_on_localhost = FALSE; } + $stress_test = getenv('PHP_OCI8_STRESS_TEST'); + if (false !== $stress_test && 0 == strcasecmp($stress_test,'TRUE')) { + $stress_test = TRUE; + } else { + $stress_test = FALSE; + } } else { $user = "system"; $password = "oracle"; $dbase = "localhost/XE"; $oracle_on_localhost = TRUE; $test_drcp = FALSE; + $stress_test = FALSE; } /* diff --git a/ext/oci8/tests/extauth_01.phpt b/ext/oci8/tests/extauth_01.phpt index 30250ec243..993198c4de 100644 --- a/ext/oci8/tests/extauth_01.phpt +++ b/ext/oci8/tests/extauth_01.phpt @@ -4,6 +4,8 @@ Test External Authentication errors with oci_connect <?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); if (substr(PHP_OS, 0, 3) == 'WIN') die("skip feature not available on Windows platforms"); +require(dirname(__FILE__).'/details.inc'); +if ($stress_test !== true) die ('skip Slow test not run when $stress_test is FALSE'); ?> --INI-- oci8.privileged_connect=1 diff --git a/ext/oci8/tests/extauth_02.phpt b/ext/oci8/tests/extauth_02.phpt index d648eef08b..d3bee0bfc3 100644 --- a/ext/oci8/tests/extauth_02.phpt +++ b/ext/oci8/tests/extauth_02.phpt @@ -4,6 +4,8 @@ Test External Authentication errors with oci_new_connect <?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); if (substr(PHP_OS, 0, 3) == 'WIN') die("skip feature not available on Windows platforms"); +require(dirname(__FILE__).'/details.inc'); +if ($stress_test !== true) die ('skip Slow test not run when $stress_test is FALSE'); ?> --INI-- oci8.privileged_connect=1 diff --git a/ext/oci8/tests/extauth_03.phpt b/ext/oci8/tests/extauth_03.phpt index 021492f765..e159c50f90 100644 --- a/ext/oci8/tests/extauth_03.phpt +++ b/ext/oci8/tests/extauth_03.phpt @@ -4,6 +4,8 @@ Test External Authentication errors with oci_pconnect <?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); if (substr(PHP_OS, 0, 3) == 'WIN') die("skip feature not available on Windows platforms"); +require(dirname(__FILE__).'/details.inc'); +if ($stress_test !== true) die ('skip Slow test not run when $stress_test is FALSE'); ?> --INI-- oci8.privileged_connect=1 diff --git a/ext/oci8/tests/lob_043.phpt b/ext/oci8/tests/lob_043.phpt index 5ae2d45ebc..0280ef6de8 100644 --- a/ext/oci8/tests/lob_043.phpt +++ b/ext/oci8/tests/lob_043.phpt @@ -1,7 +1,10 @@ --TEST-- Bug #49560 (LOB resource destructor and refcount test) --SKIPIF-- -<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?> +<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); +require(dirname(__FILE__).'/details.inc'); +if ($stress_test !== true) die ('skip Slow test not run when $stress_test is FALSE'); +?> --FILE-- <?php |