diff options
author | Ondřej Surý <ondrej@sury.org> | 2014-01-28 10:57:59 +0100 |
---|---|---|
committer | Ondřej Surý <ondrej@sury.org> | 2014-01-28 10:57:59 +0100 |
commit | 575107aad92a460051e02de029067359083542b9 (patch) | |
tree | 462d4270312d11a5c064e151e3fdd2f671bd540b /ext/oci8/tests | |
parent | 650fb41a77b3a24ab4130b05fff243b64b241877 (diff) | |
download | php-575107aad92a460051e02de029067359083542b9.tar.gz |
New upstream version 5.6.0~alpha1+dfsgupstream/5.6.0_alpha1+dfsg
Diffstat (limited to 'ext/oci8/tests')
111 files changed, 6770 insertions, 996 deletions
diff --git a/ext/oci8/tests/bind_char_1.phpt b/ext/oci8/tests/bind_char_1.phpt index 91fa4b75b..dc162ff94 100644 --- a/ext/oci8/tests/bind_char_1.phpt +++ b/ext/oci8/tests/bind_char_1.phpt @@ -5,13 +5,9 @@ SELECT oci_bind_by_name with SQLT_AFC aka CHAR if (!extension_loaded('oci8')) die ("skip no oci8 extension"); require(dirname(__FILE__)."/connect.inc"); // The bind buffer size edge cases seem to change each DB version. -if (preg_match('/Release 10\.2\./', oci_server_version($c), $matches) !== 1) { - if (preg_match('/Release 11\.2\.0\.2/', oci_server_version($c), $matches) !== 2) { - die("skip expected output only valid when using Oracle 10gR2 or 11.2.0.2 databases"); - } -} -if (preg_match('/^11\./', oci_client_version()) != 1) { - die("skip test expected to work only with Oracle 11g or greater version of client"); +preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); +if (!(isset($matches[0]) && $matches[1] >= 12)) { + die("skip expected output only valid when using Oracle 12c database"); } ?> --ENV-- diff --git a/ext/oci8/tests/bind_char_1_11gR1.phpt b/ext/oci8/tests/bind_char_1_11gR1.phpt index a7feff9f6..bdc29f766 100644 --- a/ext/oci8/tests/bind_char_1_11gR1.phpt +++ b/ext/oci8/tests/bind_char_1_11gR1.phpt @@ -5,10 +5,9 @@ SELECT oci_bind_by_name with SQLT_AFC aka CHAR if (!extension_loaded('oci8')) die ("skip no oci8 extension"); require(dirname(__FILE__)."/connect.inc"); // The bind buffer size edge cases seem to change each DB version. -if (preg_match('/Release 11\.1\./', oci_server_version($c), $matches) !== 1) { - if (preg_match('/Release 11\.2\.0\.3/', oci_server_version($c), $matches) !== 1) { - die("skip expected output only valid when using Oracle 11gR1 or 11.2.0.3 databases"); - } +preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); +if (!(isset($matches[0]) && $matches[1] < 12)) { + die("skip expected output only valid when using pre-Oracle 12c database"); } ?> --ENV-- diff --git a/ext/oci8/tests/bind_char_2.phpt b/ext/oci8/tests/bind_char_2.phpt index 43661a065..9c61a858c 100644 --- a/ext/oci8/tests/bind_char_2.phpt +++ b/ext/oci8/tests/bind_char_2.phpt @@ -5,13 +5,9 @@ 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"); // The bind buffer size edge cases seem to change each DB version. -if (preg_match('/Release 10\.2\./', oci_server_version($c), $matches) !== 1) { - if (preg_match('/Release 11\.2\.0\.2/', oci_server_version($c), $matches) !== 2) { - die("skip expected output only valid when using Oracle 10gR2 or 11.2.0.2 databases"); - } -} -if (preg_match('/^11\./', oci_client_version()) != 1) { - die("skip test expected to work only with Oracle 11g or greater version of client"); +preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); +if (!(isset($matches[0]) && $matches[1] >= 12)) { + die("skip expected output only valid when using Oracle 12c database"); } ?> --ENV-- diff --git a/ext/oci8/tests/bind_char_2_11gR1.phpt b/ext/oci8/tests/bind_char_2_11gR1.phpt index edb2a12ff..06c37afc9 100644 --- a/ext/oci8/tests/bind_char_2_11gR1.phpt +++ b/ext/oci8/tests/bind_char_2_11gR1.phpt @@ -5,10 +5,9 @@ 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"); // The bind buffer size edge cases seem to change each DB version. -if (preg_match('/Release 11\.1\./', oci_server_version($c), $matches) !== 1) { - if (preg_match('/Release 11\.2\.0\.3/', oci_server_version($c), $matches) !== 1) { - die("skip expected output only valid when using Oracle 11gR1 or 11.2.0.3 databases"); - } +preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); +if (!(isset($matches[0]) && $matches[1] < 12)) { + die("skip expected output only valid when using pre-Oracle 12c database"); } ?> --ENV-- diff --git a/ext/oci8/tests/bind_char_3.phpt b/ext/oci8/tests/bind_char_3.phpt index 25115836d..177676e25 100644 --- a/ext/oci8/tests/bind_char_3.phpt +++ b/ext/oci8/tests/bind_char_3.phpt @@ -5,13 +5,9 @@ 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"); // The bind buffer size edge cases seem to change each DB version. -if (preg_match('/Release 10\.2\./', oci_server_version($c), $matches) !== 1) { - if (preg_match('/Release 11\.2\.0\.2/', oci_server_version($c), $matches) !== 2) { - die("skip expected output only valid when using Oracle 10gR2 or 11.2.0.2 databases"); - } -} -if (preg_match('/^11\./', oci_client_version()) != 1) { - die("skip test expected to work only with Oracle 11g or greater version of client"); +preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); +if (!(isset($matches[0]) && $matches[1] >= 12)) { + die("skip expected output only valid when using Oracle 12c database"); } ?> --ENV-- diff --git a/ext/oci8/tests/bind_char_3_11gR1.phpt b/ext/oci8/tests/bind_char_3_11gR1.phpt index fea77754d..c3ec999d0 100644 --- a/ext/oci8/tests/bind_char_3_11gR1.phpt +++ b/ext/oci8/tests/bind_char_3_11gR1.phpt @@ -5,10 +5,9 @@ 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"); // The bind buffer size edge cases seem to change each DB version. -if (preg_match('/Release 11\.1\./', oci_server_version($c), $matches) !== 1) { - if (preg_match('/Release 11\.2\.0\.3/', oci_server_version($c), $matches) !== 1) { - die("skip expected output only valid when using Oracle 11gR1 or 11.2.0.3 databases"); - } +preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); +if (!(isset($matches[0]) && $matches[1] < 12)) { + die("skip expected output only valid when using pre-Oracle 12c database"); } ?> --ENV-- diff --git a/ext/oci8/tests/bind_char_4.phpt b/ext/oci8/tests/bind_char_4.phpt index 36765f813..b4d3e089b 100644 --- a/ext/oci8/tests/bind_char_4.phpt +++ b/ext/oci8/tests/bind_char_4.phpt @@ -5,13 +5,9 @@ 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"); // The bind buffer size edge cases seem to change each DB version. -if (preg_match('/Release 10\.2\./', oci_server_version($c), $matches) !== 1) { - if (preg_match('/Release 11\.2\.0\.2/', oci_server_version($c), $matches) !== 2) { - die("skip expected output only valid when using Oracle 10gR2 or 11.2.0.2 databases"); - } -} -if (preg_match('/^11\./', oci_client_version()) != 1) { - die("skip test expected to work only with Oracle 11g or greater version of client"); +preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); +if (!(isset($matches[0]) && $matches[1] >= 12)) { + die("skip expected output only valid when using Oracle 12c database"); } ?> --ENV-- diff --git a/ext/oci8/tests/bind_char_4_11gR1.phpt b/ext/oci8/tests/bind_char_4_11gR1.phpt index 2bc2f1424..ccad2cb78 100644 --- a/ext/oci8/tests/bind_char_4_11gR1.phpt +++ b/ext/oci8/tests/bind_char_4_11gR1.phpt @@ -5,10 +5,9 @@ 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"); // The bind buffer size edge cases seem to change each DB version. -if (preg_match('/Release 11\.1\./', oci_server_version($c), $matches) !== 1) { - if (preg_match('/Release 11\.2\.0\.3/', oci_server_version($c), $matches) !== 1) { - die("skip expected output only valid when using Oracle 11gR1 or 11.2.0.3 databases"); - } +preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); +if (!(isset($matches[0]) && $matches[1] < 12)) { + die("skip expected output only valid when using pre-Oracle 12c database"); } ?> --ENV-- diff --git a/ext/oci8/tests/bind_misccoltypes.phpt b/ext/oci8/tests/bind_misccoltypes.phpt index 0da8c8bf8..9e55b3b1f 100644 --- a/ext/oci8/tests/bind_misccoltypes.phpt +++ b/ext/oci8/tests/bind_misccoltypes.phpt @@ -4,9 +4,6 @@ Bind miscellaneous column types using default types <?php $target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs require(dirname(__FILE__).'/skipif.inc'); -if (preg_match('/^1[012]\./', oci_client_version()) != 1) { - die("skip test expected to work only with Oracle 10g or greater version of client"); -} ?> --FILE-- <?php diff --git a/ext/oci8/tests/bind_number.phpt b/ext/oci8/tests/bind_number.phpt index 6412b5f82..4ae085b4d 100644 --- a/ext/oci8/tests/bind_number.phpt +++ b/ext/oci8/tests/bind_number.phpt @@ -3,9 +3,6 @@ Bind with NUMBER column variants --SKIPIF-- <?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); -if (preg_match('/^1[012]\./', oci_client_version()) != 1) { - die("skip test expected to work only with Oracle 10g or greater version of client"); -} ?> --INI-- precision = 14 diff --git a/ext/oci8/tests/bind_sqltnum.phpt b/ext/oci8/tests/bind_sqltnum.phpt index d3828b73e..93fc4809e 100644 --- a/ext/oci8/tests/bind_sqltnum.phpt +++ b/ext/oci8/tests/bind_sqltnum.phpt @@ -3,9 +3,6 @@ Bind with SQLT_NUM --SKIPIF-- <?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); -if (preg_match('/^1[012]\./', oci_client_version()) != 1) { - die("skip test expected to work only with Oracle 10g or greater version of client"); -} ?> --FILE-- <?php diff --git a/ext/oci8/tests/bind_unsupported_2.phpt b/ext/oci8/tests/bind_unsupported_2.phpt index d3e5375df..b4e2c9b43 100644 --- a/ext/oci8/tests/bind_unsupported_2.phpt +++ b/ext/oci8/tests/bind_unsupported_2.phpt @@ -3,9 +3,6 @@ Bind with various unsupported 10g+ bind types --SKIPIF-- <?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); -if (preg_match('/^1[01]\./', oci_client_version()) !== 1) { - die ("skip expected output only valid for Oracle 10g+ clients"); -} ?> --FILE-- <?php diff --git a/ext/oci8/tests/bug27303_1.phpt b/ext/oci8/tests/bug27303_1.phpt index 40ab4ebed..0b9d2b99e 100644 --- a/ext/oci8/tests/bug27303_1.phpt +++ b/ext/oci8/tests/bug27303_1.phpt @@ -5,13 +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"); // The bind buffer size edge cases seem to change each DB version. -if (preg_match('/Release 10\.2\.0\.2/', oci_server_version($c), $matches) !== 1 && - preg_match('/Release 11\.2\.0\.2/', oci_server_version($c), $matches) !== 1) { - die("skip expected output only valid when using Oracle 10.2.0.2 or 11.2.0.2 databases"); - // Other point releases may also work -} -if (preg_match('/^11\./', oci_client_version()) != 1) { - die("skip test expected to work only with Oracle 11g or greater version of client"); +preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); +if (!(isset($matches[0]) && $matches[1] >= 12)) { + die("skip expected output only valid when using Oracle 12c database"); } ?> --ENV-- diff --git a/ext/oci8/tests/bug27303_1_11gR1.phpt b/ext/oci8/tests/bug27303_1_11gR1.phpt index 6de9b9937..d2018783b 100644 --- a/ext/oci8/tests/bug27303_1_11gR1.phpt +++ b/ext/oci8/tests/bug27303_1_11gR1.phpt @@ -5,12 +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"); // The bind buffer size edge cases seem to change each DB version. -if (preg_match('/Release 10\.2\.0\.3/', oci_server_version($c), $matches) !== 1) { - if (preg_match('/Release 11\.1\.0\.6/', oci_server_version($c), $matches) !== 1) { - if (preg_match('/Release 11\.2\.0\.3/', oci_server_version($c), $matches) !== 1) { - die("skip expected output only valid when using specific Oracle database versions"); - } - } +preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); +if (!(isset($matches[0]) && $matches[1] < 12)) { + die("skip expected output only valid when using pre-Oracle 12c database"); } ?> --FILE-- diff --git a/ext/oci8/tests/bug27303_2.phpt b/ext/oci8/tests/bug27303_2.phpt index 1fb2b3168..ee2f7b52a 100644 --- a/ext/oci8/tests/bug27303_2.phpt +++ b/ext/oci8/tests/bug27303_2.phpt @@ -5,13 +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"); // The bind buffer size edge cases seem to change each DB version. -if (preg_match('/Release 10\.2\.0\.2/', oci_server_version($c), $matches) !== 1 && - preg_match('/Release 11\.2\.0\.2/', oci_server_version($c), $matches) !== 1) { - die("skip expected output only valid when using Oracle 10.2.0.2 or 11.2.0.2 databases"); - // Other point releases may also work -} -if (preg_match('/^11\./', oci_client_version()) != 1) { - die("skip test expected to work only with Oracle 11g or greater version of client"); +preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); +if (!(isset($matches[0]) && $matches[1] >= 12)) { + die("skip expected output only valid when using Oracle 12c database"); } ?> --ENV-- diff --git a/ext/oci8/tests/bug27303_2_11gR1.phpt b/ext/oci8/tests/bug27303_2_11gR1.phpt index 1e3e3105a..06133e011 100644 --- a/ext/oci8/tests/bug27303_2_11gR1.phpt +++ b/ext/oci8/tests/bug27303_2_11gR1.phpt @@ -5,12 +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"); // The bind buffer size edge cases seem to change each DB version. -if (preg_match('/Release 10\.2\.0\.3/', oci_server_version($c), $matches) !== 1) { - if (preg_match('/Release 11\.1\.0\.6/', oci_server_version($c), $matches) !== 1) { - if (preg_match('/Release 11\.2\.0\.3/', oci_server_version($c), $matches) !== 1) { - die("skip expected output only valid when using specific Oracle database versions"); - } - } +preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); +if (!(isset($matches[0]) && $matches[1] < 12)) { + die("skip expected output only valid when using pre-Oracle 12c database"); } ?> --FILE-- diff --git a/ext/oci8/tests/bug27303_4.phpt b/ext/oci8/tests/bug27303_4.phpt index 3137db865..ed9d5a1fe 100644 --- a/ext/oci8/tests/bug27303_4.phpt +++ b/ext/oci8/tests/bug27303_4.phpt @@ -5,13 +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"); // The bind buffer size edge cases seem to change each DB version. -if (preg_match('/Release 10\.2\.0\.2/', oci_server_version($c), $matches) !== 1 && - preg_match('/Release 11\.2\.0\.2/', oci_server_version($c), $matches) !== 1) { - die("skip expected output only valid when using Oracle 10.2.0.2 or 11.2.0.2 databases"); - // Other point releases may also work -} -if (preg_match('/^11\./', oci_client_version()) != 1) { - die("skip test expected to work only with Oracle 11g or greater version of client"); +preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); +if (!(isset($matches[0]) && $matches[1] >= 12)) { + die("skip expected output only valid when using Oracle 12c database"); } ?> --ENV-- diff --git a/ext/oci8/tests/bug27303_4_11gR1.phpt b/ext/oci8/tests/bug27303_4_11gR1.phpt index f9bc2da8a..550d89fdc 100644 --- a/ext/oci8/tests/bug27303_4_11gR1.phpt +++ b/ext/oci8/tests/bug27303_4_11gR1.phpt @@ -5,12 +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"); // The bind buffer size edge cases seem to change each DB version. -if (preg_match('/Release 10\.2\.0\.3/', oci_server_version($c), $matches) !== 1) { - if (preg_match('/Release 11\.1\.0\.6/', oci_server_version($c), $matches) !== 1) { - if (preg_match('/Release 11\.2\.0\.3/', oci_server_version($c), $matches) !== 1) { - die("skip expected output only valid when using specific Oracle database versions"); - } - } +preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); +if (!(isset($matches[0]) && $matches[1] < 12)) { + die("skip expected output only valid when using pre-Oracle 12c database"); } ?> --FILE-- diff --git a/ext/oci8/tests/bug36403.phpt b/ext/oci8/tests/bug36403.phpt index 53dae694e..122b06bbf 100644 --- a/ext/oci8/tests/bug36403.phpt +++ b/ext/oci8/tests/bug36403.phpt @@ -3,9 +3,6 @@ Bug #36403 (oci_execute no longer supports OCI_DESCRIBE_ONLY) --SKIPIF-- <?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); -if (preg_match('/^1[01]\./', oci_client_version()) != 1) { - die("skip expected output only valid with Oracle 10g or greater version of client"); -} ?> --FILE-- <?php diff --git a/ext/oci8/tests/bug43497.phpt b/ext/oci8/tests/bug43497.phpt index 8c57fabee..e3e68aac3 100644 --- a/ext/oci8/tests/bug43497.phpt +++ b/ext/oci8/tests/bug43497.phpt @@ -5,9 +5,6 @@ Bug #43497 (OCI8 XML/getClobVal aka temporary LOBs leak UGA memory) $target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs require(dirname(__FILE__).'/skipif.inc'); if (getenv('SKIP_SLOW_TESTS')) die('skip slow tests excluded by request'); -if (preg_match('/^1[01]\./', oci_client_version()) != 1) { - die("skip expected output only valid with Oracle 10g or greater version of client"); -} ?> --FILE-- <?php diff --git a/ext/oci8/tests/bug43497_92.phpt b/ext/oci8/tests/bug43497_92.phpt deleted file mode 100644 index cc2a96318..000000000 --- a/ext/oci8/tests/bug43497_92.phpt +++ /dev/null @@ -1,305 +0,0 @@ ---TEST-- -Bug #43497 (OCI8 XML/getClobVal aka temporary LOBs leak UGA memory) ---SKIPIF-- -<?php -$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs -require(dirname(__FILE__).'/skipif.inc'); -if (getenv('SKIP_SLOW_TESTS')) die('skip slow tests excluded by request'); -ob_start(); -phpinfo(INFO_MODULES); -$phpinfo = ob_get_clean(); -$iv = preg_match('/Oracle .*Version => (9\.2)/', $phpinfo); -if ($iv != 1) { - die ("skip tests a feature that works only with Oracle 9iR2 client"); -} -?> ---FILE-- -<?php - -require dirname(__FILE__).'/connect.inc'; - -function sessionid($c) // determines and returns current session ID -{ - $query = "select sid from v\$session where audsid = userenv('sessionid')"; - - $stmt = oci_parse($c, $query); - - if (oci_execute($stmt, OCI_DEFAULT)) { - $row = oci_fetch($stmt); - return oci_result($stmt, 1); - } - - return null; -} - - -function templobs($c, $sid) // returns number of temporary LOBs -{ - $query = "select abstract_lobs from v\$temporary_lobs where sid = " . $sid; - - $stmt = oci_parse($c, $query); - - if (oci_execute($stmt, OCI_DEFAULT)) { - $row = oci_fetch($stmt); - $val = oci_result($stmt, 1); - oci_free_statement($stmt); - return $val; - } - return null; -} - - -// Read all XML data using explicit LOB locator -function readxmltab_ex($c) -{ - $stmt = oci_parse($c, "select extract(xml, '/').getclobval() from bug43497_tab"); - - $cntchk = 0; - if (oci_execute($stmt)) { - while ($result = oci_fetch_array($stmt, OCI_NUM)) { - $result[0]->free(); // cleanup properly - ++$cntchk; - } - } - echo "Loop count check = $cntchk\n"; -} - -// Read all XML data using explicit LOB locator but without freeing the temp lobs -function readxmltab_ex_nofree($c) -{ - $stmt = oci_parse($c, "select extract(xml, '/').getclobval() from bug43497_tab"); - - $cntchk = 0; - if (oci_execute($stmt)) { - while ($result = oci_fetch_array($stmt, OCI_NUM)) { - ++$cntchk; - } - } - echo "Loop count check = $cntchk\n"; -} - -// Read all XML data using implicit LOB locator -function readxmltab_im($c) -{ - $stmt = oci_parse($c, "select extract(xml, '/').getclobval() from bug43497_tab"); - - $cntchk = 0; - if (oci_execute($stmt)) { - while ($result = oci_fetch_array($stmt, OCI_NUM+OCI_RETURN_LOBS)) { - ++$cntchk; - } - } - echo "Loop count check = $cntchk\n"; -} - -function createxmltab($c) // create table w/ field of XML type -{ - @dropxmltab($c); - $stmt = oci_parse($c, "create table bug43497_tab (id number primary key, xml xmltype)"); - oci_execute($stmt); -} - -function dropxmltab($c) // delete table -{ - $stmt = oci_parse($c, "drop table bug43497_tab"); - oci_execute($stmt); -} - - -function fillxmltab($c) -{ - for ($id = 1; $id <= 100; $id++) { - - // create an XML element string with random data - $s = "<data>"; - for ($j = 0; $j < 128; $j++) { - $s .= rand(); - } - $s .= "</data>\n"; - for ($j = 0; $j < 4; $j++) { - $s .= $s; - } - $data = "<?xml version=\"1.0\"?><records>" . $s . "</records>"; - - // insert XML data into database - - $stmt = oci_parse($c, "insert into bug43497_tab(id, xml) values (:id, sys.xmltype.createxml(:xml))"); - oci_bind_by_name($stmt, ":id", $id); - $clob = oci_new_descriptor($c, OCI_D_LOB); - oci_bind_by_name($stmt, ":xml", $clob, -1, OCI_B_CLOB); - $clob->writetemporary($data); - oci_execute($stmt); - - $clob->close(); - $clob->free(); - } -} - - -// Initialize - -createxmltab($c); -fillxmltab($c); - -// Run Test - -$sid = sessionid($c); - -echo "Explicit LOB use\n"; -for ($i = 1; $i <= 10; $i++) { - echo "\nRun = " . $i . "\n"; - echo "Temporary LOBs = " . templobs($c, $sid) . "\n"; - readxmltab_ex($c); -} - -echo "\nImplicit LOB use\n"; -for ($i = 1; $i <= 10; $i++) { - echo "\nRun = " . $i . "\n"; - echo "Temporary LOBs = " . templobs($c, $sid) . "\n"; - readxmltab_im($c); -} - -echo "\nExplicit LOB with no free (i.e. a temp lob leak)\n"; -for ($i = 1; $i <= 10; $i++) { - echo "\nRun = " . $i . "\n"; - echo "Temporary LOBs = " . templobs($c, $sid) . "\n"; - readxmltab_ex_nofree($c); -} - - - -// Cleanup - -dropxmltab($c); - -oci_close($c); - -echo "Done\n"; -?> ---EXPECT-- -Explicit LOB use - -Run = 1 -Temporary LOBs = 0 -Loop count check = 100 - -Run = 2 -Temporary LOBs = 100 -Loop count check = 100 - -Run = 3 -Temporary LOBs = 200 -Loop count check = 100 - -Run = 4 -Temporary LOBs = 300 -Loop count check = 100 - -Run = 5 -Temporary LOBs = 400 -Loop count check = 100 - -Run = 6 -Temporary LOBs = 500 -Loop count check = 100 - -Run = 7 -Temporary LOBs = 600 -Loop count check = 100 - -Run = 8 -Temporary LOBs = 700 -Loop count check = 100 - -Run = 9 -Temporary LOBs = 800 -Loop count check = 100 - -Run = 10 -Temporary LOBs = 900 -Loop count check = 100 - -Implicit LOB use - -Run = 1 -Temporary LOBs = 1000 -Loop count check = 100 - -Run = 2 -Temporary LOBs = 1100 -Loop count check = 100 - -Run = 3 -Temporary LOBs = 1200 -Loop count check = 100 - -Run = 4 -Temporary LOBs = 1300 -Loop count check = 100 - -Run = 5 -Temporary LOBs = 1400 -Loop count check = 100 - -Run = 6 -Temporary LOBs = 1500 -Loop count check = 100 - -Run = 7 -Temporary LOBs = 1600 -Loop count check = 100 - -Run = 8 -Temporary LOBs = 1700 -Loop count check = 100 - -Run = 9 -Temporary LOBs = 1800 -Loop count check = 100 - -Run = 10 -Temporary LOBs = 1900 -Loop count check = 100 - -Explicit LOB with no free (i.e. a temp lob leak) - -Run = 1 -Temporary LOBs = 2000 -Loop count check = 100 - -Run = 2 -Temporary LOBs = 2100 -Loop count check = 100 - -Run = 3 -Temporary LOBs = 2200 -Loop count check = 100 - -Run = 4 -Temporary LOBs = 2300 -Loop count check = 100 - -Run = 5 -Temporary LOBs = 2400 -Loop count check = 100 - -Run = 6 -Temporary LOBs = 2500 -Loop count check = 100 - -Run = 7 -Temporary LOBs = 2600 -Loop count check = 100 - -Run = 8 -Temporary LOBs = 2700 -Loop count check = 100 - -Run = 9 -Temporary LOBs = 2800 -Loop count check = 100 - -Run = 10 -Temporary LOBs = 2900 -Loop count check = 100 -Done
\ No newline at end of file diff --git a/ext/oci8/tests/bug47281.phpt b/ext/oci8/tests/bug47281.phpt index d0e002353..00c43c22d 100644 --- a/ext/oci8/tests/bug47281.phpt +++ b/ext/oci8/tests/bug47281.phpt @@ -6,11 +6,12 @@ $target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on t require(dirname(__FILE__).'/skipif.inc'); // error3.phpt obsoletes this test for newer Oracle client versions // Assume runtime client version is >= compile time client version -$cv = explode('.', oci_client_version()); -if ($cv[0] > 11 || ($cv[0] == 11 && $cv[1] > 2) || ($cv[0] == 11 && $cv[1] == 2 && $cv[3] >= 3)) { +preg_match('/^([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)/', oci_client_version(), $matches); +if (!isset($matches[0]) || + ($matches[1] > 11 || ($matches[1] == 11 && $matches[2] > 2) || ($matches[1] == 11 && $matches[2] == 2 && $matches[4] >= 3) + )) { die("skip test works only with Oracle 11.2.0.2 or earlier Oracle client libraries"); } - ?> --ENV-- NLS_LANG=.AL32UTF8 diff --git a/ext/oci8/tests/clientversion.phpt b/ext/oci8/tests/clientversion.phpt index db70b5aff..262ded462 100644 --- a/ext/oci8/tests/clientversion.phpt +++ b/ext/oci8/tests/clientversion.phpt @@ -3,9 +3,6 @@ oci_client_version() --SKIPIF-- <?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); -if (preg_match('/^1[012]\./', oci_client_version()) != 1) { - die("skip test expected to work only with Oracle 10g or greater version of client"); -} ?> --FILE-- <?php diff --git a/ext/oci8/tests/clientversion_92.phpt b/ext/oci8/tests/clientversion_92.phpt deleted file mode 100644 index d4b92cd35..000000000 --- a/ext/oci8/tests/clientversion_92.phpt +++ /dev/null @@ -1,20 +0,0 @@ ---TEST-- -oci_client_version() for Oracle 9.2 client libraries ---SKIPIF-- -<?php -if (!extension_loaded('oci8')) die("skip no oci8 extension"); -if (preg_match('/Unknown/', oci_client_version()) != 1) { - die("skip test expected to work only with Oracle 9gR2 client libraries"); -} -?> ---FILE-- -<?php - -echo oci_client_version(), "\n"; - -?> -===DONE=== -<?php exit(0); ?> ---EXPECTF-- -Unknown -===DONE=== diff --git a/ext/oci8/tests/commit_001.phpt b/ext/oci8/tests/commit_001.phpt index 806fb193a..ef4018118 100644 --- a/ext/oci8/tests/commit_001.phpt +++ b/ext/oci8/tests/commit_001.phpt @@ -81,48 +81,48 @@ echo "Done\n"; bool(true) int(0) array(5) { - [%u|b%"ID"]=> + ["ID"]=> array(0) { } - [%u|b%"VALUE"]=> + ["VALUE"]=> array(0) { } - [%u|b%"BLOB"]=> + ["BLOB"]=> array(0) { } - [%u|b%"CLOB"]=> + ["CLOB"]=> array(0) { } - [%u|b%"STRING"]=> + ["STRING"]=> array(0) { } } bool(true) int(4) array(5) { - [%u|b%"ID"]=> + ["ID"]=> array(4) { [0]=> - %string|unicode%(1) "1" + string(1) "1" [1]=> - %string|unicode%(1) "1" + string(1) "1" [2]=> - %string|unicode%(1) "1" + string(1) "1" [3]=> - %string|unicode%(1) "1" + string(1) "1" } - [%u|b%"VALUE"]=> + ["VALUE"]=> array(4) { [0]=> - %string|unicode%(1) "1" + string(1) "1" [1]=> - %string|unicode%(1) "1" + string(1) "1" [2]=> - %string|unicode%(1) "1" + string(1) "1" [3]=> - %string|unicode%(1) "1" + string(1) "1" } - [%u|b%"BLOB"]=> + ["BLOB"]=> array(4) { [0]=> NULL @@ -133,7 +133,7 @@ array(5) { [3]=> NULL } - [%u|b%"CLOB"]=> + ["CLOB"]=> array(4) { [0]=> NULL @@ -144,7 +144,7 @@ array(5) { [3]=> NULL } - [%u|b%"STRING"]=> + ["STRING"]=> array(4) { [0]=> NULL diff --git a/ext/oci8/tests/conn_attr.inc b/ext/oci8/tests/conn_attr.inc index 220e68821..2edc1c955 100644 --- a/ext/oci8/tests/conn_attr.inc +++ b/ext/oci8/tests/conn_attr.inc @@ -2,30 +2,28 @@ require(dirname(__FILE__)."/connect.inc"); -$sv = oci_server_version($c); -$sv = preg_match('/Release (11\.2|12)\./', $sv, $matches); -if ($sv == 1) { +preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); +if ((isset($matches[1]) && $matches[1] >= 11)) { // Server is Oracle 11.2+ $stmtarray = array( - "drop user testuser cascade", - "create user testuser identified by testuser", - "grant connect,resource,dba to testuser", - "alter user testuser enable editions", - "drop edition myedition1", - "drop edition myedition", - "grant create any edition to testuser", + "drop user $testuser cascade", + "create user $testuser identified by $testpassword", // $testuser should be set by the file that includes conn_attr.inc + "grant connect,resource,dba to $testuser", + "alter user $testuser enable editions", + "drop edition myedition1 cascade", + "drop edition myedition cascade", + "grant create any edition to $testuser", "create edition myedition", "create edition myedition1 as child of myedition", - "grant use on edition myedition to testuser", - "grant use on edition myedition1 to testuser", + "grant use on edition myedition to $testuser", + "grant use on edition myedition1 to $testuser", ); -} -else { +} else { // Server is Pre 11.2 $stmtarray = array( - "drop user testuser cascade", - "create user testuser identified by testuser", - "grant connect,resource,dba to testuser", + "drop user $testuser cascade", + "create user $testuser identified by $testpassword", + "grant connect,resource,dba to $testuser", ); } @@ -68,8 +66,8 @@ function get_attr($conn,$attr) function get_conn($conn_type) { - $user = 'testuser'; - $password = 'testuser'; + $user = $GLOBALS['testuser']; + $password = $GLOBALS['testpassword']; $dbase = $GLOBALS['dbase']; switch($conn_type) { case 1: @@ -139,9 +137,9 @@ function get_sys_attr($conn,$attr) function clean_up($c) { $stmtarray = array( - "drop user testuser cascade", - "drop edition myedition1", - "drop edition myedition", + "drop edition myedition1 cascade", + "drop edition myedition cascade", + "drop user " . $GLOBALS['testuser'] . " cascade", ); foreach ($stmtarray as $stmt) { diff --git a/ext/oci8/tests/conn_attr_1.phpt b/ext/oci8/tests/conn_attr_1.phpt index ad508a2ed..745b1cd93 100644 --- a/ext/oci8/tests/conn_attr_1.phpt +++ b/ext/oci8/tests/conn_attr_1.phpt @@ -9,15 +9,17 @@ 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 (preg_match('/Release 1[01]\./', oci_server_version($c), $matches) !== 1) { +preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); +if (!(isset($matches[0]) && $matches[1] >= 10)) { die("skip expected output only valid when using Oracle 10g or greater database server"); -} else if (preg_match('/^1[01]\./', oci_client_version()) != 1) { - die("skip test expected to work only with Oracle 10g or greater version of client"); } - ?> --FILE-- <?php + +$testuser = 'testuser_attr_1'; // Used in conn_attr.inc +$testpassword = 'testuser'; + require(dirname(__FILE__)."/conn_attr.inc"); $attr_array = array('MODULE','ACTION','CLIENT_INFO','CLIENT_IDENTIFIER'); diff --git a/ext/oci8/tests/conn_attr_2.phpt b/ext/oci8/tests/conn_attr_2.phpt index 107250352..ad83f70c2 100644 --- a/ext/oci8/tests/conn_attr_2.phpt +++ b/ext/oci8/tests/conn_attr_2.phpt @@ -8,40 +8,41 @@ require(dirname(__FILE__).'/skipif.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 (preg_match('/Release 1[01]\./', oci_server_version($c), $matches) !== 1) { +preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); +if (!(isset($matches[0]) && $matches[1] >= 10)) { die("skip expected output only valid when using Oracle 10g or greater database server"); -} else if (preg_match('/^1[01]\./', oci_client_version()) != 1) { - die("skip test expected to work only with Oracle 10g or greater version of client"); } - ?> --INI-- oci8.privileged_connect = On --FILE-- <?php + +$testuser = 'testuser_attr_2'; // Used in conn_attr.inc +$testpassword = 'testuser'; + require(dirname(__FILE__)."/conn_attr.inc"); -$user='testuser'; -$password='testuser'; + $attr_array = array('MODULE','ACTION','CLIENT_INFO','CLIENT_IDENTIFIER'); echo"**Set values using pconnect-1**\n"; -var_dump($pc1 = oci_pconnect($user,$password,$dbase)); +var_dump($pc1 = oci_pconnect($testuser,$testpassword,$dbase)); foreach($attr_array as $attr) { set_attr($pc1,$attr,100); } // using pc1 again echo"\n**Get values using pconnect-2**\n"; -var_dump($pc3 = oci_pconnect($user,$password,$dbase)); +var_dump($pc3 = oci_pconnect($testuser,$testpassword,$dbase)); foreach($attr_array as $attr) { get_attr($pc3,$attr); } // Get with different pconnect echo"\n**Get values using pconnect-3**\n"; -var_dump($pc2 = oci_pconnect($user,$password,$dbase,'UTF8')); +var_dump($pc2 = oci_pconnect($testuser,$testpassword,$dbase,'UTF8')); foreach($attr_array as $attr) { get_attr($pc2,$attr); } @@ -52,15 +53,22 @@ oci_close($pc3); // Re-open a persistent connection and check for the attr values. echo "\n**Re-open a pconnect()**\n"; -var_dump($pc4 = oci_pconnect($user,$password,$dbase)); +var_dump($pc4 = oci_pconnect($testuser,$testpassword,$dbase)); foreach($attr_array as $attr) { get_attr($pc4,$attr); } oci_close($pc4); // Test with SYSDBA connection. -var_dump($sys_c1 = oci_pconnect($user,$password,$dbase,false,OCI_SYSDBA)); -if ($sys_c1) { +echo "\n**Test with SYSDBA connection**\n"; +$sys_c1 = @oci_pconnect($testuser,$testpassword,$dbase,false,OCI_SYSDBA); +var_dump($sys_c1); +if (!$sys_c1) { + $e = oci_error(); + if ($e['code'] != 1031 && $e['code'] != 1017) { + var_dump($e); + } +} else { set_attr($sys_c1,'ACTION',10); get_sys_attr($sys_c1,'ACTION'); get_attr($pc2,'ACTION'); @@ -100,6 +108,6 @@ The value of ACTION is TASK100 The value of CLIENT_INFO is INFO1100 The value of CLIENT_IDENTIFIER is ID00100 -Warning: oci_pconnect(): ORA-01031: %s on line %d +**Test with SYSDBA connection** bool(false) Done diff --git a/ext/oci8/tests/conn_attr_3.phpt b/ext/oci8/tests/conn_attr_3.phpt index be8d3306d..1b00ac5a4 100644 --- a/ext/oci8/tests/conn_attr_3.phpt +++ b/ext/oci8/tests/conn_attr_3.phpt @@ -8,14 +8,17 @@ require(dirname(__FILE__).'/skipif.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 (preg_match('/Release 1[01]\./', oci_server_version($c), $matches) !== 1) { +preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); +if (!(isset($matches[0]) && $matches[1] >= 10)) { die("skip expected output only valid when using Oracle 10g or greater database server"); -} else if (preg_match('/^1[01]\./', oci_client_version()) != 1) { - die("skip test expected to work only with Oracle 10g or greater version of client"); } ?> --FILE-- <?php + +$testuser = 'testuser_attr_3'; // Used in conn_attr.inc +$testpassword = 'testuser'; + require(dirname(__FILE__)."/conn_attr.inc"); echo"**Test Set and get values for the attributes with oci_close() ************\n"; diff --git a/ext/oci8/tests/conn_attr_4.phpt b/ext/oci8/tests/conn_attr_4.phpt index 4885f80b7..0a6b814e4 100644 --- a/ext/oci8/tests/conn_attr_4.phpt +++ b/ext/oci8/tests/conn_attr_4.phpt @@ -9,21 +9,23 @@ if (getenv('SKIP_SLOW_TESTS')) die('skip slow tests excluded by request'); 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 (preg_match('/Release (11\.2|12)\./', oci_server_version($c), $matches) !== 1) { - // Bug fixed in 11.2 prevents client_info being rest +preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); +if (!(isset($matches[0]) && + (($matches[1] == 11 && $matches[2] >= 2) || + ($matches[1] >= 12) + ))) { + // Bug fixed in 11.2 prevents client_info being reset die("skip expected output only valid when using Oracle 11gR2 or greater database server"); -} else if (preg_match('/^1[01]\./', oci_client_version()) != 1) { - die("skip test expected to work only with Oracle 10g or greater version of client"); } ?> --FILE-- <?php +$testuser = 'testuser_attr_4'; // Used in conn_attr.inc +$testpassword = 'testuser'; require(dirname(__FILE__)."/conn_attr.inc"); -$user='testuser'; -$password='testuser'; $attr_array = array('MODULE','ACTION','CLIENT_INFO','CLIENT_IDENTIFIER'); echo"**Test Negative cases************\n"; @@ -40,7 +42,7 @@ var_dump(oci_set_client_info($str1,$str1)); // Setting an Invalid value. echo "\nInvalid Value \n"; -$c1=oci_connect($user,$password,$dbase); +$c1=oci_connect($testuser,$testpassword,$dbase); var_dump(oci_set_action($c1,$c1)); // Setting values multiple times. diff --git a/ext/oci8/tests/conn_attr_5.phpt b/ext/oci8/tests/conn_attr_5.phpt index d694ec06a..70a6d2b09 100644 --- a/ext/oci8/tests/conn_attr_5.phpt +++ b/ext/oci8/tests/conn_attr_5.phpt @@ -8,14 +8,17 @@ require(dirname(__FILE__).'/skipif.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 (preg_match('/Release 1[01]\./', oci_server_version($c), $matches) !== 1) { +preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); +if (!(isset($matches[0]) && $matches[1] >= 10)) { die("skip expected output only valid when using Oracle 10g or greater database server"); -} else if (preg_match('/^1[01]\./', oci_client_version()) != 1) { - die("skip test expected to work only with Oracle 10g or greater version of client"); } ?> --FILE-- <?php + +$testuser = 'testuser_attr_5'; // Used in conn_attr.inc +$testpassword = 'testuser'; + require(dirname(__FILE__)."/conn_attr.inc"); echo"**Test - Set and get values for the attributes with scope end ************\n"; diff --git a/ext/oci8/tests/connect_without_oracle_home.phpt b/ext/oci8/tests/connect_without_oracle_home.phpt index e14fb9369..831fc23d6 100644 --- a/ext/oci8/tests/connect_without_oracle_home.phpt +++ b/ext/oci8/tests/connect_without_oracle_home.phpt @@ -10,9 +10,9 @@ $ov = preg_match('/Compile-time ORACLE_HOME/', $phpinfo); if ($ov !== 1) { die ("skip Test only valid when OCI8 is built with an ORACLE_HOME"); } -$iv = preg_match('/Oracle .*Version => (10\.2)/', $phpinfo); -if ($iv != 1) { - die ("skip tests a feature that works only with Oracle 10gR2"); +preg_match('/^([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)/', oci_client_version(), $matches); +if (!isset($matches[0]) || !($matches[1] == 10 && $matches[2] == 2)) { + die ("skip tests a feature that works only with Oracle 10gR2 client"); } ?> --ENV-- diff --git a/ext/oci8/tests/connect_without_oracle_home_11.phpt b/ext/oci8/tests/connect_without_oracle_home_11.phpt index 1620803db..42c456445 100644 --- a/ext/oci8/tests/connect_without_oracle_home_11.phpt +++ b/ext/oci8/tests/connect_without_oracle_home_11.phpt @@ -10,7 +10,11 @@ $ov = preg_match('/Compile-time ORACLE_HOME/', $phpinfo); if ($ov != 1) { die ("skip Test only valid when OCI8 is built with an ORACLE_HOME"); } -if (preg_match('/^11\.2|12\./', oci_client_version()) != 1) { +preg_match('/^([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)/', oci_client_version(), $matches); +if (!(isset($matches[0]) && + (($matches[1] == 11 && $matches[2] >= 2) || + ($matches[1] >= 12) + ))) { die("skip test expected to work only with Oracle 11gR2 or greater version of client"); } ?> diff --git a/ext/oci8/tests/connect_without_oracle_home_old.phpt b/ext/oci8/tests/connect_without_oracle_home_old.phpt index 5a731337a..d6d12b47b 100644 --- a/ext/oci8/tests/connect_without_oracle_home_old.phpt +++ b/ext/oci8/tests/connect_without_oracle_home_old.phpt @@ -10,9 +10,6 @@ $ov = preg_match('/Compile-time ORACLE_HOME/', $phpinfo); if ($ov !== 1) { die ("skip Test only valid when OCI8 is built with an ORACLE_HOME"); } -if (preg_match('/^10\.2\./', oci_client_version()) != 1) { - die("skip test expected to work only with Oracle 10gR2 client libraries"); -} ?> --ENV-- ORACLE_HOME="" @@ -33,5 +30,8 @@ else { <?php exit(0); ?> --EXPECTF-- Warning: ocilogon(): OCIEnvNlsCreate() failed. There is something wrong with your system - please check that ORACLE_HOME and %s are set and point to the right directories in %s on line %d + +Warning: ocilogon(): %s ORA-01804 + in %s on line %d bool(false) ===DONE=== diff --git a/ext/oci8/tests/connect_without_oracle_home_old_11.phpt b/ext/oci8/tests/connect_without_oracle_home_old_11.phpt index c7cfecf39..eb5fb0cc4 100644 --- a/ext/oci8/tests/connect_without_oracle_home_old_11.phpt +++ b/ext/oci8/tests/connect_without_oracle_home_old_11.phpt @@ -10,7 +10,11 @@ $ov = preg_match('/Compile-time ORACLE_HOME/', $phpinfo); if ($ov !== 1) { die ("skip Test only valid when OCI8 is built with an ORACLE_HOME"); } -if (preg_match('/^11\.2|12\./', oci_client_version()) != 1) { +preg_match('/^([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)/', oci_client_version(), $matches); +if (!(isset($matches[0]) && + (($matches[1] == 11 && $matches[2] >= 2) || + ($matches[1] >= 12) + ))) { die("skip test expected to work only with Oracle 11gR2 or greater version of client"); } ?> diff --git a/ext/oci8/tests/cursors_old.phpt b/ext/oci8/tests/cursors_old.phpt index d60e2ff1e..aa2593757 100644 --- a/ext/oci8/tests/cursors_old.phpt +++ b/ext/oci8/tests/cursors_old.phpt @@ -52,19 +52,19 @@ echo "Done\n"; ?> --EXPECTF-- array(2) { - [%u|b%"ID"]=> - %unicode|string%(1) "1" - [%u|b%"VALUE"]=> - %unicode|string%(1) "1" + ["ID"]=> + string(1) "1" + ["VALUE"]=> + string(1) "1" } bool(true) Warning: ocifetchinto():%sORA-01002: %s in %scursors_old.php on line %d array(2) { - [%u|b%"ID"]=> - %unicode|string%(1) "1" - [%u|b%"VALUE"]=> - %unicode|string%(1) "1" + ["ID"]=> + string(1) "1" + ["VALUE"]=> + string(1) "1" } bool(true) Done diff --git a/ext/oci8/tests/db_op_1.phpt b/ext/oci8/tests/db_op_1.phpt new file mode 100644 index 000000000..f645cf80f --- /dev/null +++ b/ext/oci8/tests/db_op_1.phpt @@ -0,0 +1,61 @@ +--TEST-- +oci_set_db_operation: basic test for end-to-end tracing +--SKIPIF-- +<?php +if (!extension_loaded('oci8')) die ("skip no oci8 extension"); +$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +if (strcasecmp($user, "system") && strcasecmp($user, "sys")) { + die("skip needs to be run as a DBA user"); +} +preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); +if (!(isset($matches[0]) && $matches[1] >= 12)) { + die("skip expected output only valid when using Oracle Database 12c or greater"); +} +preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); +if (!(isset($matches[0]) && $matches[0] >= 12)) { + die("skip works only with Oracle 12c or greater version of Oracle client libraries"); +} +if (!function_exists('oci_set_db_operation')) +{ + die("skip function oci_set_db_operation() does not exist"); +} +?> +--FILE-- +<?php + +require(dirname(__FILE__).'/connect.inc'); + +// Run Test + +echo "Test 1\n"; + +// Test setting the "DB operation" used by Oracle DB for end-to-end application tracing + +function dq($c, $q) +{ + $s = oci_parse($c, $q); + oci_execute($s); + var_dump(oci_fetch_assoc($s)); +} + +oci_set_db_operation($c, "db_op_1"); +dq($c, 'select * from dual'); + +dq($c, 'select dbop_name from v$sql_monitor where dbop_name is not null order by dbop_exec_id desc'); + +?> +===DONE=== +<?php exit(0); ?> +--EXPECTF-- +Test 1 +array(1) { + ["DUMMY"]=> + string(1) "X" +} +array(1) { + ["DBOP_NAME"]=> + string(7) "db_op_1" +} +===DONE=== + diff --git a/ext/oci8/tests/db_op_2.phpt b/ext/oci8/tests/db_op_2.phpt new file mode 100644 index 000000000..05c2269ae --- /dev/null +++ b/ext/oci8/tests/db_op_2.phpt @@ -0,0 +1,69 @@ +--TEST-- +oci_set_db_operation: basic test for end-to-end tracing +--SKIPIF-- +<?php +if (!extension_loaded('oci8')) die ("skip no oci8 extension"); +$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +if (strcasecmp($user, "system") && strcasecmp($user, "sys")) { + die("skip needs to be run as a DBA user"); +} +preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); +if (!(isset($matches[0]) && $matches[1] >= 12)) { + die("skip expected output only valid when using Oracle Database 12c or greater"); +} +preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); +if (!(isset($matches[0]) && $matches[0] >= 12)) { + die("skip works only with Oracle 12c or greater version of Oracle client libraries"); +} +if (!function_exists('oci_set_db_operation')) +{ + die("skip function oci_set_db_operation() does not exist"); +} +?> +--FILE-- +<?php + +require(dirname(__FILE__).'/connect.inc'); + +function dq($c, $q) +{ + $s = oci_parse($c, $q); + oci_execute($s); + var_dump(oci_fetch_assoc($s)); +} + +echo "Test 1\n"; +oci_set_db_operation($c, "db_op_2_a"); +dq($c, 'select * from dual'); + +echo "Test 2\n"; +oci_set_db_operation($c, "db_op_2_b"); +dq($c, 'select * from dual'); + +echo "Test 3\n"; +dq($c, 'select dbop_name from v$sql_monitor where dbop_name like \'db_op2%\' order by dbop_exec_id desc'); + +?> +===DONE=== +<?php exit(0); ?> +--XFAIL-- +Fails due to Oracle Bug 16695981 +--EXPECTF-- +Test 1 +array(1) { + ["DUMMY"]=> + string(1) "X" +} +Test 2 +array(1) { + ["DUMMY"]=> + string(1) "X" +} +Test 3 +array(2) { + ["DBOP_NAME"]=> + string(7) "db_op_2a" +} +===DONE=== + diff --git a/ext/oci8/tests/debug.phpt b/ext/oci8/tests/debug.phpt index fe96e6e87..66ab0f0d0 100644 --- a/ext/oci8/tests/debug.phpt +++ b/ext/oci8/tests/debug.phpt @@ -16,10 +16,9 @@ else { oci_connect($user, $password); } -echo "Done\n"; - oci_internal_debug(false); ?> ---EXPECTREGEX-- -^OCI8 DEBUG: .*Done$ +===DONE=== +--EXPECT-- +===DONE=== diff --git a/ext/oci8/tests/define.phpt b/ext/oci8/tests/define.phpt index c6ce7bd9b..b78f698e7 100644 --- a/ext/oci8/tests/define.phpt +++ b/ext/oci8/tests/define.phpt @@ -44,5 +44,5 @@ echo "Done\n"; ?> --EXPECTF-- -%unicode|string%(%d) "some" +string(%d) "some" Done diff --git a/ext/oci8/tests/define1.phpt b/ext/oci8/tests/define1.phpt index 6e4b74e3b..be16271d5 100644 --- a/ext/oci8/tests/define1.phpt +++ b/ext/oci8/tests/define1.phpt @@ -55,5 +55,5 @@ bool(false) Warning: oci_define_by_name() expects at least 3 parameters, 2 given in %s on line %d NULL -%unicode|string%(4) "some" +string(4) "some" Done diff --git a/ext/oci8/tests/define4.phpt b/ext/oci8/tests/define4.phpt index 266fd7edd..3114a7393 100644 --- a/ext/oci8/tests/define4.phpt +++ b/ext/oci8/tests/define4.phpt @@ -58,15 +58,15 @@ echo "Done\n"; Test 1 bool(true) Test 2 -%unicode|string%(4) "1234" -%unicode|string%(4) "some" -%unicode|string%(4) "some" -%unicode|string%(4) "some" -%unicode|string%(4) "1234" -%unicode|string%(4) "some" +string(4) "1234" +string(4) "some" +string(4) "some" +string(4) "some" +string(4) "1234" +string(4) "some" Test 3 bool(true) -%unicode|string%(4) "some" +string(4) "some" Warning: oci_result(): %d is not a valid oci8 statement resource in %s on line %d bool(false) diff --git a/ext/oci8/tests/define5.phpt b/ext/oci8/tests/define5.phpt index 68fa01d09..978d66b26 100644 --- a/ext/oci8/tests/define5.phpt +++ b/ext/oci8/tests/define5.phpt @@ -61,12 +61,12 @@ echo "Done\n"; Test 1 - must do define before execute bool(true) NULL -%unicode|string%(4) "some" +string(4) "some" Test 2 - normal define order bool(true) -%unicode|string%(4) "some" +string(4) "some" Test 3 - no new define done -%unicode|string%(4) "some" -%unicode|string%(5) "thing" +string(4) "some" +string(5) "thing" Done diff --git a/ext/oci8/tests/define_old.phpt b/ext/oci8/tests/define_old.phpt index f65e6b808..cc07e2ea9 100644 --- a/ext/oci8/tests/define_old.phpt +++ b/ext/oci8/tests/define_old.phpt @@ -44,5 +44,5 @@ echo "Done\n"; ?> --EXPECTF-- -%unicode|string%(4) "some" +string(4) "some" Done diff --git a/ext/oci8/tests/details.inc b/ext/oci8/tests/details.inc index 9a86c4686..e54ea84ab 100644 --- a/ext/oci8/tests/details.inc +++ b/ext/oci8/tests/details.inc @@ -52,7 +52,7 @@ if (!function_exists('oci8_test_sql_execute')) { $s = oci_parse($c, $stmt); if (!$s) { $m = oci_error($c); - echo $stmt . PHP_EOL . $m['message'] . PHP_EOL; + echo "oci8_test_sql_execute() error:". PHP_EOL . $stmt . PHP_EOL . $m['message'] . PHP_EOL; } else { $r = @oci_execute($s); @@ -66,7 +66,7 @@ if (!function_exists('oci8_test_sql_execute')) { , 4080 // trigger does not exist , 38802 // edition does not exist ))) { - echo $stmt . PHP_EOL . $m['message'] . PHP_EOL; + echo "oci8_test_sql_execute() error:". PHP_EOL . $stmt . PHP_EOL . $m['message'] . PHP_EOL; } } } diff --git a/ext/oci8/tests/drcp_cclass1.phpt b/ext/oci8/tests/drcp_cclass1.phpt index 068331e5a..5c78a2943 100644 --- a/ext/oci8/tests/drcp_cclass1.phpt +++ b/ext/oci8/tests/drcp_cclass1.phpt @@ -3,9 +3,21 @@ DRCP: Test setting connection class inline --SKIPIF-- <?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); -require(dirname(__FILE__)."/details.inc"); +require(dirname(__FILE__).'/connect.inc'); if (!$test_drcp) die("skip testing DRCP connection class only works in DRCP mode"); if (strcasecmp($user, "system") && strcasecmp($user, "sys")) die("skip needs to be run as a DBA user"); + +preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches_sv); +// This test in Oracle 12c needs a non-CDB or the root container +if (isset($matches_sv[0]) && $matches_sv[1] >= 12) { + $s = oci_parse($c, "select nvl(sys_context('userenv', 'con_name'), 'notacdb') as dbtype from dual"); + $r = @oci_execute($s); + if (!$r) + die('skip could not identify container type'); + $r = oci_fetch_array($s); + if ($r['DBTYPE'] !== 'CDB$ROOT') + die('skip cannot run test using a PDB'); +} ?> --FILE-- <?php diff --git a/ext/oci8/tests/drcp_connection_class.phpt b/ext/oci8/tests/drcp_connection_class.phpt index 2aed131c1..c01c144d2 100644 --- a/ext/oci8/tests/drcp_connection_class.phpt +++ b/ext/oci8/tests/drcp_connection_class.phpt @@ -1,7 +1,13 @@ --TEST-- DRCP: oci8.connection_class with ini_get() and ini_set() --SKIPIF-- -<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> +<?php +if (!extension_loaded('oci8')) die("skip no oci8 extension"); +preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); +if (!(isset($matches[0]) && $matches[0] >= 11)) { + die("skip works only with Oracle 11g or greater version of Oracle client libraries"); +} +?> --INI-- oci8.connection_class=test --FILE-- diff --git a/ext/oci8/tests/drcp_privileged.phpt b/ext/oci8/tests/drcp_privileged.phpt index da8702e3c..3871341bc 100644 --- a/ext/oci8/tests/drcp_privileged.phpt +++ b/ext/oci8/tests/drcp_privileged.phpt @@ -3,7 +3,8 @@ DRCP: privileged connect --SKIPIF-- <?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); -require(dirname(__FILE__)."/details.inc"); +require(dirname(__FILE__)."/connect.inc"); +if (!$test_drcp) die("skip requires DRCP connection"); if (strcasecmp($user, "system") && strcasecmp($user, "sys")) die("skip needs to be run as a DBA user"); ob_start(); phpinfo(INFO_MODULES); @@ -12,6 +13,18 @@ if (preg_match('/Compile-time ORACLE_HOME/', $phpinfo) !== 1) { // Assume building PHP with an ORACLE_HOME means the tested DB is on the same machine as PHP die("skip this test is unlikely to work with a remote database - unless an Oracle password file has been created"); } + +preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches_sv); +// This test in Oracle 12c needs a non-CDB or the root container +if (isset($matches_sv[0]) && $matches_sv[1] >= 12) { + $s = oci_parse($c, "select nvl(sys_context('userenv', 'con_name'), 'notacdb') as dbtype from dual"); + $r = @oci_execute($s); + if (!$r) + die('skip could not identify container type'); + $r = oci_fetch_array($s); + if ($r['DBTYPE'] !== 'CDB$ROOT') + die('skip cannot run test using a PDB'); +} ?> --INI-- oci8.privileged_connect=1 diff --git a/ext/oci8/tests/driver_name.phpt b/ext/oci8/tests/driver_name.phpt index bf86e66e7..f63979d6b 100644 --- a/ext/oci8/tests/driver_name.phpt +++ b/ext/oci8/tests/driver_name.phpt @@ -7,10 +7,19 @@ 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 as Output might vary with DRCP"); -if (preg_match('/Release (11\.2|12)/', oci_server_version($c), $matches) !== 1) { - die("skip expected output only valid when using Oracle 11gR2 or greater databases"); -} else if (preg_match('/^(11\.2|12\.)/', oci_client_version()) != 1) { - die("skip test expected to work only with Oracle 11g or greater version of client"); +preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); +if (!(isset($matches[0]) && + (($matches[1] == 11 && $matches[2] >= 2) || + ($matches[1] >= 12) + ))) { + die("skip expected output only valid when using Oracle 11gR2 or greater database server"); +} +preg_match('/^([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)/', oci_client_version(), $matches); +if (!(isset($matches[0]) && + (($matches[1] == 11 && $matches[2] >= 2) || + ($matches[1] >= 12) + ))) { + die("skip test expected to work only with Oracle 11gR2 or greater version of client"); } ?> diff --git a/ext/oci8/tests/edition_1.phpt b/ext/oci8/tests/edition_1.phpt index b9c8fd817..3e55ee902 100644 --- a/ext/oci8/tests/edition_1.phpt +++ b/ext/oci8/tests/edition_1.phpt @@ -10,9 +10,18 @@ if (strcasecmp($user, "system") && strcasecmp($user, "sys")) { if ($test_drcp) { die("skip as Output might vary with DRCP"); } -if (preg_match('/Release (1[1]\.2|12)\./', oci_server_version($c), $matches) !== 1) { - die("skip expected output only valid when using Oracle 11gR2 or greater databases"); -} else if (preg_match('/^(11\.2|12)\./', oci_client_version()) != 1) { +preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); +if (!(isset($matches[0]) && + (($matches[1] == 11 && $matches[2] >= 2) || + ($matches[1] >= 12) + ))) { + die("skip expected output only valid when using Oracle 11gR2 or greater database server"); +} +preg_match('/^([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)/', oci_client_version(), $matches); +if (!(isset($matches[0]) && + (($matches[1] == 11 && $matches[2] >= 2) || + ($matches[1] >= 12) + ))) { die("skip test expected to work only with Oracle 11gR2 or greater version of client"); } ?> @@ -24,6 +33,9 @@ if (preg_match('/Release (1[1]\.2|12)\./', oci_server_version($c), $matches) !== * already */ +$testuser = 'testuser_attr_1'; // Used in conn_attr.inc +$testpassword = 'testuser'; + require(dirname(__FILE__)."/conn_attr.inc"); function select_fn($conn) { @@ -39,7 +51,7 @@ function select_fn($conn) { select from both the editions and verify the contents. */ set_edit_attr('MYEDITION'); -$conn = oci_connect('testuser','testuser',$dbase); +$conn = oci_connect($testuser,$testpassword,$dbase); if ($conn === false) { $m = oci_error(); die("Error:" . $m['message']); @@ -61,7 +73,7 @@ select_fn($conn); // Create a different version of view_ed in MYEDITION1. set_edit_attr('MYEDITION1'); -$conn2 = oci_new_connect('testuser','testuser',$dbase); +$conn2 = oci_new_connect($testuser,$testpassword,$dbase); $stmt = "create or replace editioning view view_ed as select name,age,job,salary from edit_tab"; $s = oci_parse($conn2, $stmt); oci_execute($s); @@ -87,58 +99,58 @@ The value of edition has been successfully set The value of current EDITION is MYEDITION array(3) { [0]=> - %unicode|string%(%d) "mike" + string(%d) "mike" [1]=> - %unicode|string%(%d) "30" + string(%d) "30" [2]=> - %unicode|string%(%d) "Senior engineer" + string(%d) "Senior engineer" } array(3) { [0]=> - %unicode|string%(%d) "juan" + string(%d) "juan" [1]=> - %unicode|string%(%d) "25" + string(%d) "25" [2]=> - %unicode|string%(%d) "engineer" + string(%d) "engineer" } The value of edition has been successfully set The value of current EDITION is MYEDITION1 array(4) { [0]=> - %unicode|string%(%d) "mike" + string(%d) "mike" [1]=> - %unicode|string%(%d) "30" + string(%d) "30" [2]=> - %unicode|string%(%d) "Senior engineer" + string(%d) "Senior engineer" [3]=> - %unicode|string%(%d) "200" + string(%d) "200" } array(4) { [0]=> - %unicode|string%(%d) "juan" + string(%d) "juan" [1]=> - %unicode|string%(%d) "25" + string(%d) "25" [2]=> - %unicode|string%(%d) "engineer" + string(%d) "engineer" [3]=> - %unicode|string%(%d) "100" + string(%d) "100" } version of view_ed in MYEDITION The value of current EDITION is MYEDITION array(3) { [0]=> - %unicode|string%(%d) "mike" + string(%d) "mike" [1]=> - %unicode|string%(%d) "30" + string(%d) "30" [2]=> - %unicode|string%(%d) "Senior engineer" + string(%d) "Senior engineer" } array(3) { [0]=> - %unicode|string%(%d) "juan" + string(%d) "juan" [1]=> - %unicode|string%(%d) "25" + string(%d) "25" [2]=> - %unicode|string%(%d) "engineer" + string(%d) "engineer" } Done diff --git a/ext/oci8/tests/edition_2.phpt b/ext/oci8/tests/edition_2.phpt index 030e6a673..12e902667 100644 --- a/ext/oci8/tests/edition_2.phpt +++ b/ext/oci8/tests/edition_2.phpt @@ -8,10 +8,18 @@ if (strcasecmp($user, "system") && strcasecmp($user, "sys")) die("skip needs to be run as a DBA user"); if ($test_drcp) die("skip as Output might vary with DRCP"); - -if (preg_match('/Release (1[1]\.2|12)\./', oci_server_version($c), $matches) !== 1) { - die("skip expected output only valid when using Oracle 11gR2 or greater databases"); -} else if (preg_match('/^(11\.2|12)\./', oci_client_version()) != 1) { +preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); +if (!(isset($matches[0]) && + (($matches[1] == 11 && $matches[2] >= 2) || + ($matches[1] >= 12) + ))) { + die("skip expected output only valid when using Oracle 11gR2 or greater database server"); +} +preg_match('/^([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)/', oci_client_version(), $matches); +if (!(isset($matches[0]) && + (($matches[1] == 11 && $matches[2] >= 2) || + ($matches[1] >= 12) + ))) { die("skip test expected to work only with Oracle 11gR2 or greater version of client"); } @@ -24,10 +32,10 @@ if (preg_match('/Release (1[1]\.2|12)\./', oci_server_version($c), $matches) !== * already */ -require(dirname(__FILE__)."/conn_attr.inc"); +$testuser = 'testuser_ed_2'; // Used in conn_attr.inc +$testpassword = 'testuser'; -$user = 'testuser'; -$password = 'testuser'; +require(dirname(__FILE__)."/conn_attr.inc"); echo"**Test 1.1 - Default value for the attribute **************\n"; get_edit_attr($c); @@ -50,7 +58,7 @@ get_edit_attr($conn3); oci_close($conn1); // With a oci_pconnect with a different charset. -$pc1 = oci_pconnect($user,$password,$dbase,"utf8"); +$pc1 = oci_pconnect($testuser,$testpassword,$dbase,"utf8"); get_edit_attr($pc1); oci_close($pc1); @@ -145,7 +153,7 @@ function set_scope() { } function get_scope() { - $sc1 = oci_connect($GLOBALS['user'],$GLOBALS['password'],$GLOBALS['dbase']); + $sc1 = oci_connect($GLOBALS['testuser'],$GLOBALS['testpassword'],$GLOBALS['dbase']); if ($sc1 === false) { $m = oci_error(); die("Error:" . $m['message']); diff --git a/ext/oci8/tests/error_set.phpt b/ext/oci8/tests/error_set.phpt new file mode 100644 index 000000000..ad56e8aef --- /dev/null +++ b/ext/oci8/tests/error_set.phpt @@ -0,0 +1,72 @@ +--TEST-- +Check oci_set_{action,client_identifier,module_name,client_info} error handling +--SKIPIF-- +<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?> +--FILE-- +<?php + +require(dirname(__FILE__).'/connect.inc'); + +error_reporting(E_ALL); +ini_set('display_errors', 'Off'); + +echo "Test 1\n"; + +// Generates "ORA-24960: the attribute OCI_ATTR_* is greater than the maximum allowable length of 64" +$s = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; + +$r = oci_set_action($c, $s); +var_dump($r); +$m = oci_error($c); +echo $m['code'] , "\n"; + +$r = oci_set_client_identifier($c, $s); +var_dump($r); +$m = oci_error($c); +echo $m['code'] , "\n"; + +$r = oci_set_module_name($c, $s); +var_dump($r); +$m = oci_error($c); +echo $m['code'] , "\n"; + +$r = oci_set_client_info($c, $s); +var_dump($r); +$m = oci_error($c); +echo $m['code'] , "\n"; + +echo "\nTest 2\n"; +$s = "x"; + +$r = oci_set_action($c, $s); +var_dump($r); + +$r = oci_set_client_identifier($c, $s); +var_dump($r); + +$r = oci_set_module_name($c, $s); +var_dump($r); + +$r = oci_set_client_info($c, $s); +var_dump($r); + +?> +===DONE=== +<?php exit(0); ?> +--EXPECTF-- +Test 1 +bool(false) +24960 +bool(false) +24960 +bool(false) +24960 +bool(false) +24960 + +Test 2 +bool(true) +bool(true) +bool(true) +bool(true) +===DONE=== diff --git a/ext/oci8/tests/extauth_01.phpt b/ext/oci8/tests/extauth_01.phpt index 37f8f3834..1194ae180 100644 --- a/ext/oci8/tests/extauth_01.phpt +++ b/ext/oci8/tests/extauth_01.phpt @@ -143,56 +143,56 @@ Test 7 Warning: oci_connect(): ORA-12154: %s in %s on line %d array(4) { - [%u|b%"code"]=> + ["code"]=> int(12154) - [%u|b%"message"]=> - %unicode|string%(%d) "ORA-12154: %s" - [%u|b%"offset"]=> + ["message"]=> + string(%d) "ORA-12154: %s" + ["offset"]=> int(0) - [%u|b%"sqltext"]=> - %unicode|string%(0) "" + ["sqltext"]=> + string(0) "" } bool(false) Test 8 Warning: oci_connect(): ORA-12154: %s in %s on line %d array(4) { - [%u|b%"code"]=> + ["code"]=> int(12154) - [%u|b%"message"]=> - %unicode|string%(%d) "ORA-12154: %s" - [%u|b%"offset"]=> + ["message"]=> + string(%d) "ORA-12154: %s" + ["offset"]=> int(0) - [%u|b%"sqltext"]=> - %unicode|string%(0) "" + ["sqltext"]=> + string(0) "" } bool(false) Test 9 Warning: oci_connect(): ORA-%d: TNS:%s in %s on line %d array(4) { - [%u|b%"code"]=> + ["code"]=> int(%d) - [%u|b%"message"]=> - %unicode|string%(%d) "ORA-%d: %s" - [%u|b%"offset"]=> + ["message"]=> + string(%d) "ORA-%d: %s" + ["offset"]=> int(0) - [%u|b%"sqltext"]=> - %unicode|string%(0) "" + ["sqltext"]=> + string(0) "" } bool(false) Test 10 Warning: oci_connect(): ORA-%d: TNS:%s in %s on line %d array(4) { - [%u|b%"code"]=> + ["code"]=> int(%d) - [%u|b%"message"]=> - %unicode|string%(%d) "ORA-%d: %s" - [%u|b%"offset"]=> + ["message"]=> + string(%d) "ORA-%d: %s" + ["offset"]=> int(0) - [%u|b%"sqltext"]=> - %unicode|string%(0) "" + ["sqltext"]=> + string(0) "" } bool(false) ===DONE=== diff --git a/ext/oci8/tests/extauth_02.phpt b/ext/oci8/tests/extauth_02.phpt index f3b517f73..0a3227019 100644 --- a/ext/oci8/tests/extauth_02.phpt +++ b/ext/oci8/tests/extauth_02.phpt @@ -142,56 +142,56 @@ Test 7 Warning: oci_new_connect(): ORA-12154: %s in %s on line %d array(4) { - [%u|b%"code"]=> + ["code"]=> int(12154) - [%u|b%"message"]=> - %unicode|string%(%d) "ORA-12154: %s" - [%u|b%"offset"]=> + ["message"]=> + string(%d) "ORA-12154: %s" + ["offset"]=> int(0) - [%u|b%"sqltext"]=> - %unicode|string%(0) "" + ["sqltext"]=> + string(0) "" } bool(false) Test 8 Warning: oci_new_connect(): ORA-12154: %s in %s on line %d array(4) { - [%u|b%"code"]=> + ["code"]=> int(12154) - [%u|b%"message"]=> - %unicode|string%(%d) "ORA-12154: %s" - [%u|b%"offset"]=> + ["message"]=> + string(%d) "ORA-12154: %s" + ["offset"]=> int(0) - [%u|b%"sqltext"]=> - %unicode|string%(0) "" + ["sqltext"]=> + string(0) "" } bool(false) Test 9 Warning: oci_new_connect(): ORA-%d: TNS:%s %s on line %d array(4) { - [%u|b%"code"]=> + ["code"]=> int(%d) - [%u|b%"message"]=> - %unicode|string%(%d) "ORA-%d: %s" - [%u|b%"offset"]=> + ["message"]=> + string(%d) "ORA-%d: %s" + ["offset"]=> int(0) - [%u|b%"sqltext"]=> - %unicode|string%(0) "" + ["sqltext"]=> + string(0) "" } bool(false) Test 10 Warning: oci_new_connect(): ORA-%d: TNS:%s %s on line %d array(4) { - [%u|b%"code"]=> + ["code"]=> int(%d) - [%u|b%"message"]=> - %unicode|string%(%d) "ORA-%d: %s" - [%u|b%"offset"]=> + ["message"]=> + string(%d) "ORA-%d: %s" + ["offset"]=> int(0) - [%u|b%"sqltext"]=> - %unicode|string%(0) "" + ["sqltext"]=> + string(0) "" } bool(false) ===DONE=== diff --git a/ext/oci8/tests/extauth_03.phpt b/ext/oci8/tests/extauth_03.phpt index e6685eb17..d7884ce6b 100644 --- a/ext/oci8/tests/extauth_03.phpt +++ b/ext/oci8/tests/extauth_03.phpt @@ -142,56 +142,56 @@ Test 7 Warning: oci_pconnect(): ORA-12154: %s in %s on line %d array(4) { - [%u|b%"code"]=> + ["code"]=> int(12154) - [%u|b%"message"]=> - %unicode|string%(%d) "ORA-12154: %s" - [%u|b%"offset"]=> + ["message"]=> + string(%d) "ORA-12154: %s" + ["offset"]=> int(0) - [%u|b%"sqltext"]=> - %unicode|string%(0) "" + ["sqltext"]=> + string(0) "" } bool(false) Test 8 Warning: oci_pconnect(): ORA-12154: %s in %s on line %d array(4) { - [%u|b%"code"]=> + ["code"]=> int(12154) - [%u|b%"message"]=> - %unicode|string%(%d) "ORA-12154: %s" - [%u|b%"offset"]=> + ["message"]=> + string(%d) "ORA-12154: %s" + ["offset"]=> int(0) - [%u|b%"sqltext"]=> - %unicode|string%(0) "" + ["sqltext"]=> + string(0) "" } bool(false) Test 9 Warning: oci_pconnect(): ORA-%d: TNS:%s in %s on line %d array(4) { - [%u|b%"code"]=> + ["code"]=> int(%d) - [%u|b%"message"]=> - %unicode|string%(%d) "ORA-%d: %s" - [%u|b%"offset"]=> + ["message"]=> + string(%d) "ORA-%d: %s" + ["offset"]=> int(0) - [%u|b%"sqltext"]=> - %unicode|string%(0) "" + ["sqltext"]=> + string(0) "" } bool(false) Test 10 Warning: oci_pconnect(): ORA-%d: TNS:%s in %s on line %d array(4) { - [%u|b%"code"]=> + ["code"]=> int(%d) - [%u|b%"message"]=> - %unicode|string%(%d) "ORA-%d: %s" - [%u|b%"offset"]=> + ["message"]=> + string(%d) "ORA-%d: %s" + ["offset"]=> int(0) - [%u|b%"sqltext"]=> - %unicode|string%(0) "" + ["sqltext"]=> + string(0) "" } bool(false) ===DONE=== diff --git a/ext/oci8/tests/fetch.phpt b/ext/oci8/tests/fetch.phpt index e48aeefd8..b968ae4bf 100644 --- a/ext/oci8/tests/fetch.phpt +++ b/ext/oci8/tests/fetch.phpt @@ -47,10 +47,10 @@ oci8_test_sql_execute($c, $stmtarray); echo "Done\n"; ?> --EXPECTF-- -%unicode|string%(1) "1" -%unicode|string%(1) "1" -%unicode|string%(1) "1" -%unicode|string%(1) "1" -%unicode|string%(1) "1" -%unicode|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/fetch_all.phpt b/ext/oci8/tests/fetch_all.phpt index 4fc41daad..b8155b170 100644 --- a/ext/oci8/tests/fetch_all.phpt +++ b/ext/oci8/tests/fetch_all.phpt @@ -51,44 +51,44 @@ echo "Done\n"; --EXPECTF-- int(3) array(2) { - [%u|b%"ID"]=> + ["ID"]=> array(3) { [0]=> - %unicode|string%(1) "1" + string(1) "1" [1]=> - %unicode|string%(1) "1" + string(1) "1" [2]=> - %unicode|string%(1) "1" + string(1) "1" } - [%u|b%"VALUE"]=> + ["VALUE"]=> array(3) { [0]=> - %unicode|string%(1) "1" + string(1) "1" [1]=> - %unicode|string%(1) "1" + string(1) "1" [2]=> - %unicode|string%(1) "1" + string(1) "1" } } int(3) array(2) { - [%u|b%"ID"]=> + ["ID"]=> array(3) { [0]=> - %unicode|string%(1) "1" + string(1) "1" [1]=> - %unicode|string%(1) "1" + string(1) "1" [2]=> - %unicode|string%(1) "1" + string(1) "1" } - [%u|b%"VALUE"]=> + ["VALUE"]=> array(3) { [0]=> - %unicode|string%(1) "1" + string(1) "1" [1]=> - %unicode|string%(1) "1" + string(1) "1" [2]=> - %unicode|string%(1) "1" + string(1) "1" } } Done diff --git a/ext/oci8/tests/fetch_all1.phpt b/ext/oci8/tests/fetch_all1.phpt index 4fc41daad..b8155b170 100644 --- a/ext/oci8/tests/fetch_all1.phpt +++ b/ext/oci8/tests/fetch_all1.phpt @@ -51,44 +51,44 @@ echo "Done\n"; --EXPECTF-- int(3) array(2) { - [%u|b%"ID"]=> + ["ID"]=> array(3) { [0]=> - %unicode|string%(1) "1" + string(1) "1" [1]=> - %unicode|string%(1) "1" + string(1) "1" [2]=> - %unicode|string%(1) "1" + string(1) "1" } - [%u|b%"VALUE"]=> + ["VALUE"]=> array(3) { [0]=> - %unicode|string%(1) "1" + string(1) "1" [1]=> - %unicode|string%(1) "1" + string(1) "1" [2]=> - %unicode|string%(1) "1" + string(1) "1" } } int(3) array(2) { - [%u|b%"ID"]=> + ["ID"]=> array(3) { [0]=> - %unicode|string%(1) "1" + string(1) "1" [1]=> - %unicode|string%(1) "1" + string(1) "1" [2]=> - %unicode|string%(1) "1" + string(1) "1" } - [%u|b%"VALUE"]=> + ["VALUE"]=> array(3) { [0]=> - %unicode|string%(1) "1" + string(1) "1" [1]=> - %unicode|string%(1) "1" + string(1) "1" [2]=> - %unicode|string%(1) "1" + string(1) "1" } } Done diff --git a/ext/oci8/tests/fetch_all3.phpt b/ext/oci8/tests/fetch_all3.phpt index 1748ea565..4c0be1cc0 100644 --- a/ext/oci8/tests/fetch_all3.phpt +++ b/ext/oci8/tests/fetch_all3.phpt @@ -129,105 +129,105 @@ echo "Done\n"; None int(4) array(2) { - [%u|b%"ID"]=> + ["ID"]=> array(4) { [0]=> - %unicode|string%(1) "1" + string(1) "1" [1]=> - %unicode|string%(1) "2" + string(1) "2" [2]=> - %unicode|string%(1) "3" + string(1) "3" [3]=> - %unicode|string%(1) "4" + string(1) "4" } - [%u|b%"VALUE"]=> + ["VALUE"]=> array(4) { [0]=> - %unicode|string%(2) "-1" + string(2) "-1" [1]=> - %unicode|string%(2) "-2" + string(2) "-2" [2]=> - %unicode|string%(2) "-3" + string(2) "-3" [3]=> - %unicode|string%(2) "-4" + string(2) "-4" } } OCI_ASSOC int(4) array(2) { - [%u|b%"ID"]=> + ["ID"]=> array(4) { [0]=> - %unicode|string%(1) "1" + string(1) "1" [1]=> - %unicode|string%(1) "2" + string(1) "2" [2]=> - %unicode|string%(1) "3" + string(1) "3" [3]=> - %unicode|string%(1) "4" + string(1) "4" } - [%u|b%"VALUE"]=> + ["VALUE"]=> array(4) { [0]=> - %unicode|string%(2) "-1" + string(2) "-1" [1]=> - %unicode|string%(2) "-2" + string(2) "-2" [2]=> - %unicode|string%(2) "-3" + string(2) "-3" [3]=> - %unicode|string%(2) "-4" + string(2) "-4" } } OCI_FETCHSTATEMENT_BY_COLUMN int(4) array(2) { - [%u|b%"ID"]=> + ["ID"]=> array(4) { [0]=> - %unicode|string%(1) "1" + string(1) "1" [1]=> - %unicode|string%(1) "2" + string(1) "2" [2]=> - %unicode|string%(1) "3" + string(1) "3" [3]=> - %unicode|string%(1) "4" + string(1) "4" } - [%u|b%"VALUE"]=> + ["VALUE"]=> array(4) { [0]=> - %unicode|string%(2) "-1" + string(2) "-1" [1]=> - %unicode|string%(2) "-2" + string(2) "-2" [2]=> - %unicode|string%(2) "-3" + string(2) "-3" [3]=> - %unicode|string%(2) "-4" + string(2) "-4" } } OCI_FETCHSTATEMENT_BY_COLUMN|OCI_ASSOC int(4) array(2) { - [%u|b%"ID"]=> + ["ID"]=> array(4) { [0]=> - %unicode|string%(1) "1" + string(1) "1" [1]=> - %unicode|string%(1) "2" + string(1) "2" [2]=> - %unicode|string%(1) "3" + string(1) "3" [3]=> - %unicode|string%(1) "4" + string(1) "4" } - [%u|b%"VALUE"]=> + ["VALUE"]=> array(4) { [0]=> - %unicode|string%(2) "-1" + string(2) "-1" [1]=> - %unicode|string%(2) "-2" + string(2) "-2" [2]=> - %unicode|string%(2) "-3" + string(2) "-3" [3]=> - %unicode|string%(2) "-4" + string(2) "-4" } } OCI_FETCHSTATEMENT_BY_COLUMN|OCI_NUM @@ -236,24 +236,24 @@ array(2) { [0]=> array(4) { [0]=> - %unicode|string%(1) "1" + string(1) "1" [1]=> - %unicode|string%(1) "2" + string(1) "2" [2]=> - %unicode|string%(1) "3" + string(1) "3" [3]=> - %unicode|string%(1) "4" + string(1) "4" } [1]=> array(4) { [0]=> - %unicode|string%(2) "-1" + string(2) "-1" [1]=> - %unicode|string%(2) "-2" + string(2) "-2" [2]=> - %unicode|string%(2) "-3" + string(2) "-3" [3]=> - %unicode|string%(2) "-4" + string(2) "-4" } } OCI_FETCHSTATEMENT_BY_COLUMN|OCI_NUM|OCI_ASSOC @@ -262,24 +262,24 @@ array(2) { [0]=> array(4) { [0]=> - %unicode|string%(1) "1" + string(1) "1" [1]=> - %unicode|string%(1) "2" + string(1) "2" [2]=> - %unicode|string%(1) "3" + string(1) "3" [3]=> - %unicode|string%(1) "4" + string(1) "4" } [1]=> array(4) { [0]=> - %unicode|string%(2) "-1" + string(2) "-1" [1]=> - %unicode|string%(2) "-2" + string(2) "-2" [2]=> - %unicode|string%(2) "-3" + string(2) "-3" [3]=> - %unicode|string%(2) "-4" + string(2) "-4" } } OCI_FETCHSTATEMENT_BY_ROW @@ -287,31 +287,31 @@ int(4) array(4) { [0]=> array(2) { - [%u|b%"ID"]=> - %unicode|string%(1) "1" - [%u|b%"VALUE"]=> - %unicode|string%(2) "-1" + ["ID"]=> + string(1) "1" + ["VALUE"]=> + string(2) "-1" } [1]=> array(2) { - [%u|b%"ID"]=> - %unicode|string%(1) "2" - [%u|b%"VALUE"]=> - %unicode|string%(2) "-2" + ["ID"]=> + string(1) "2" + ["VALUE"]=> + string(2) "-2" } [2]=> array(2) { - [%u|b%"ID"]=> - %unicode|string%(1) "3" - [%u|b%"VALUE"]=> - %unicode|string%(2) "-3" + ["ID"]=> + string(1) "3" + ["VALUE"]=> + string(2) "-3" } [3]=> array(2) { - [%u|b%"ID"]=> - %unicode|string%(1) "4" - [%u|b%"VALUE"]=> - %unicode|string%(2) "-4" + ["ID"]=> + string(1) "4" + ["VALUE"]=> + string(2) "-4" } } OCI_FETCHSTATEMENT_BY_ROW|OCI_ASSOC @@ -319,31 +319,31 @@ int(4) array(4) { [0]=> array(2) { - [%u|b%"ID"]=> - %unicode|string%(1) "1" - [%u|b%"VALUE"]=> - %unicode|string%(2) "-1" + ["ID"]=> + string(1) "1" + ["VALUE"]=> + string(2) "-1" } [1]=> array(2) { - [%u|b%"ID"]=> - %unicode|string%(1) "2" - [%u|b%"VALUE"]=> - %unicode|string%(2) "-2" + ["ID"]=> + string(1) "2" + ["VALUE"]=> + string(2) "-2" } [2]=> array(2) { - [%u|b%"ID"]=> - %unicode|string%(1) "3" - [%u|b%"VALUE"]=> - %unicode|string%(2) "-3" + ["ID"]=> + string(1) "3" + ["VALUE"]=> + string(2) "-3" } [3]=> array(2) { - [%u|b%"ID"]=> - %unicode|string%(1) "4" - [%u|b%"VALUE"]=> - %unicode|string%(2) "-4" + ["ID"]=> + string(1) "4" + ["VALUE"]=> + string(2) "-4" } } OCI_FETCHSTATEMENT_BY_ROW|OCI_FETCHSTATEMENT_BY_COLUMN @@ -351,31 +351,31 @@ int(4) array(4) { [0]=> array(2) { - [%u|b%"ID"]=> - %unicode|string%(1) "1" - [%u|b%"VALUE"]=> - %unicode|string%(2) "-1" + ["ID"]=> + string(1) "1" + ["VALUE"]=> + string(2) "-1" } [1]=> array(2) { - [%u|b%"ID"]=> - %unicode|string%(1) "2" - [%u|b%"VALUE"]=> - %unicode|string%(2) "-2" + ["ID"]=> + string(1) "2" + ["VALUE"]=> + string(2) "-2" } [2]=> array(2) { - [%u|b%"ID"]=> - %unicode|string%(1) "3" - [%u|b%"VALUE"]=> - %unicode|string%(2) "-3" + ["ID"]=> + string(1) "3" + ["VALUE"]=> + string(2) "-3" } [3]=> array(2) { - [%u|b%"ID"]=> - %unicode|string%(1) "4" - [%u|b%"VALUE"]=> - %unicode|string%(2) "-4" + ["ID"]=> + string(1) "4" + ["VALUE"]=> + string(2) "-4" } } OCI_FETCHSTATEMENT_BY_ROW|OCI_FETCHSTATEMENT_BY_COLUMN|OCI_ASSOC @@ -383,31 +383,31 @@ int(4) array(4) { [0]=> array(2) { - [%u|b%"ID"]=> - %unicode|string%(1) "1" - [%u|b%"VALUE"]=> - %unicode|string%(2) "-1" + ["ID"]=> + string(1) "1" + ["VALUE"]=> + string(2) "-1" } [1]=> array(2) { - [%u|b%"ID"]=> - %unicode|string%(1) "2" - [%u|b%"VALUE"]=> - %unicode|string%(2) "-2" + ["ID"]=> + string(1) "2" + ["VALUE"]=> + string(2) "-2" } [2]=> array(2) { - [%u|b%"ID"]=> - %unicode|string%(1) "3" - [%u|b%"VALUE"]=> - %unicode|string%(2) "-3" + ["ID"]=> + string(1) "3" + ["VALUE"]=> + string(2) "-3" } [3]=> array(2) { - [%u|b%"ID"]=> - %unicode|string%(1) "4" - [%u|b%"VALUE"]=> - %unicode|string%(2) "-4" + ["ID"]=> + string(1) "4" + ["VALUE"]=> + string(2) "-4" } } OCI_FETCHSTATEMENT_BY_ROW|OCI_FETCHSTATEMENT_BY_COLUMN|OCI_NUM @@ -416,30 +416,30 @@ array(4) { [0]=> array(2) { [0]=> - %unicode|string%(1) "1" + string(1) "1" [1]=> - %unicode|string%(2) "-1" + string(2) "-1" } [1]=> array(2) { [0]=> - %unicode|string%(1) "2" + string(1) "2" [1]=> - %unicode|string%(2) "-2" + string(2) "-2" } [2]=> array(2) { [0]=> - %unicode|string%(1) "3" + string(1) "3" [1]=> - %unicode|string%(2) "-3" + string(2) "-3" } [3]=> array(2) { [0]=> - %unicode|string%(1) "4" + string(1) "4" [1]=> - %unicode|string%(2) "-4" + string(2) "-4" } } OCI_FETCHSTATEMENT_BY_ROW|OCI_FETCHSTATEMENT_BY_COLUMN|OCI_NUM|OCI_ASSOC @@ -448,30 +448,30 @@ array(4) { [0]=> array(2) { [0]=> - %unicode|string%(1) "1" + string(1) "1" [1]=> - %unicode|string%(2) "-1" + string(2) "-1" } [1]=> array(2) { [0]=> - %unicode|string%(1) "2" + string(1) "2" [1]=> - %unicode|string%(2) "-2" + string(2) "-2" } [2]=> array(2) { [0]=> - %unicode|string%(1) "3" + string(1) "3" [1]=> - %unicode|string%(2) "-3" + string(2) "-3" } [3]=> array(2) { [0]=> - %unicode|string%(1) "4" + string(1) "4" [1]=> - %unicode|string%(2) "-4" + string(2) "-4" } } OCI_FETCHSTATEMENT_BY_ROW|OCI_NUM @@ -480,30 +480,30 @@ array(4) { [0]=> array(2) { [0]=> - %unicode|string%(1) "1" + string(1) "1" [1]=> - %unicode|string%(2) "-1" + string(2) "-1" } [1]=> array(2) { [0]=> - %unicode|string%(1) "2" + string(1) "2" [1]=> - %unicode|string%(2) "-2" + string(2) "-2" } [2]=> array(2) { [0]=> - %unicode|string%(1) "3" + string(1) "3" [1]=> - %unicode|string%(2) "-3" + string(2) "-3" } [3]=> array(2) { [0]=> - %unicode|string%(1) "4" + string(1) "4" [1]=> - %unicode|string%(2) "-4" + string(2) "-4" } } OCI_FETCHSTATEMENT_BY_ROW|OCI_NUM|OCI_ASSOC @@ -512,30 +512,30 @@ array(4) { [0]=> array(2) { [0]=> - %unicode|string%(1) "1" + string(1) "1" [1]=> - %unicode|string%(2) "-1" + string(2) "-1" } [1]=> array(2) { [0]=> - %unicode|string%(1) "2" + string(1) "2" [1]=> - %unicode|string%(2) "-2" + string(2) "-2" } [2]=> array(2) { [0]=> - %unicode|string%(1) "3" + string(1) "3" [1]=> - %unicode|string%(2) "-3" + string(2) "-3" } [3]=> array(2) { [0]=> - %unicode|string%(1) "4" + string(1) "4" [1]=> - %unicode|string%(2) "-4" + string(2) "-4" } } OCI_NUM @@ -544,24 +544,24 @@ array(2) { [0]=> array(4) { [0]=> - %unicode|string%(1) "1" + string(1) "1" [1]=> - %unicode|string%(1) "2" + string(1) "2" [2]=> - %unicode|string%(1) "3" + string(1) "3" [3]=> - %unicode|string%(1) "4" + string(1) "4" } [1]=> array(4) { [0]=> - %unicode|string%(2) "-1" + string(2) "-1" [1]=> - %unicode|string%(2) "-2" + string(2) "-2" [2]=> - %unicode|string%(2) "-3" + string(2) "-3" [3]=> - %unicode|string%(2) "-4" + string(2) "-4" } } OCI_NUM|OCI_ASSOC @@ -570,24 +570,24 @@ array(2) { [0]=> array(4) { [0]=> - %unicode|string%(1) "1" + string(1) "1" [1]=> - %unicode|string%(1) "2" + string(1) "2" [2]=> - %unicode|string%(1) "3" + string(1) "3" [3]=> - %unicode|string%(1) "4" + string(1) "4" } [1]=> array(4) { [0]=> - %unicode|string%(2) "-1" + string(2) "-1" [1]=> - %unicode|string%(2) "-2" + string(2) "-2" [2]=> - %unicode|string%(2) "-3" + string(2) "-3" [3]=> - %unicode|string%(2) "-4" + string(2) "-4" } } Done diff --git a/ext/oci8/tests/fetch_all4.phpt b/ext/oci8/tests/fetch_all4.phpt index 1d3c9677e..1d4a8df7b 100644 --- a/ext/oci8/tests/fetch_all4.phpt +++ b/ext/oci8/tests/fetch_all4.phpt @@ -51,10 +51,10 @@ oci8_test_sql_execute($c, $stmtarray); Test 1 int(0) array(2) { - [%u|b%"MYCOL1"]=> + ["MYCOL1"]=> array(0) { } - [%u|b%"MYCOL2"]=> + ["MYCOL2"]=> array(0) { } } diff --git a/ext/oci8/tests/fetch_all5.phpt b/ext/oci8/tests/fetch_all5.phpt index a6bb3c3f1..d82fd30e4 100644 --- a/ext/oci8/tests/fetch_all5.phpt +++ b/ext/oci8/tests/fetch_all5.phpt @@ -62,45 +62,45 @@ oci_close($c); Test 1 int(3) array(2) { - [%u|b%"MYCOL1"]=> + ["MYCOL1"]=> array(3) { [0]=> - %unicode|string%(1) "1" + string(1) "1" [1]=> - %unicode|string%(1) "2" + string(1) "2" [2]=> - %unicode|string%(1) "3" + string(1) "3" } - [%u|b%"MYCOL2"]=> + ["MYCOL2"]=> array(3) { [0]=> - %unicode|string%(3) "abc" + string(3) "abc" [1]=> - %unicode|string%(3) "def" + string(3) "def" [2]=> - %unicode|string%(3) "ghi" + string(3) "ghi" } } Test 1 int(3) array(2) { - [%u|b%"MYCOL1"]=> + ["MYCOL1"]=> array(3) { [0]=> - %unicode|string%(1) "1" + string(1) "1" [1]=> - %unicode|string%(1) "2" + string(1) "2" [2]=> - %unicode|string%(1) "3" + string(1) "3" } - [%u|b%"MYCOL2"]=> + ["MYCOL2"]=> array(3) { [0]=> - %unicode|string%(3) "abc" + string(3) "abc" [1]=> - %unicode|string%(3) "def" + string(3) "def" [2]=> - %unicode|string%(3) "ghi" + string(3) "ghi" } } Test 3 diff --git a/ext/oci8/tests/fetch_into.phpt b/ext/oci8/tests/fetch_into.phpt index 45a6a8132..d90c4d95d 100644 --- a/ext/oci8/tests/fetch_into.phpt +++ b/ext/oci8/tests/fetch_into.phpt @@ -53,19 +53,19 @@ echo "Done\n"; int(2) array(2) { [0]=> - %unicode|string%(1) "1" + string(1) "1" [1]=> - %unicode|string%(1) "1" + string(1) "1" } int(2) array(4) { [0]=> - %unicode|string%(1) "1" - [%u|b%"ID"]=> - %unicode|string%(1) "1" + string(1) "1" + ["ID"]=> + string(1) "1" [1]=> - %unicode|string%(1) "1" - [%u|b%"VALUE"]=> - %unicode|string%(1) "1" + string(1) "1" + ["VALUE"]=> + string(1) "1" } Done diff --git a/ext/oci8/tests/fetch_object.phpt b/ext/oci8/tests/fetch_object.phpt index 1c290d5e9..73711baa1 100644 --- a/ext/oci8/tests/fetch_object.phpt +++ b/ext/oci8/tests/fetch_object.phpt @@ -82,28 +82,28 @@ oci8_test_sql_execute($c, $stmtarray); --EXPECTF-- Test 1 object(stdClass)#1 (3) { - [%u|b%"caseSensitive"]=> - %unicode|string%(3) "123" - [%u|b%"SECONDCOL"]=> - %unicode|string%(19) "1st row col2 string" - [%u|b%"ANOTHERCOL"]=> - %unicode|string%(15) "1 more text " + ["caseSensitive"]=> + string(3) "123" + ["SECONDCOL"]=> + string(19) "1st row col2 string" + ["ANOTHERCOL"]=> + string(15) "1 more text " } object(stdClass)#2 (3) { - [%u|b%"caseSensitive"]=> - %unicode|string%(3) "456" - [%u|b%"SECONDCOL"]=> - %unicode|string%(19) "2nd row col2 string" - [%u|b%"ANOTHERCOL"]=> - %unicode|string%(15) "2 more text " + ["caseSensitive"]=> + string(3) "456" + ["SECONDCOL"]=> + string(19) "2nd row col2 string" + ["ANOTHERCOL"]=> + string(15) "2 more text " } object(stdClass)#1 (3) { - [%u|b%"caseSensitive"]=> - %unicode|string%(3) "789" - [%u|b%"SECONDCOL"]=> - %unicode|string%(19) "3rd row col2 string" - [%u|b%"ANOTHERCOL"]=> - %unicode|string%(15) "3 more text " + ["caseSensitive"]=> + string(3) "789" + ["SECONDCOL"]=> + string(19) "3rd row col2 string" + ["ANOTHERCOL"]=> + string(15) "3 more text " } Test 2 123 diff --git a/ext/oci8/tests/fetch_row.phpt b/ext/oci8/tests/fetch_row.phpt index 2b28634ab..40bc4f893 100644 --- a/ext/oci8/tests/fetch_row.phpt +++ b/ext/oci8/tests/fetch_row.phpt @@ -46,20 +46,20 @@ echo "Done\n"; --EXPECTF-- array(2) { [0]=> - %unicode|string%(1) "1" + string(1) "1" [1]=> - %unicode|string%(1) "1" + string(1) "1" } array(2) { [0]=> - %unicode|string%(1) "1" + string(1) "1" [1]=> - %unicode|string%(1) "1" + string(1) "1" } array(2) { [0]=> - %unicode|string%(1) "1" + string(1) "1" [1]=> - %unicode|string%(1) "1" + string(1) "1" } Done diff --git a/ext/oci8/tests/field_funcs1.phpt b/ext/oci8/tests/field_funcs1.phpt index c14ee8957..41d8627ce 100644 --- a/ext/oci8/tests/field_funcs1.phpt +++ b/ext/oci8/tests/field_funcs1.phpt @@ -85,9 +85,9 @@ echo "Done\n"; --EXPECTF-- array(2) { [0]=> - %unicode|string%(1) "1" + string(1) "1" [1]=> - %unicode|string%(1) "1" + string(1) "1" } Test 1 diff --git a/ext/oci8/tests/function_aliases.phpt b/ext/oci8/tests/function_aliases.phpt index 4c6ce8375..2c890d640 100644 --- a/ext/oci8/tests/function_aliases.phpt +++ b/ext/oci8/tests/function_aliases.phpt @@ -104,8 +104,6 @@ NULL Warning: ocifreestatement() expects exactly 1 parameter, 0 given in %s on line %d NULL - -Warning: ociinternaldebug() expects exactly 1 parameter, 0 given in %s on line %d NULL Warning: ocinumcols() expects exactly 1 parameter, 0 given in %s on line %d diff --git a/ext/oci8/tests/imp_res_1.phpt b/ext/oci8/tests/imp_res_1.phpt new file mode 100644 index 000000000..a36f89f4d --- /dev/null +++ b/ext/oci8/tests/imp_res_1.phpt @@ -0,0 +1,630 @@ +--TEST-- +Oracle Database 12c Implicit Result Sets: basic test +--SKIPIF-- +<?php +if (!extension_loaded('oci8')) die ("skip no oci8 extension"); +$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); +if (!(isset($matches[0]) && $matches[1] >= 12)) { + die("skip expected output only valid when using Oracle Database 12c or greater"); +} +preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); +if (!(isset($matches[0]) && $matches[0] >= 12)) { + die("skip works only with Oracle 12c or greater version of Oracle client libraries"); +} +?> +--FILE-- +<?php + +require(dirname(__FILE__).'/connect.inc'); + +// Initialization + +$stmtarray = array( + "drop table imp_res_1_tab_1", + "create table imp_res_1_tab_1 (c1 number, c2 varchar2(10))", + "insert into imp_res_1_tab_1 values (1, 'abcde')", + "insert into imp_res_1_tab_1 values (2, 'fghij')", + "insert into imp_res_1_tab_1 values (3, 'klmno')", + + "drop table imp_res_1_tab_2", + "create table imp_res_1_tab_2 (c3 varchar2(1))", + "insert into imp_res_1_tab_2 values ('t')", + "insert into imp_res_1_tab_2 values ('u')", + "insert into imp_res_1_tab_2 values ('v')", + + "create or replace procedure imp_res_1_proc as + c1 sys_refcursor; + begin + open c1 for select * from imp_res_1_tab_1 order by 1; + dbms_sql.return_result(c1); + + open c1 for select * from imp_res_1_tab_2 where rownum < 3 order by 1; + dbms_sql.return_result(c1); + + open c1 for select 99 from dual; + dbms_sql.return_result (c1); + + open c1 for select NULL, 'Z' from dual; + dbms_sql.return_result (c1); + + open c1 for select * from imp_res_1_tab_1 order by 1; + dbms_sql.return_result(c1); + end;" +); + +oci8_test_sql_execute($c, $stmtarray); + +// Run Test + +echo "Test 1 - oci_fetch_assoc\n"; +$s = oci_parse($c, "begin imp_res_1_proc(); end;"); +oci_execute($s); +while (($row = oci_fetch_assoc($s)) != false) + var_dump($row); + +echo "\nTest 2 - oci_fetch_object\n"; +$s = oci_parse($c, "begin imp_res_1_proc(); end;"); +oci_execute($s); +while (($row = oci_fetch_object($s)) != false) + var_dump($row); + +echo "\nTest 3 - oci_fetch_row\n"; +$s = oci_parse($c, "begin imp_res_1_proc(); end;"); +oci_execute($s); +while (($row = oci_fetch_row($s)) != false) + var_dump($row); + +echo "\nTest 4 - oci_fetch_array(OCI_ASSOC+OCI_RETURN_NULLS)\n"; +$s = oci_parse($c, "begin imp_res_1_proc(); end;"); +oci_execute($s); +while (($row = oci_fetch_array($s, OCI_ASSOC+OCI_RETURN_NULLS)) != false) + var_dump($row); + +echo "\nTest 5 - oci_fetch_array(OCI_ASSOC)\n"; +$s = oci_parse($c, "begin imp_res_1_proc(); end;"); +oci_execute($s); +while (($row = oci_fetch_array($s, OCI_ASSOC)) != false) + var_dump($row); + +echo "\nTest 6 - oci_fetch_array(OCI_NUM)\n"; +$s = oci_parse($c, "begin imp_res_1_proc(); end;"); +oci_execute($s); +while (($row = oci_fetch_array($s, OCI_NUM)) != false) + var_dump($row); + +echo "\nTest 7 - oci_fetch_array(OCI_BOTH)\n"; +$s = oci_parse($c, "begin imp_res_1_proc(); end;"); +oci_execute($s); +while (($row = oci_fetch_array($s, OCI_BOTH)) != false) + var_dump($row); + +echo "\nTest 8 - oci_fetch_array(OCI_BOTH+OCI_RETURN_NULLS)\n"; +$s = oci_parse($c, "begin imp_res_1_proc(); end;"); +oci_execute($s); +while (($row = oci_fetch_array($s, OCI_BOTH+OCI_RETURN_NULLS)) != false) + var_dump($row); + +// Clean up + +$stmtarray = array( + "drop procedure imp_res_1_proc", + "drop table imp_res_1_tab_1", + "drop table imp_res_1_tab_2" +); + +oci8_test_sql_execute($c, $stmtarray); + +?> +===DONE=== +<?php exit(0); ?> +--EXPECTF-- +Test 1 - oci_fetch_assoc +array(2) { + ["C1"]=> + string(1) "1" + ["C2"]=> + string(5) "abcde" +} +array(2) { + ["C1"]=> + string(1) "2" + ["C2"]=> + string(5) "fghij" +} +array(2) { + ["C1"]=> + string(1) "3" + ["C2"]=> + string(5) "klmno" +} +array(1) { + ["C3"]=> + string(1) "t" +} +array(1) { + ["C3"]=> + string(1) "u" +} +array(1) { + [99]=> + string(2) "99" +} +array(2) { + ["NULL"]=> + NULL + ["'Z'"]=> + string(1) "Z" +} +array(2) { + ["C1"]=> + string(1) "1" + ["C2"]=> + string(5) "abcde" +} +array(2) { + ["C1"]=> + string(1) "2" + ["C2"]=> + string(5) "fghij" +} +array(2) { + ["C1"]=> + string(1) "3" + ["C2"]=> + string(5) "klmno" +} + +Test 2 - oci_fetch_object +object(stdClass)#%d (2) { + ["C1"]=> + string(1) "1" + ["C2"]=> + string(5) "abcde" +} +object(stdClass)#%d (2) { + ["C1"]=> + string(1) "2" + ["C2"]=> + string(5) "fghij" +} +object(stdClass)#%d (2) { + ["C1"]=> + string(1) "3" + ["C2"]=> + string(5) "klmno" +} +object(stdClass)#%d (1) { + ["C3"]=> + string(1) "t" +} +object(stdClass)#%d (1) { + ["C3"]=> + string(1) "u" +} +object(stdClass)#%d (1) { + [99]=> + string(2) "99" +} +object(stdClass)#%d (2) { + ["NULL"]=> + NULL + ["'Z'"]=> + string(1) "Z" +} +object(stdClass)#%d (2) { + ["C1"]=> + string(1) "1" + ["C2"]=> + string(5) "abcde" +} +object(stdClass)#%d (2) { + ["C1"]=> + string(1) "2" + ["C2"]=> + string(5) "fghij" +} +object(stdClass)#%d (2) { + ["C1"]=> + string(1) "3" + ["C2"]=> + string(5) "klmno" +} + +Test 3 - oci_fetch_row +array(2) { + [0]=> + string(1) "1" + [1]=> + string(5) "abcde" +} +array(2) { + [0]=> + string(1) "2" + [1]=> + string(5) "fghij" +} +array(2) { + [0]=> + string(1) "3" + [1]=> + string(5) "klmno" +} +array(1) { + [0]=> + string(1) "t" +} +array(1) { + [0]=> + string(1) "u" +} +array(1) { + [0]=> + string(2) "99" +} +array(2) { + [0]=> + NULL + [1]=> + string(1) "Z" +} +array(2) { + [0]=> + string(1) "1" + [1]=> + string(5) "abcde" +} +array(2) { + [0]=> + string(1) "2" + [1]=> + string(5) "fghij" +} +array(2) { + [0]=> + string(1) "3" + [1]=> + string(5) "klmno" +} + +Test 4 - oci_fetch_array(OCI_ASSOC+OCI_RETURN_NULLS) +array(2) { + ["C1"]=> + string(1) "1" + ["C2"]=> + string(5) "abcde" +} +array(2) { + ["C1"]=> + string(1) "2" + ["C2"]=> + string(5) "fghij" +} +array(2) { + ["C1"]=> + string(1) "3" + ["C2"]=> + string(5) "klmno" +} +array(1) { + ["C3"]=> + string(1) "t" +} +array(1) { + ["C3"]=> + string(1) "u" +} +array(1) { + [99]=> + string(2) "99" +} +array(2) { + ["NULL"]=> + NULL + ["'Z'"]=> + string(1) "Z" +} +array(2) { + ["C1"]=> + string(1) "1" + ["C2"]=> + string(5) "abcde" +} +array(2) { + ["C1"]=> + string(1) "2" + ["C2"]=> + string(5) "fghij" +} +array(2) { + ["C1"]=> + string(1) "3" + ["C2"]=> + string(5) "klmno" +} + +Test 5 - oci_fetch_array(OCI_ASSOC) +array(2) { + ["C1"]=> + string(1) "1" + ["C2"]=> + string(5) "abcde" +} +array(2) { + ["C1"]=> + string(1) "2" + ["C2"]=> + string(5) "fghij" +} +array(2) { + ["C1"]=> + string(1) "3" + ["C2"]=> + string(5) "klmno" +} +array(1) { + ["C3"]=> + string(1) "t" +} +array(1) { + ["C3"]=> + string(1) "u" +} +array(1) { + [99]=> + string(2) "99" +} +array(1) { + ["'Z'"]=> + string(1) "Z" +} +array(2) { + ["C1"]=> + string(1) "1" + ["C2"]=> + string(5) "abcde" +} +array(2) { + ["C1"]=> + string(1) "2" + ["C2"]=> + string(5) "fghij" +} +array(2) { + ["C1"]=> + string(1) "3" + ["C2"]=> + string(5) "klmno" +} + +Test 6 - oci_fetch_array(OCI_NUM) +array(2) { + [0]=> + string(1) "1" + [1]=> + string(5) "abcde" +} +array(2) { + [0]=> + string(1) "2" + [1]=> + string(5) "fghij" +} +array(2) { + [0]=> + string(1) "3" + [1]=> + string(5) "klmno" +} +array(1) { + [0]=> + string(1) "t" +} +array(1) { + [0]=> + string(1) "u" +} +array(1) { + [0]=> + string(2) "99" +} +array(1) { + [1]=> + string(1) "Z" +} +array(2) { + [0]=> + string(1) "1" + [1]=> + string(5) "abcde" +} +array(2) { + [0]=> + string(1) "2" + [1]=> + string(5) "fghij" +} +array(2) { + [0]=> + string(1) "3" + [1]=> + string(5) "klmno" +} + +Test 7 - oci_fetch_array(OCI_BOTH) +array(4) { + [0]=> + string(1) "1" + ["C1"]=> + string(1) "1" + [1]=> + string(5) "abcde" + ["C2"]=> + string(5) "abcde" +} +array(4) { + [0]=> + string(1) "2" + ["C1"]=> + string(1) "2" + [1]=> + string(5) "fghij" + ["C2"]=> + string(5) "fghij" +} +array(4) { + [0]=> + string(1) "3" + ["C1"]=> + string(1) "3" + [1]=> + string(5) "klmno" + ["C2"]=> + string(5) "klmno" +} +array(2) { + [0]=> + string(1) "t" + ["C3"]=> + string(1) "t" +} +array(2) { + [0]=> + string(1) "u" + ["C3"]=> + string(1) "u" +} +array(2) { + [0]=> + string(2) "99" + [99]=> + string(2) "99" +} +array(2) { + [1]=> + string(1) "Z" + ["'Z'"]=> + string(1) "Z" +} +array(4) { + [0]=> + string(1) "1" + ["C1"]=> + string(1) "1" + [1]=> + string(5) "abcde" + ["C2"]=> + string(5) "abcde" +} +array(4) { + [0]=> + string(1) "2" + ["C1"]=> + string(1) "2" + [1]=> + string(5) "fghij" + ["C2"]=> + string(5) "fghij" +} +array(4) { + [0]=> + string(1) "3" + ["C1"]=> + string(1) "3" + [1]=> + string(5) "klmno" + ["C2"]=> + string(5) "klmno" +} + +Test 8 - oci_fetch_array(OCI_BOTH+OCI_RETURN_NULLS) +array(4) { + [0]=> + string(1) "1" + ["C1"]=> + string(1) "1" + [1]=> + string(5) "abcde" + ["C2"]=> + string(5) "abcde" +} +array(4) { + [0]=> + string(1) "2" + ["C1"]=> + string(1) "2" + [1]=> + string(5) "fghij" + ["C2"]=> + string(5) "fghij" +} +array(4) { + [0]=> + string(1) "3" + ["C1"]=> + string(1) "3" + [1]=> + string(5) "klmno" + ["C2"]=> + string(5) "klmno" +} +array(2) { + [0]=> + string(1) "t" + ["C3"]=> + string(1) "t" +} +array(2) { + [0]=> + string(1) "u" + ["C3"]=> + string(1) "u" +} +array(2) { + [0]=> + string(2) "99" + [99]=> + string(2) "99" +} +array(4) { + [0]=> + NULL + ["NULL"]=> + NULL + [1]=> + string(1) "Z" + ["'Z'"]=> + string(1) "Z" +} +array(4) { + [0]=> + string(1) "1" + ["C1"]=> + string(1) "1" + [1]=> + string(5) "abcde" + ["C2"]=> + string(5) "abcde" +} +array(4) { + [0]=> + string(1) "2" + ["C1"]=> + string(1) "2" + [1]=> + string(5) "fghij" + ["C2"]=> + string(5) "fghij" +} +array(4) { + [0]=> + string(1) "3" + ["C1"]=> + string(1) "3" + [1]=> + string(5) "klmno" + ["C2"]=> + string(5) "klmno" +} +===DONE=== diff --git a/ext/oci8/tests/imp_res_2.phpt b/ext/oci8/tests/imp_res_2.phpt new file mode 100644 index 000000000..860a5fbb3 --- /dev/null +++ b/ext/oci8/tests/imp_res_2.phpt @@ -0,0 +1,99 @@ +--TEST-- +Oracle Database 12c Implicit Result Sets: Zero Rows +--SKIPIF-- +<?php +if (!extension_loaded('oci8')) die ("skip no oci8 extension"); +$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); +if (!(isset($matches[0]) && $matches[1] >= 12)) { + die("skip expected output only valid when using Oracle Database 12c or greater"); +} +preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); +if (!(isset($matches[0]) && $matches[0] >= 12)) { + die("skip works only with Oracle 12c or greater version of Oracle client libraries"); +} +?> +--FILE-- +<?php + +require(dirname(__FILE__).'/connect.inc'); + +// Initialization + +$stmtarray = array( + "create or replace procedure imp_res_2_proc_a as + c1 sys_refcursor; + begin + open c1 for select * from dual where 1 = 0; + dbms_sql.return_result(c1); + end;", + + "create or replace procedure imp_res_2_proc_b as + c1 sys_refcursor; + begin + open c1 for select * from dual; + dbms_sql.return_result(c1); + open c1 for select * from dual where 1 = 0; + dbms_sql.return_result(c1); + end;", + + "create or replace procedure imp_res_2_proc_c as + c1 sys_refcursor; + begin + open c1 for select * from dual where 1 = 0; + dbms_sql.return_result(c1); + open c1 for select * from dual; + dbms_sql.return_result(c1); + end;" + +); + +oci8_test_sql_execute($c, $stmtarray); + +// Run Test + +echo "Test 1\n"; +$s = oci_parse($c, "begin imp_res_2_proc_a(); end;"); +oci_execute($s); +while (($row = oci_fetch_row($s)) != false) + var_dump($row); + +echo "Test 2\n"; +$s = oci_parse($c, "begin imp_res_2_proc_b(); end;"); +oci_execute($s); +while (($row = oci_fetch_row($s)) != false) + var_dump($row); + +echo "Test 2\n"; +$s = oci_parse($c, "begin imp_res_2_proc_c(); end;"); +oci_execute($s); +while (($row = oci_fetch_row($s)) != false) + var_dump($row); + +// Clean up + +$stmtarray = array( + "drop procedure imp_res_2_proc_a", + "drop procedure imp_res_2_proc_b", + "drop procedure imp_res_2_proc_c" +); + +oci8_test_sql_execute($c, $stmtarray); + +?> +===DONE=== +<?php exit(0); ?> +--EXPECTF-- +Test 1 +Test 2 +array(1) { + [0]=> + string(1) "X" +} +Test 2 +array(1) { + [0]=> + string(1) "X" +} +===DONE=== diff --git a/ext/oci8/tests/imp_res_3.phpt b/ext/oci8/tests/imp_res_3.phpt new file mode 100644 index 000000000..0fc481589 --- /dev/null +++ b/ext/oci8/tests/imp_res_3.phpt @@ -0,0 +1,1257 @@ +--TEST-- +Oracle Database 12c Implicit Result Sets: bigger data size +--SKIPIF-- +<?php +if (!extension_loaded('oci8')) die ("skip no oci8 extension"); +$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); +if (!(isset($matches[0]) && $matches[1] >= 12)) { + die("skip expected output only valid when using Oracle Database 12c or greater"); +} +preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); +if (!(isset($matches[0]) && $matches[0] >= 12)) { + die("skip works only with Oracle 12c or greater version of Oracle client libraries"); +} +?> +--FILE-- +<?php + +require(dirname(__FILE__).'/connect.inc'); + +// Initialization + +$stmtarray = array( + "drop table imp_res_3_tab_1", + "create table imp_res_3_tab_1 (c1 number, c2 varchar2(10))", + "insert into imp_res_3_tab_1 values (1, 'a')", + "insert into imp_res_3_tab_1 values (2, 'f')", + + "drop table imp_res_3_tab_2", + "create table imp_res_3_tab_2 (c3 varchar2(1))", + "insert into imp_res_3_tab_2 values ('t')", + "insert into imp_res_3_tab_2 values ('u')", + "insert into imp_res_3_tab_2 values ('v')", + "insert into imp_res_3_tab_2 values ('w')", + + "create or replace procedure imp_res_3_proc as + c1 sys_refcursor; + i pls_integer; + begin + for i in 1..30 loop -- if this value is too big for Oracle's open_cursors, calling imp_res_3_proc() can fail with ORA-1000 + open c1 for select t1.*, t2.*, t3.*, t4.*, t5.* + from imp_res_3_tab_1 t1, imp_res_3_tab_1 t2, imp_res_3_tab_1 t3, + imp_res_3_tab_1 t4, imp_res_3_tab_1 t5 order by 1,3,5,7,9,2,4,6,8,10; + dbms_sql.return_result(c1); + open c1 for select c2 from imp_res_3_tab_1 order by 1; + dbms_sql.return_result(c1); + open c1 for select * from imp_res_3_tab_2 order by 1; + dbms_sql.return_result(c1); + open c1 for select * from dual; + dbms_sql.return_result (c1); + end loop; + end;" +); + +oci8_test_sql_execute($c, $stmtarray); + +// Run Test + +echo "Test 1\n"; + +$s = oci_parse($c, "begin imp_res_3_proc(); end;"); +oci_execute($s); + +while (($row = oci_fetch_array($s, OCI_NUM+OCI_RETURN_NULLS)) != false) { + foreach ($row as $item) { + echo " ".$item; + } + echo "\n"; +} + +// Clean up + +$stmtarray = array( + "drop procedure imp_res_3_proc", + "drop table imp_res_3_tab_1", + "drop table imp_res_3_tab_2" +); + +oci8_test_sql_execute($c, $stmtarray); + +?> +===DONE=== +<?php exit(0); ?> +--EXPECTF-- +Test 1 + 1 a 1 a 1 a 1 a 1 a + 1 a 1 a 1 a 1 a 2 f + 1 a 1 a 1 a 2 f 1 a + 1 a 1 a 1 a 2 f 2 f + 1 a 1 a 2 f 1 a 1 a + 1 a 1 a 2 f 1 a 2 f + 1 a 1 a 2 f 2 f 1 a + 1 a 1 a 2 f 2 f 2 f + 1 a 2 f 1 a 1 a 1 a + 1 a 2 f 1 a 1 a 2 f + 1 a 2 f 1 a 2 f 1 a + 1 a 2 f 1 a 2 f 2 f + 1 a 2 f 2 f 1 a 1 a + 1 a 2 f 2 f 1 a 2 f + 1 a 2 f 2 f 2 f 1 a + 1 a 2 f 2 f 2 f 2 f + 2 f 1 a 1 a 1 a 1 a + 2 f 1 a 1 a 1 a 2 f + 2 f 1 a 1 a 2 f 1 a + 2 f 1 a 1 a 2 f 2 f + 2 f 1 a 2 f 1 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+ X + 1 a 1 a 1 a 1 a 1 a + 1 a 1 a 1 a 1 a 2 f + 1 a 1 a 1 a 2 f 1 a + 1 a 1 a 1 a 2 f 2 f + 1 a 1 a 2 f 1 a 1 a + 1 a 1 a 2 f 1 a 2 f + 1 a 1 a 2 f 2 f 1 a + 1 a 1 a 2 f 2 f 2 f + 1 a 2 f 1 a 1 a 1 a + 1 a 2 f 1 a 1 a 2 f + 1 a 2 f 1 a 2 f 1 a + 1 a 2 f 1 a 2 f 2 f + 1 a 2 f 2 f 1 a 1 a + 1 a 2 f 2 f 1 a 2 f + 1 a 2 f 2 f 2 f 1 a + 1 a 2 f 2 f 2 f 2 f + 2 f 1 a 1 a 1 a 1 a + 2 f 1 a 1 a 1 a 2 f + 2 f 1 a 1 a 2 f 1 a + 2 f 1 a 1 a 2 f 2 f + 2 f 1 a 2 f 1 a 1 a + 2 f 1 a 2 f 1 a 2 f + 2 f 1 a 2 f 2 f 1 a + 2 f 1 a 2 f 2 f 2 f + 2 f 2 f 1 a 1 a 1 a + 2 f 2 f 1 a 1 a 2 f + 2 f 2 f 1 a 2 f 1 a + 2 f 2 f 1 a 2 f 2 f + 2 f 2 f 2 f 1 a 1 a + 2 f 2 f 2 f 1 a 2 f + 2 f 2 f 2 f 2 f 1 a + 2 f 2 f 2 f 2 f 2 f + a + f + t + u + v + w + X +===DONE=== diff --git a/ext/oci8/tests/imp_res_4.phpt b/ext/oci8/tests/imp_res_4.phpt new file mode 100644 index 000000000..762ae7722 --- /dev/null +++ b/ext/oci8/tests/imp_res_4.phpt @@ -0,0 +1,82 @@ +--TEST-- +Oracle Database 12c Implicit Result Sets: oci_fetch +--SKIPIF-- +<?php +if (!extension_loaded('oci8')) die ("skip no oci8 extension"); +$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); +if (!(isset($matches[0]) && $matches[1] >= 12)) { + die("skip expected output only valid when using Oracle Database 12c or greater"); +} +preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); +if (!(isset($matches[0]) && $matches[0] >= 12)) { + die("skip works only with Oracle 12c or greater version of Oracle client libraries"); +} +?> +--FILE-- +<?php + +require(dirname(__FILE__).'/connect.inc'); + +// Initialization + +$stmtarray = array( + "create or replace procedure imp_res_4_proc as + c1 sys_refcursor; + begin + open c1 for select 1 from dual union select 2 from dual; + dbms_sql.return_result (c1); + end;" +); + +oci8_test_sql_execute($c, $stmtarray); + +// Run Test + +echo "Test 1\n"; +$s = oci_parse($c, "begin imp_res_4_proc(); end;"); +oci_execute($s); +oci_fetch($s); // This will fail with ORA-24374 +var_dump(oci_result($s, 1)); + +echo "\nTest 2\n"; +$s = oci_parse($c, "begin imp_res_4_proc(); end;"); +oci_execute($s); +$r = oci_fetch_row($s); +var_dump($r); +oci_fetch($s); // This will fail with ORA-24374 +var_dump(oci_result($s, 1)); +$r = oci_fetch_row($s); +var_dump($r); + +// Clean up + +$stmtarray = array( + "drop procedure imp_res_4_proc", +); + +oci8_test_sql_execute($c, $stmtarray); + +?> +===DONE=== +<?php exit(0); ?> +--EXPECTF-- +Test 1 + +Warning: oci_fetch(): ORA-24374: %s in %simp_res_4.php on line %d +bool(false) + +Test 2 +array(1) { + [0]=> + string(1) "1" +} + +Warning: oci_fetch(): ORA-24374: %s in %simp_res_4.php on line %d +bool(false) +array(1) { + [0]=> + string(1) "2" +} +===DONE=== diff --git a/ext/oci8/tests/imp_res_5.phpt b/ext/oci8/tests/imp_res_5.phpt new file mode 100644 index 000000000..564a7a374 --- /dev/null +++ b/ext/oci8/tests/imp_res_5.phpt @@ -0,0 +1,84 @@ +--TEST-- +Oracle Database 12c Implicit Result Sets: oci_fetch_all +--SKIPIF-- +<?php +if (!extension_loaded('oci8')) die ("skip no oci8 extension"); +$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); +if (!(isset($matches[0]) && $matches[1] >= 12)) { + die("skip expected output only valid when using Oracle Database 12c or greater"); +} +preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); +if (!(isset($matches[0]) && $matches[0] >= 12)) { + die("skip works only with Oracle 12c or greater version of Oracle client libraries"); +} +?> +--FILE-- +<?php + +require(dirname(__FILE__).'/connect.inc'); + +// Initialization + +$stmtarray = array( + "create or replace procedure imp_res_5_proc as + c1 sys_refcursor; + begin + open c1 for select 1 from dual union select 2 from dual; + dbms_sql.return_result (c1); + end;" +); + +oci8_test_sql_execute($c, $stmtarray); + +// Run Test + +echo "Test 1\n"; +$s = oci_parse($c, "begin imp_res_5_proc(); end;"); +oci_execute($s); +oci_fetch_all($s,$res); // This will fail with ORA-24374 +var_dump($res); + +echo "\nTest 2\n"; +$s = oci_parse($c, "begin imp_res_5_proc(); end;"); +oci_execute($s); +$r = oci_fetch_row($s); +var_dump($r); +oci_fetch_all($s, $res); // This will fail with ORA-24374 +var_dump($res); +$r = oci_fetch_row($s); +var_dump($r); + +// Clean up + +$stmtarray = array( + "drop procedure imp_res_5_proc", +); + +oci8_test_sql_execute($c, $stmtarray); + +?> +===DONE=== +<?php exit(0); ?> +--EXPECTF-- +Test 1 + +Warning: oci_fetch_all(): ORA-24374: %s in %simp_res_5.php on line %d +array(0) { +} + +Test 2 +array(1) { + [0]=> + string(1) "1" +} + +Warning: oci_fetch_all(): ORA-24374: %s in %simp_res_5.php on line %d +array(0) { +} +array(1) { + [0]=> + string(1) "2" +} +===DONE=== diff --git a/ext/oci8/tests/imp_res_6.phpt b/ext/oci8/tests/imp_res_6.phpt new file mode 100644 index 000000000..f94efe70d --- /dev/null +++ b/ext/oci8/tests/imp_res_6.phpt @@ -0,0 +1,118 @@ +--TEST-- +Oracle Database 12c Implicit Result Sets: alternating oci_fetch_* calls +--SKIPIF-- +<?php +if (!extension_loaded('oci8')) die ("skip no oci8 extension"); +$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); +if (!(isset($matches[0]) && $matches[1] >= 12)) { + die("skip expected output only valid when using Oracle Database 12c or greater"); +} +preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); +if (!(isset($matches[0]) && $matches[0] >= 12)) { + die("skip works only with Oracle 12c or greater version of Oracle client libraries"); +} +?> +--FILE-- +<?php + +require(dirname(__FILE__).'/connect.inc'); + +// Initialization + +$stmtarray = array( + "drop table imp_res_6_tab", + "create table imp_res_6_tab (c1 number, c2 varchar2(10))", + "insert into imp_res_6_tab values (1, 'a')", + "insert into imp_res_6_tab values (2, 'b')", + "insert into imp_res_6_tab values (3, 'c')", + "insert into imp_res_6_tab values (4, 'd')", + "insert into imp_res_6_tab values (5, 'e')", + "insert into imp_res_6_tab values (6, 'f')", + + "create or replace procedure imp_res_6_proc as + c1 sys_refcursor; + begin + open c1 for select * from imp_res_6_tab order by 1; + dbms_sql.return_result(c1); + end;" +); + +oci8_test_sql_execute($c, $stmtarray); + +// Run Test + +echo "Test 1\n"; +$s = oci_parse($c, "begin imp_res_6_proc(); end;"); +oci_execute($s); + +$row = oci_fetch_assoc($s); +var_dump($row); +$row = oci_fetch_row($s); +var_dump($row); +$row = oci_fetch_object($s); +var_dump($row); +$row = oci_fetch_array($s); +var_dump($row); +$row = oci_fetch_array($s, OCI_NUM); +var_dump($row); +$row = oci_fetch_array($s, OCI_ASSOC); +var_dump($row); + + +// Clean up + +$stmtarray = array( + "drop procedure imp_res_6_proc", + "drop table imp_res_6_tab", +); + +oci8_test_sql_execute($c, $stmtarray); + +?> +===DONE=== +<?php exit(0); ?> +--EXPECTF-- +Test 1 +array(2) { + ["C1"]=> + string(1) "1" + ["C2"]=> + string(1) "a" +} +array(2) { + [0]=> + string(1) "2" + [1]=> + string(1) "b" +} +object(stdClass)#%d (2) { + ["C1"]=> + string(1) "3" + ["C2"]=> + string(1) "c" +} +array(4) { + [0]=> + string(1) "4" + ["C1"]=> + string(1) "4" + [1]=> + string(1) "d" + ["C2"]=> + string(1) "d" +} +array(2) { + [0]=> + string(1) "5" + [1]=> + string(1) "e" +} +array(2) { + ["C1"]=> + string(1) "6" + ["C2"]=> + string(1) "f" +} +===DONE=== diff --git a/ext/oci8/tests/imp_res_7.phpt b/ext/oci8/tests/imp_res_7.phpt new file mode 100644 index 000000000..05ae5e685 --- /dev/null +++ b/ext/oci8/tests/imp_res_7.phpt @@ -0,0 +1,873 @@ +--TEST-- +Oracle Database 12c Implicit Result Sets: bigger data size +--SKIPIF-- +<?php +if (!extension_loaded('oci8')) die ("skip no oci8 extension"); +$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); +if (!(isset($matches[0]) && $matches[1] >= 12)) { + die("skip expected output only valid when using Oracle Database 12c or greater"); +} +preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); +if (!(isset($matches[0]) && $matches[0] >= 12)) { + die("skip works only with Oracle 12c or greater version of Oracle client libraries"); +} +?> +--FILE-- +<?php + +require(dirname(__FILE__).'/connect.inc'); + +// Initialization + +$stmt = + "declare + c1 sys_refcursor; + begin + open c1 for select 1 from dual; + dbms_sql.return_result(c1); + open c1 for select 2 from dual; + dbms_sql.return_result(c1); + open c1 for select 3 from dual; + dbms_sql.return_result(c1); + open c1 for select 4 from dual; + dbms_sql.return_result(c1); + open c1 for select 5 from dual; + dbms_sql.return_result(c1); + open c1 for select 6 from dual; + dbms_sql.return_result(c1); + open c1 for select 7 from dual; + dbms_sql.return_result(c1); + open c1 for select 8 from dual; + dbms_sql.return_result(c1); + open c1 for select 9 from dual; + dbms_sql.return_result(c1); + open c1 for select 10 from dual; + dbms_sql.return_result(c1); + open c1 for select 11 from dual; + dbms_sql.return_result(c1); + open c1 for select 12 from dual; + dbms_sql.return_result(c1); + open c1 for select 13 from dual; + dbms_sql.return_result(c1); + open c1 for select 14 from dual; + dbms_sql.return_result(c1); + open c1 for select 15 from dual; + dbms_sql.return_result(c1); + open c1 for select 16 from dual; + dbms_sql.return_result(c1); + open c1 for select 17 from dual; + dbms_sql.return_result(c1); + open c1 for select 18 from dual; + dbms_sql.return_result(c1); + open c1 for select 19 from dual; + dbms_sql.return_result(c1); + open c1 for select 20 from dual; + dbms_sql.return_result(c1); + open c1 for select 21 from dual; + dbms_sql.return_result(c1); + open c1 for select 22 from dual; + dbms_sql.return_result(c1); + open c1 for select 23 from dual; + dbms_sql.return_result(c1); + open c1 for select 24 from dual; + dbms_sql.return_result(c1); + open c1 for select 25 from dual; + dbms_sql.return_result(c1); + open c1 for select 26 from dual; + dbms_sql.return_result(c1); + open c1 for select 27 from dual; + dbms_sql.return_result(c1); + open c1 for select 28 from dual; + dbms_sql.return_result(c1); + open c1 for select 29 from dual; + dbms_sql.return_result(c1); + open c1 for select 30 from dual; + dbms_sql.return_result(c1); + open c1 for select 31 from dual; + dbms_sql.return_result(c1); + open c1 for select 32 from dual; + dbms_sql.return_result(c1); + open c1 for select 33 from dual; + dbms_sql.return_result(c1); + open c1 for select 34 from dual; + dbms_sql.return_result(c1); + open c1 for select 35 from dual; + dbms_sql.return_result(c1); + open c1 for select 36 from dual; + dbms_sql.return_result(c1); + open c1 for select 37 from dual; + dbms_sql.return_result(c1); + open c1 for select 38 from dual; + dbms_sql.return_result(c1); + open c1 for select 39 from dual; + dbms_sql.return_result(c1); + open c1 for select 40 from dual; + dbms_sql.return_result(c1); + open c1 for select 41 from dual; + dbms_sql.return_result(c1); + open c1 for select 42 from dual; + dbms_sql.return_result(c1); + open c1 for select 43 from dual; + dbms_sql.return_result(c1); + open c1 for select 44 from dual; + dbms_sql.return_result(c1); + open c1 for select 45 from dual; + dbms_sql.return_result(c1); + open c1 for select 46 from dual; + dbms_sql.return_result(c1); + open c1 for select 47 from dual; + dbms_sql.return_result(c1); + open c1 for select 48 from dual; + dbms_sql.return_result(c1); + open c1 for select 49 from dual; + dbms_sql.return_result(c1); + open c1 for select 50 from dual; + dbms_sql.return_result(c1); + open c1 for select 51 from dual; + dbms_sql.return_result(c1); + open c1 for select 52 from dual; + dbms_sql.return_result(c1); + open c1 for select 53 from dual; + dbms_sql.return_result(c1); + open c1 for select 54 from dual; + dbms_sql.return_result(c1); + open c1 for select 55 from dual; + dbms_sql.return_result(c1); + open c1 for select 56 from dual; + dbms_sql.return_result(c1); + open c1 for select 57 from dual; + dbms_sql.return_result(c1); + open c1 for select 58 from dual; + dbms_sql.return_result(c1); + open c1 for select 59 from dual; + dbms_sql.return_result(c1); + open c1 for select 60 from dual; + dbms_sql.return_result(c1); + open c1 for select 61 from dual; + dbms_sql.return_result(c1); + open c1 for select 62 from dual; + dbms_sql.return_result(c1); + open c1 for select 63 from dual; + dbms_sql.return_result(c1); + open c1 for select 64 from dual; + dbms_sql.return_result(c1); + open c1 for select 65 from dual; + dbms_sql.return_result(c1); + open c1 for select 66 from dual; + dbms_sql.return_result(c1); + open c1 for select 67 from dual; + dbms_sql.return_result(c1); + open c1 for select 68 from dual; + dbms_sql.return_result(c1); + open c1 for select 69 from dual; + dbms_sql.return_result(c1); + open c1 for select 70 from dual; + dbms_sql.return_result(c1); + open c1 for select 71 from dual; + dbms_sql.return_result(c1); + open c1 for select 72 from dual; + dbms_sql.return_result(c1); + open c1 for select 73 from dual; + dbms_sql.return_result(c1); + open c1 for select 74 from dual; + dbms_sql.return_result(c1); + open c1 for select 75 from dual; + dbms_sql.return_result(c1); + open c1 for select 76 from dual; + dbms_sql.return_result(c1); + open c1 for select 77 from dual; + dbms_sql.return_result(c1); + open c1 for select 78 from dual; + dbms_sql.return_result(c1); + open c1 for select 79 from dual; + dbms_sql.return_result(c1); + open c1 for select 80 from dual; + dbms_sql.return_result(c1); + open c1 for select 81 from dual; + dbms_sql.return_result(c1); + open c1 for select 82 from dual; + dbms_sql.return_result(c1); + open c1 for select 83 from dual; + dbms_sql.return_result(c1); + open c1 for select 84 from dual; + dbms_sql.return_result(c1); + open c1 for select 85 from dual; + dbms_sql.return_result(c1); + open c1 for select 86 from dual; + dbms_sql.return_result(c1); + open c1 for select 87 from dual; + dbms_sql.return_result(c1); + open c1 for select 88 from dual; + dbms_sql.return_result(c1); + open c1 for select 89 from dual; + dbms_sql.return_result(c1); + open c1 for select 90 from dual; + dbms_sql.return_result(c1); + open c1 for select 91 from dual; + dbms_sql.return_result(c1); + open c1 for select 92 from dual; + dbms_sql.return_result(c1); + open c1 for select 93 from dual; + dbms_sql.return_result(c1); + open c1 for select 94 from dual; + dbms_sql.return_result(c1); + open c1 for select 95 from dual; + dbms_sql.return_result(c1); + open c1 for select 96 from dual; + dbms_sql.return_result(c1); + open c1 for select 97 from dual; + dbms_sql.return_result(c1); + open c1 for select 98 from dual; + dbms_sql.return_result(c1); + open c1 for select 99 from dual; + dbms_sql.return_result(c1); + open c1 for select 100 from dual; + dbms_sql.return_result(c1); + open c1 for select 101 from dual; + dbms_sql.return_result(c1); + open c1 for select 102 from dual; + dbms_sql.return_result(c1); + open c1 for select 103 from dual; + dbms_sql.return_result(c1); + open c1 for select 104 from dual; + dbms_sql.return_result(c1); + open c1 for select 105 from dual; + dbms_sql.return_result(c1); + open c1 for select 106 from dual; + dbms_sql.return_result(c1); + open c1 for select 107 from dual; + dbms_sql.return_result(c1); + open c1 for select 108 from dual; + dbms_sql.return_result(c1); + open c1 for select 109 from dual; + dbms_sql.return_result(c1); + open c1 for select 110 from dual; + dbms_sql.return_result(c1); + open c1 for select 111 from dual; + dbms_sql.return_result(c1); + open c1 for select 112 from dual; + dbms_sql.return_result(c1); + open c1 for select 113 from dual; + dbms_sql.return_result(c1); + open c1 for select 114 from dual; + dbms_sql.return_result(c1); + open c1 for select 115 from dual; + dbms_sql.return_result(c1); + open c1 for select 116 from dual; + dbms_sql.return_result(c1); + open c1 for select 117 from dual; + dbms_sql.return_result(c1); + open c1 for select 118 from dual; + dbms_sql.return_result(c1); + open c1 for select 119 from dual; + dbms_sql.return_result(c1); + open c1 for select 120 from dual; + dbms_sql.return_result(c1); + open c1 for select 121 from dual; + dbms_sql.return_result(c1); + open c1 for select 122 from dual; + dbms_sql.return_result(c1); + open c1 for select 123 from dual; + dbms_sql.return_result(c1); + open c1 for select 124 from dual; + dbms_sql.return_result(c1); + open c1 for select 125 from dual; + dbms_sql.return_result(c1); + open c1 for select 126 from dual; + dbms_sql.return_result(c1); + open c1 for select 127 from dual; + dbms_sql.return_result(c1); + open c1 for select 128 from dual; + dbms_sql.return_result(c1); + open c1 for select 129 from dual; + dbms_sql.return_result(c1); + open c1 for select 130 from dual; + dbms_sql.return_result(c1); + open c1 for select 131 from dual; + dbms_sql.return_result(c1); + open c1 for select 132 from dual; + dbms_sql.return_result(c1); + open c1 for select 133 from dual; + dbms_sql.return_result(c1); + open c1 for select 134 from dual; + dbms_sql.return_result(c1); + open c1 for select 135 from dual; + dbms_sql.return_result(c1); + open c1 for select 136 from dual; + dbms_sql.return_result(c1); + open c1 for select 137 from dual; + dbms_sql.return_result(c1); + open c1 for select 138 from dual; + dbms_sql.return_result(c1); + open c1 for select 139 from dual; + dbms_sql.return_result(c1); + open c1 for select 140 from dual; + dbms_sql.return_result(c1); + open c1 for select 141 from dual; + dbms_sql.return_result(c1); + open c1 for select 142 from dual; + dbms_sql.return_result(c1); + open c1 for select 143 from dual; + dbms_sql.return_result(c1); + open c1 for select 144 from dual; + dbms_sql.return_result(c1); + open c1 for select 145 from dual; + dbms_sql.return_result(c1); + open c1 for select 146 from dual; + dbms_sql.return_result(c1); + open c1 for select 147 from dual; + dbms_sql.return_result(c1); + open c1 for select 148 from dual; + dbms_sql.return_result(c1); + open c1 for select 149 from dual; + dbms_sql.return_result(c1); + open c1 for select 150 from dual; + dbms_sql.return_result(c1); + open c1 for select 151 from dual; + dbms_sql.return_result(c1); + open c1 for select 152 from dual; + dbms_sql.return_result(c1); + open c1 for select 153 from dual; + dbms_sql.return_result(c1); + open c1 for select 154 from dual; + dbms_sql.return_result(c1); + open c1 for select 155 from dual; + dbms_sql.return_result(c1); + open c1 for select 156 from dual; + dbms_sql.return_result(c1); + open c1 for select 157 from dual; + dbms_sql.return_result(c1); + open c1 for select 158 from dual; + dbms_sql.return_result(c1); + open c1 for select 159 from dual; + dbms_sql.return_result(c1); + open c1 for select 160 from dual; + dbms_sql.return_result(c1); + open c1 for select 161 from dual; + dbms_sql.return_result(c1); + open c1 for select 162 from dual; + dbms_sql.return_result(c1); + open c1 for select 163 from dual; + dbms_sql.return_result(c1); + open c1 for select 164 from dual; + dbms_sql.return_result(c1); + open c1 for select 165 from dual; + dbms_sql.return_result(c1); + open c1 for select 166 from dual; + dbms_sql.return_result(c1); + open c1 for select 167 from dual; + dbms_sql.return_result(c1); + open c1 for select 168 from dual; + dbms_sql.return_result(c1); + open c1 for select 169 from dual; + dbms_sql.return_result(c1); + open c1 for select 170 from dual; + dbms_sql.return_result(c1); + open c1 for select 171 from dual; + dbms_sql.return_result(c1); + open c1 for select 172 from dual; + dbms_sql.return_result(c1); + open c1 for select 173 from dual; + dbms_sql.return_result(c1); + open c1 for select 174 from dual; + dbms_sql.return_result(c1); + open c1 for select 175 from dual; + dbms_sql.return_result(c1); + open c1 for select 176 from dual; + dbms_sql.return_result(c1); + open c1 for select 177 from dual; + dbms_sql.return_result(c1); + open c1 for select 178 from dual; + dbms_sql.return_result(c1); + open c1 for select 179 from dual; + dbms_sql.return_result(c1); + open c1 for select 180 from dual; + dbms_sql.return_result(c1); + open c1 for select 181 from dual; + dbms_sql.return_result(c1); + open c1 for select 182 from dual; + dbms_sql.return_result(c1); + open c1 for select 183 from dual; + dbms_sql.return_result(c1); + open c1 for select 184 from dual; + dbms_sql.return_result(c1); + open c1 for select 185 from dual; + dbms_sql.return_result(c1); + open c1 for select 186 from dual; + dbms_sql.return_result(c1); + open c1 for select 187 from dual; + dbms_sql.return_result(c1); + open c1 for select 188 from dual; + dbms_sql.return_result(c1); + open c1 for select 189 from dual; + dbms_sql.return_result(c1); + open c1 for select 190 from dual; + dbms_sql.return_result(c1); + open c1 for select 191 from dual; + dbms_sql.return_result(c1); + open c1 for select 192 from dual; + dbms_sql.return_result(c1); + open c1 for select 193 from dual; + dbms_sql.return_result(c1); + open c1 for select 194 from dual; + dbms_sql.return_result(c1); + open c1 for select 195 from dual; + dbms_sql.return_result(c1); + open c1 for select 196 from dual; + dbms_sql.return_result(c1); + open c1 for select 197 from dual; + dbms_sql.return_result(c1); + open c1 for select 198 from dual; + dbms_sql.return_result(c1); + open c1 for select 199 from dual; + dbms_sql.return_result(c1); + open c1 for select 200 from dual; + dbms_sql.return_result(c1); + open c1 for select 201 from dual; + dbms_sql.return_result(c1); + open c1 for select 202 from dual; + dbms_sql.return_result(c1); + open c1 for select 203 from dual; + dbms_sql.return_result(c1); + open c1 for select 204 from dual; + dbms_sql.return_result(c1); + open c1 for select 205 from dual; + dbms_sql.return_result(c1); + open c1 for select 206 from dual; + dbms_sql.return_result(c1); + open c1 for select 207 from dual; + dbms_sql.return_result(c1); + open c1 for select 208 from dual; + dbms_sql.return_result(c1); + open c1 for select 209 from dual; + dbms_sql.return_result(c1); + open c1 for select 210 from dual; + dbms_sql.return_result(c1); + open c1 for select 211 from dual; + dbms_sql.return_result(c1); + open c1 for select 212 from dual; + dbms_sql.return_result(c1); + open c1 for select 213 from dual; + dbms_sql.return_result(c1); + open c1 for select 214 from dual; + dbms_sql.return_result(c1); + open c1 for select 215 from dual; + dbms_sql.return_result(c1); + open c1 for select 216 from dual; + dbms_sql.return_result(c1); + open c1 for select 217 from dual; + dbms_sql.return_result(c1); + open c1 for select 218 from dual; + dbms_sql.return_result(c1); + open c1 for select 219 from dual; + dbms_sql.return_result(c1); + open c1 for select 220 from dual; + dbms_sql.return_result(c1); + open c1 for select 221 from dual; + dbms_sql.return_result(c1); + open c1 for select 222 from dual; + dbms_sql.return_result(c1); + open c1 for select 223 from dual; + dbms_sql.return_result(c1); + open c1 for select 224 from dual; + dbms_sql.return_result(c1); + open c1 for select 225 from dual; + dbms_sql.return_result(c1); + open c1 for select 226 from dual; + dbms_sql.return_result(c1); + open c1 for select 227 from dual; + dbms_sql.return_result(c1); + open c1 for select 228 from dual; + dbms_sql.return_result(c1); + open c1 for select 229 from dual; + dbms_sql.return_result(c1); + open c1 for select 230 from dual; + dbms_sql.return_result(c1); + open c1 for select 231 from dual; + dbms_sql.return_result(c1); + open c1 for select 232 from dual; + dbms_sql.return_result(c1); + open c1 for select 233 from dual; + dbms_sql.return_result(c1); + open c1 for select 234 from dual; + dbms_sql.return_result(c1); + open c1 for select 235 from dual; + dbms_sql.return_result(c1); + open c1 for select 236 from dual; + dbms_sql.return_result(c1); + open c1 for select 237 from dual; + dbms_sql.return_result(c1); + open c1 for select 238 from dual; + dbms_sql.return_result(c1); + open c1 for select 239 from dual; + dbms_sql.return_result(c1); + open c1 for select 240 from dual; + dbms_sql.return_result(c1); + open c1 for select 241 from dual; + dbms_sql.return_result(c1); + open c1 for select 242 from dual; + dbms_sql.return_result(c1); + open c1 for select 243 from dual; + dbms_sql.return_result(c1); + open c1 for select 244 from dual; + dbms_sql.return_result(c1); + open c1 for select 245 from dual; + dbms_sql.return_result(c1); + open c1 for select 246 from dual; + dbms_sql.return_result(c1); + open c1 for select 247 from dual; + dbms_sql.return_result(c1); + open c1 for select 248 from dual; + dbms_sql.return_result(c1); + open c1 for select 249 from dual; + dbms_sql.return_result(c1); + open c1 for select 250 from dual; + dbms_sql.return_result(c1); + open c1 for select 251 from dual; + dbms_sql.return_result(c1); + open c1 for select 252 from dual; + dbms_sql.return_result(c1); + open c1 for select 253 from dual; + dbms_sql.return_result(c1); + open c1 for select 254 from dual; + dbms_sql.return_result(c1); + open c1 for select 255 from dual; + dbms_sql.return_result(c1); + open c1 for select 256 from dual; + dbms_sql.return_result(c1); + open c1 for select 257 from dual; + dbms_sql.return_result(c1); + open c1 for select 258 from dual; + dbms_sql.return_result(c1); + open c1 for select 259 from dual; + dbms_sql.return_result(c1); + open c1 for select 260 from dual; + dbms_sql.return_result(c1); + open c1 for select 261 from dual; + dbms_sql.return_result(c1); + open c1 for select 262 from dual; + dbms_sql.return_result(c1); + open c1 for select 263 from dual; + dbms_sql.return_result(c1); + open c1 for select 264 from dual; + dbms_sql.return_result(c1); + open c1 for select 265 from dual; + dbms_sql.return_result(c1); + open c1 for select 266 from dual; + dbms_sql.return_result(c1); + open c1 for select 267 from dual; + dbms_sql.return_result(c1); + open c1 for select 268 from dual; + dbms_sql.return_result(c1); + open c1 for select 269 from dual; + dbms_sql.return_result(c1); + open c1 for select 270 from dual; + dbms_sql.return_result(c1); + open c1 for select 271 from dual; + dbms_sql.return_result(c1); + open c1 for select 272 from dual; + dbms_sql.return_result(c1); + open c1 for select 273 from dual; + dbms_sql.return_result(c1); + open c1 for select 274 from dual; + dbms_sql.return_result(c1); + open c1 for select 275 from dual; + dbms_sql.return_result(c1); + end;"; + +// Run Test + +echo "Test 1\n"; +$s = oci_parse($c, $stmt); +oci_execute($s); + +while (($row = oci_fetch_row($s)) != false) { + foreach ($row as $item) { + echo " ".$item; + } + echo "\n"; +} + +?> +===DONE=== +<?php exit(0); ?> +--EXPECTF-- +Test 1 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 20 + 21 + 22 + 23 + 24 + 25 + 26 + 27 + 28 + 29 + 30 + 31 + 32 + 33 + 34 + 35 + 36 + 37 + 38 + 39 + 40 + 41 + 42 + 43 + 44 + 45 + 46 + 47 + 48 + 49 + 50 + 51 + 52 + 53 + 54 + 55 + 56 + 57 + 58 + 59 + 60 + 61 + 62 + 63 + 64 + 65 + 66 + 67 + 68 + 69 + 70 + 71 + 72 + 73 + 74 + 75 + 76 + 77 + 78 + 79 + 80 + 81 + 82 + 83 + 84 + 85 + 86 + 87 + 88 + 89 + 90 + 91 + 92 + 93 + 94 + 95 + 96 + 97 + 98 + 99 + 100 + 101 + 102 + 103 + 104 + 105 + 106 + 107 + 108 + 109 + 110 + 111 + 112 + 113 + 114 + 115 + 116 + 117 + 118 + 119 + 120 + 121 + 122 + 123 + 124 + 125 + 126 + 127 + 128 + 129 + 130 + 131 + 132 + 133 + 134 + 135 + 136 + 137 + 138 + 139 + 140 + 141 + 142 + 143 + 144 + 145 + 146 + 147 + 148 + 149 + 150 + 151 + 152 + 153 + 154 + 155 + 156 + 157 + 158 + 159 + 160 + 161 + 162 + 163 + 164 + 165 + 166 + 167 + 168 + 169 + 170 + 171 + 172 + 173 + 174 + 175 + 176 + 177 + 178 + 179 + 180 + 181 + 182 + 183 + 184 + 185 + 186 + 187 + 188 + 189 + 190 + 191 + 192 + 193 + 194 + 195 + 196 + 197 + 198 + 199 + 200 + 201 + 202 + 203 + 204 + 205 + 206 + 207 + 208 + 209 + 210 + 211 + 212 + 213 + 214 + 215 + 216 + 217 + 218 + 219 + 220 + 221 + 222 + 223 + 224 + 225 + 226 + 227 + 228 + 229 + 230 + 231 + 232 + 233 + 234 + 235 + 236 + 237 + 238 + 239 + 240 + 241 + 242 + 243 + 244 + 245 + 246 + 247 + 248 + 249 + 250 + 251 + 252 + 253 + 254 + 255 + 256 + 257 + 258 + 259 + 260 + 261 + 262 + 263 + 264 + 265 + 266 + 267 + 268 + 269 + 270 + 271 + 272 + 273 + 274 + 275 +===DONE=== diff --git a/ext/oci8/tests/imp_res_call_error.phpt b/ext/oci8/tests/imp_res_call_error.phpt new file mode 100644 index 000000000..8b0fa78db --- /dev/null +++ b/ext/oci8/tests/imp_res_call_error.phpt @@ -0,0 +1,61 @@ +--TEST-- +Oracle Database 12c Implicit Result Sets: using SQL 'CALL' +--SKIPIF-- +<?php +if (!extension_loaded('oci8')) die ("skip no oci8 extension"); +$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); +if (!(isset($matches[0]) && $matches[1] >= 12)) { + die("skip expected output only valid when using Oracle Database 12c or greater"); +} +preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); +if (!(isset($matches[0]) && $matches[0] >= 12)) { + die("skip works only with Oracle 12c or greater version of Oracle client libraries"); +} +?> +--FILE-- +<?php + +require(dirname(__FILE__).'/connect.inc'); + +// Initialization + +$stmtarray = array( + "create or replace procedure imp_res_call_err_proc as + c1 sys_refcursor; + begin + open c1 for select * from dual; + dbms_sql.return_result(c1); + open c1 for select * from dual; + dbms_sql.return_result (c1); + end;"); + +oci8_test_sql_execute($c, $stmtarray); + +// Run Test + +echo "Test 1\n"; + +$s = oci_parse($c, "call imp_res_call_err_proc()"); +oci_execute($s); + +// Clean up + +$stmtarray = array( + "drop procedure imp_res_call_err_proc" +); + +oci8_test_sql_execute($c, $stmtarray); + +?> +===DONE=== +<?php exit(0); ?> +--EXPECTF-- +Test 1 + +Warning: oci_execute(): ORA-29478: %s +ORA-06512: at "SYS.DBMS_SQL", line %d +ORA-06512: at "SYS.DBMS_SQL", line %d +ORA-06512: at "SYSTEM.IMP_RES_CALL_ERR_PROC", line %d in %simp_res_call_error.php on line %d +===DONE=== diff --git a/ext/oci8/tests/imp_res_cancel.phpt b/ext/oci8/tests/imp_res_cancel.phpt new file mode 100644 index 000000000..663d630df --- /dev/null +++ b/ext/oci8/tests/imp_res_cancel.phpt @@ -0,0 +1,68 @@ +--TEST-- +Oracle Database 12c Implicit Result Sets: oci_cancel +--SKIPIF-- +<?php +if (!extension_loaded('oci8')) die ("skip no oci8 extension"); +$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); +if (!(isset($matches[0]) && $matches[1] >= 12)) { + die("skip expected output only valid when using Oracle Database 12c or greater"); +} +preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); +if (!(isset($matches[0]) && $matches[0] >= 12)) { + die("skip works only with Oracle 12c or greater version of Oracle client libraries"); +} +?> +--FILE-- +<?php + +require(dirname(__FILE__).'/connect.inc'); + +$stmtarray = array( + "create or replace procedure imp_res_cancel_proc as + c1 sys_refcursor; + c2 sys_refcursor; + begin + open c1 for select 1 from dual union all select 2 from dual; + dbms_sql.return_result(c1); + open c2 for select 3 from dual; + dbms_sql.return_result (c2); + end;" +); + +oci8_test_sql_execute($c, $stmtarray); + +// Run Test + +echo "Test 1\n"; +$s = oci_parse($c, "begin imp_res_cancel_proc(); end;"); +oci_execute($s); +while (($row = oci_fetch_array($s, OCI_ASSOC+OCI_RETURN_NULLS)) != false) { + foreach ($row as $item) { + echo " ".$item; + } + echo "\n"; + var_dump(oci_cancel($s)); +} + +// Clean up + +$stmtarray = array( + "drop procedure imp_res_cancel_proc" +); + +oci8_test_sql_execute($c, $stmtarray); + +?> +===DONE=== +<?php exit(0); ?> +--EXPECTF-- +Test 1 + 1 +bool(true) + 2 +bool(true) + 3 +bool(true) +===DONE=== diff --git a/ext/oci8/tests/imp_res_close.phpt b/ext/oci8/tests/imp_res_close.phpt new file mode 100644 index 000000000..01ac2c75e --- /dev/null +++ b/ext/oci8/tests/imp_res_close.phpt @@ -0,0 +1,69 @@ +--TEST-- +Oracle Database 12c Implicit Result Sets: oci_free_statement #1 +--SKIPIF-- +<?php +if (!extension_loaded('oci8')) die ("skip no oci8 extension"); +$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); +if (!(isset($matches[0]) && $matches[1] >= 12)) { + die("skip expected output only valid when using Oracle Database 12c or greater"); +} +preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); +if (!(isset($matches[0]) && $matches[0] >= 12)) { + die("skip works only with Oracle 12c or greater version of Oracle client libraries"); +} +?> +--FILE-- +<?php + +require(dirname(__FILE__).'/connect.inc'); + +// Initialization + +$stmtarray = array( + "create or replace procedure imp_res_close_proc as + c1 sys_refcursor; + begin + open c1 for select 1 from dual union all select 2 from dual order by 1; + dbms_sql.return_result(c1); + open c1 for select 3 from dual union all select 4 from dual order by 1; + dbms_sql.return_result(c1); + open c1 for select 5 from dual union all select 6 from dual order by 1; + dbms_sql.return_result(c1); + end;" +); + +oci8_test_sql_execute($c, $stmtarray); + +// Run Test + +echo "Test 1\n"; +$s = oci_parse($c, "begin imp_res_close_proc(); end;"); +oci_execute($s); +while (($row = oci_fetch_array($s, OCI_ASSOC+OCI_RETURN_NULLS)) != false) { + foreach ($row as $item) { + echo " ".$item; + } + echo "\n"; + oci_free_statement($s); // Free the implicit result handle +} + +// Clean up + +$stmtarray = array( + "drop procedure imp_res_close_proc" +); + +oci8_test_sql_execute($c, $stmtarray); + +?> +===DONE=== +<?php exit(0); ?> +--EXPECTF-- +Test 1 + 1 + 2 + +Warning: oci_fetch_array(): %d is not a valid oci8 statement resource in %simp_res_close.php on line %d +===DONE=== diff --git a/ext/oci8/tests/imp_res_cursor.phpt b/ext/oci8/tests/imp_res_cursor.phpt new file mode 100644 index 000000000..cac0a5d1c --- /dev/null +++ b/ext/oci8/tests/imp_res_cursor.phpt @@ -0,0 +1,99 @@ +--TEST-- +Oracle Database 12c Implicit Result Sets: nested cursor +--SKIPIF-- +<?php +if (!extension_loaded('oci8')) die ("skip no oci8 extension"); +$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); +if (!(isset($matches[0]) && $matches[1] >= 12)) { + die("skip expected output only valid when using Oracle Database 12c or greater"); +} +preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); +if (!(isset($matches[0]) && $matches[0] >= 12)) { + die("skip works only with Oracle 12c or greater version of Oracle client libraries"); +} +?> +--FILE-- +<?php + +require(dirname(__FILE__).'/connect.inc'); + +// Initialization + +$stmtarray = array( + "drop table imp_res_cursor_tab_1", + "create table imp_res_cursor_tab_1 (c1 number, c2 varchar2(10))", + "insert into imp_res_cursor_tab_1 values (1, 'abcde')", + "insert into imp_res_cursor_tab_1 values (2, 'fghij')", + "insert into imp_res_cursor_tab_1 values (3, 'klmno')", + + "drop table imp_res_cursor_tab_2", + "create table imp_res_cursor_tab_2 (c3 varchar2(1))", + "insert into imp_res_cursor_tab_2 values ('t')", + "insert into imp_res_cursor_tab_2 values ('u')", + "insert into imp_res_cursor_tab_2 values ('v')", + + "create or replace procedure imp_res_cursor_proc as + c1 sys_refcursor; + begin + open c1 for select * from dual; + dbms_sql.return_result (c1); + + open c1 for select cursor(select c1, c2 from imp_res_cursor_tab_1 order by 1) as curs from dual; + dbms_sql.return_result(c1); + + open c1 for select * from imp_res_cursor_tab_2 where rownum < 3 order by 1; + dbms_sql.return_result(c1); + end;" +); + +oci8_test_sql_execute($c, $stmtarray); + +function do_fetch($s) +{ + while (($row = oci_fetch_assoc($s)) != false) { + foreach ($row as $item) { + if (is_resource($item)) { // Nested cursor + oci_execute($item); + do_fetch($item); + } else { + echo " ".$item; + } + } + echo "\n"; + } +} + +// Run Test + +echo "Test 1\n"; + +$s = oci_parse($c, "begin imp_res_cursor_proc(); end;"); +oci_execute($s); + +do_fetch($s); + +// Clean up + +$stmtarray = array( + "drop procedure imp_res_cursor_proc", + "drop table imp_res_cursor_tab_1", + "drop table imp_res_cursor_tab_2" +); + +oci8_test_sql_execute($c, $stmtarray); + +?> +===DONE=== +<?php exit(0); ?> +--EXPECTF-- +Test 1 + X + 1 abcde + 2 fghij + 3 klmno + + t + u +===DONE=== diff --git a/ext/oci8/tests/imp_res_dbmsoutput.phpt b/ext/oci8/tests/imp_res_dbmsoutput.phpt new file mode 100644 index 000000000..8c9808d96 --- /dev/null +++ b/ext/oci8/tests/imp_res_dbmsoutput.phpt @@ -0,0 +1,136 @@ +--TEST-- +Oracle Database 12c Implicit Result Sets: interleaved with DBMS_OUTPUT +--SKIPIF-- +<?php +if (!extension_loaded('oci8')) die ("skip no oci8 extension"); +$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); +if (!(isset($matches[0]) && $matches[1] >= 12)) { + die("skip expected output only valid when using Oracle Database 12c or greater"); +} +preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); +if (!(isset($matches[0]) && $matches[0] >= 12)) { + die("skip works only with Oracle 12c or greater version of Oracle client libraries"); +} +?> +--FILE-- +<?php + +require(dirname(__FILE__).'/connect.inc'); + +// Initialization + +$stmtarray = array( + "drop table imp_res_dbmsoutput_tab_1", + "create table imp_res_dbmsoutput_tab_1 (c1 number, c2 varchar2(10))", + "insert into imp_res_dbmsoutput_tab_1 values (1, 'abcde')", + "insert into imp_res_dbmsoutput_tab_1 values (2, 'fghij')", + "insert into imp_res_dbmsoutput_tab_1 values (3, 'klmno')", + + "drop table imp_res_dbmsoutput_tab_2", + "create table imp_res_dbmsoutput_tab_2 (c3 varchar2(1))", + "insert into imp_res_dbmsoutput_tab_2 values ('t')", + "insert into imp_res_dbmsoutput_tab_2 values ('u')", + "insert into imp_res_dbmsoutput_tab_2 values ('v')", + + "create or replace procedure imp_res_dbmsoutput_proc as + c1 sys_refcursor; + begin + dbms_output.put_line('dbms_output Line 1'); + open c1 for select * from imp_res_dbmsoutput_tab_1 order by 1; + dbms_sql.return_result(c1); + dbms_output.put_line('dbms_output Line 2'); + open c1 for select * from imp_res_dbmsoutput_tab_2 order by 1; + dbms_sql.return_result(c1); + end;" +); + +oci8_test_sql_execute($c, $stmtarray); + +function setserveroutputon($c) +{ + $s = oci_parse($c, "begin dbms_output.enable(null); end;"); + oci_execute($s); +} + +function getdbmsoutput_do($c) +{ + $s = oci_parse($c, "begin dbms_output.get_line(:ln, :st); end;"); + oci_bind_by_name($s, ":ln", $ln, 100); + oci_bind_by_name($s, ":st", $st, -1, SQLT_INT); + $res = false; + while (($succ = oci_execute($s)) && !$st) { + $res[] = $ln; // append each line to the array + } + return $res; +} + +setserveroutputon($c); + +// Run Test + +echo "Test 1\n"; +$s = oci_parse($c, "begin imp_res_dbmsoutput_proc(); end;"); +oci_execute($s); +var_dump(getdbmsoutput_do($c)); +while (($row = oci_fetch_array($s, OCI_ASSOC+OCI_RETURN_NULLS)) != false) { + foreach ($row as $item) { + echo " ".$item; + } + echo "\n"; +} + +echo "\nTest 2\n"; +$s = oci_parse($c, "begin imp_res_dbmsoutput_proc(); end;"); +oci_execute($s); +while (($row = oci_fetch_array($s, OCI_ASSOC+OCI_RETURN_NULLS)) != false) { + foreach ($row as $item) { + echo " ".$item; + } + echo "\n"; +} +var_dump(getdbmsoutput_do($c)); + +// Clean up + +$stmtarray = array( + "drop procedure imp_res_dbmsoutput_proc", + "drop table imp_res_dbmsoutput_tab_1", + "drop table imp_res_dbmsoutput_tab_2" +); + +oci8_test_sql_execute($c, $stmtarray); + +?> +===DONE=== +<?php exit(0); ?> +--EXPECTF-- +Test 1 +array(2) { + [0]=> + string(18) "dbms_output Line 1" + [1]=> + string(18) "dbms_output Line 2" +} + 1 abcde + 2 fghij + 3 klmno + t + u + v + +Test 2 + 1 abcde + 2 fghij + 3 klmno + t + u + v +array(2) { + [0]=> + string(18) "dbms_output Line 1" + [1]=> + string(18) "dbms_output Line 2" +} +===DONE=== diff --git a/ext/oci8/tests/imp_res_field.phpt b/ext/oci8/tests/imp_res_field.phpt new file mode 100644 index 000000000..54b8295cf --- /dev/null +++ b/ext/oci8/tests/imp_res_field.phpt @@ -0,0 +1,227 @@ +--TEST-- +Oracle Database 12c Implicit Result Sets: field tests +--SKIPIF-- +<?php +if (!extension_loaded('oci8')) die ("skip no oci8 extension"); +$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); +if (!(isset($matches[0]) && $matches[1] >= 12)) { + die("skip expected output only valid when using Oracle Database 12c or greater"); +} +preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); +if (!(isset($matches[0]) && $matches[0] >= 12)) { + die("skip works only with Oracle 12c or greater version of Oracle client libraries"); +} +?> +--FILE-- +<?php + +require(dirname(__FILE__).'/connect.inc'); + +// Initialization + +$stmtarray = array( + "drop table imp_res_field_tab_1", + "create table imp_res_field_tab_1 (c1_number number, c2_varchar210 varchar2(10))", + "insert into imp_res_field_tab_1 values (1111, 'abcde')", + + "drop table imp_res_field_tab_2", + "create table imp_res_field_tab_2 (c3_varchar21 varchar2(4))", + "insert into imp_res_field_tab_2 values ('tttt')", + + "drop table imp_res_field_tab_3", + "create table imp_res_field_tab_3 (c4_number52 number(5,2))", + "insert into imp_res_field_tab_3 values (33)", + "insert into imp_res_field_tab_3 values (NULL)", + + "create or replace procedure imp_res_field_proc as + c1 sys_refcursor; + begin + open c1 for select * from imp_res_field_tab_1 order by 1; + dbms_sql.return_result(c1); + + open c1 for select * from imp_res_field_tab_2 order by 1; + dbms_sql.return_result(c1); + + open c1 for select * from imp_res_field_tab_3 order by 1; + dbms_sql.return_result(c1); + end;" +); + +oci8_test_sql_execute($c, $stmtarray); + +function print_fields($s) +{ + echo "num fields : " . oci_num_fields($s) . "\n"; + for ($i = 1; $i <= oci_num_fields($s); $i++) { + $is_null = oci_field_is_null($s, $i) ? "T" : "F"; + $name = oci_field_name($s, $i); + $precision = oci_field_precision($s, $i); + $scale = oci_field_scale($s, $i); + $size = oci_field_size($s, $i); + $typeraw = oci_field_type_raw($s, $i); + $type = oci_field_type($s, $i); + echo "$name\t: is_null $is_null, precision $precision, scale $scale, size $size, typeraw $typeraw, type $type\n"; + } +} + +// Run Test + +echo "Test 1 - can't get IRS fields from parent\n"; +$s = oci_parse($c, "begin imp_res_field_proc(); end;"); +oci_execute($s); +print_fields($s); + +echo "\nTest 2 - can't get IRS fields from parent when fetching\n"; +$s = oci_parse($c, "begin imp_res_field_proc(); end;"); +oci_execute($s); +while (($r = oci_fetch_row($s))) { + var_dump($r); + print_fields($s); +} + +echo "\nTest 3 - get IRS fields\n"; +$s = oci_parse($c, "begin imp_res_field_proc(); end;"); +oci_execute($s); +while (($s1 = oci_get_implicit_resultset($s))) { + print_fields($s1); +} + +echo "\nTest 4 - get IRS fields before fetching rows\n"; +$s = oci_parse($c, "begin imp_res_field_proc(); end;"); +oci_execute($s); +$i = 0; +while (($s1 = oci_get_implicit_resultset($s))) { + echo "===> Result set ".++$i."\n"; + print_fields($s1); + while (($r = oci_fetch_row($s1)) !== false) { + var_dump($r); + } +} + +echo "\nTest 5 - get IRS fields when fetching rows\n"; +$s = oci_parse($c, "begin imp_res_field_proc(); end;"); +oci_execute($s); +$i = 0; +while (($s1 = oci_get_implicit_resultset($s))) { + echo "===> Result set ".++$i."\n"; + while (($r = oci_fetch_row($s1)) !== false) { + var_dump($r); + print_fields($s1); + } +} + +// Clean up + +$stmtarray = array( + "drop procedure imp_res_field_proc", + "drop table imp_res_field_tab_1", + "drop table imp_res_field_tab_2", + "drop table imp_res_field_tab_3" +); + +oci8_test_sql_execute($c, $stmtarray); + +?> +===DONE=== +<?php exit(0); ?> +--EXPECTF-- +Test 1 - can't get IRS fields from parent +num fields : 0 + +Test 2 - can't get IRS fields from parent when fetching +array(2) { + [0]=> + string(4) "1111" + [1]=> + string(5) "abcde" +} +num fields : 0 +array(1) { + [0]=> + string(4) "tttt" +} +num fields : 0 +array(1) { + [0]=> + string(2) "33" +} +num fields : 0 +array(1) { + [0]=> + NULL +} +num fields : 0 + +Test 3 - get IRS fields +num fields : 2 +C1_NUMBER : is_null F, precision 0, scale -127, size 22, typeraw 2, type NUMBER +C2_VARCHAR210 : is_null F, precision 0, scale 0, size 10, typeraw 1, type VARCHAR2 +num fields : 1 +C3_VARCHAR21 : is_null F, precision 0, scale 0, size 4, typeraw 1, type VARCHAR2 +num fields : 1 +C4_NUMBER52 : is_null F, precision 5, scale 2, size 22, typeraw 2, type NUMBER + +Test 4 - get IRS fields before fetching rows +===> Result set 1 +num fields : 2 +C1_NUMBER : is_null F, precision 0, scale -127, size 22, typeraw 2, type NUMBER +C2_VARCHAR210 : is_null F, precision 0, scale 0, size 10, typeraw 1, type VARCHAR2 +array(2) { + [0]=> + string(4) "1111" + [1]=> + string(5) "abcde" +} +===> Result set 2 +num fields : 1 +C3_VARCHAR21 : is_null F, precision 0, scale 0, size 4, typeraw 1, type VARCHAR2 +array(1) { + [0]=> + string(4) "tttt" +} +===> Result set 3 +num fields : 1 +C4_NUMBER52 : is_null F, precision 5, scale 2, size 22, typeraw 2, type NUMBER +array(1) { + [0]=> + string(2) "33" +} +array(1) { + [0]=> + NULL +} + +Test 5 - get IRS fields when fetching rows +===> Result set 1 +array(2) { + [0]=> + string(4) "1111" + [1]=> + string(5) "abcde" +} +num fields : 2 +C1_NUMBER : is_null F, precision 0, scale -127, size 22, typeraw 2, type NUMBER +C2_VARCHAR210 : is_null F, precision 0, scale 0, size 10, typeraw 1, type VARCHAR2 +===> Result set 2 +array(1) { + [0]=> + string(4) "tttt" +} +num fields : 1 +C3_VARCHAR21 : is_null F, precision 0, scale 0, size 4, typeraw 1, type VARCHAR2 +===> Result set 3 +array(1) { + [0]=> + string(2) "33" +} +num fields : 1 +C4_NUMBER52 : is_null F, precision 5, scale 2, size 22, typeraw 2, type NUMBER +array(1) { + [0]=> + NULL +} +num fields : 1 +C4_NUMBER52 : is_null T, precision 5, scale 2, size 22, typeraw 2, type NUMBER +===DONE=== diff --git a/ext/oci8/tests/imp_res_func_error.phpt b/ext/oci8/tests/imp_res_func_error.phpt new file mode 100644 index 000000000..73c055793 --- /dev/null +++ b/ext/oci8/tests/imp_res_func_error.phpt @@ -0,0 +1,67 @@ +--TEST-- +Oracle Database 12c Implicit Result Sets: test with a PL/SQL function +--SKIPIF-- +<?php +if (!extension_loaded('oci8')) die ("skip no oci8 extension"); +$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); +if (!(isset($matches[0]) && $matches[1] >= 12)) { + die("skip expected output only valid when using Oracle Database 12c or greater"); +} +preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); +if (!(isset($matches[0]) && $matches[0] >= 12)) { + die("skip works only with Oracle 12c or greater version of Oracle client libraries"); +} +?> +--FILE-- +<?php + +require(dirname(__FILE__).'/connect.inc'); + +// Initialization + +$stmtarray = array( + "create or replace function imp_res_func_error return number as + c1 sys_refcursor; + begin + open c1 for select * from dual; + dbms_sql.return_result(c1); + return 1234; + end;" +); + +oci8_test_sql_execute($c, $stmtarray); + +// Run Test + +echo "Test 1\n"; +$s = oci_parse($c, "select imp_res_func_error from dual"); +$r = oci_execute($s); // This will fail with ORA-29478 in Oracle 12.1 +if ($r) { + while (($row = oci_fetch_array($s, OCI_ASSOC+OCI_RETURN_NULLS)) != false) { + foreach ($row as $item) { + echo " ".$item; + } + echo "\n"; + } +} +// Clean up + +$stmtarray = array( + "drop function imp_res_func_error", +); + +oci8_test_sql_execute($c, $stmtarray); + +?> +===DONE=== +<?php exit(0); ?> +--EXPECTF-- +Test 1 + +Warning: oci_execute(): ORA-29478: %s +ORA-06512: %s +ORA-06512: %s +ORA-06512: %s +===DONE=== diff --git a/ext/oci8/tests/imp_res_get_1.phpt b/ext/oci8/tests/imp_res_get_1.phpt new file mode 100644 index 000000000..665f773b5 --- /dev/null +++ b/ext/oci8/tests/imp_res_get_1.phpt @@ -0,0 +1,109 @@ +--TEST-- +Oracle Database 12c Implicit Result Sets: oci_get_implicit_resultset: basic test +--SKIPIF-- +<?php +if (!extension_loaded('oci8')) die ("skip no oci8 extension"); +$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); +if (!(isset($matches[0]) && $matches[1] >= 12)) { + die("skip expected output only valid when using Oracle Database 12c or greater"); +} +preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); +if (!(isset($matches[0]) && $matches[0] >= 12)) { + die("skip works only with Oracle 12c or greater version of Oracle client libraries"); +} +?> +--FILE-- +<?php + +require(dirname(__FILE__).'/connect.inc'); + +// Initialization + +$stmtarray = array( + "drop table imp_res_get_1_tab_1", + "create table imp_res_get_1_tab_1 (c1 number, c2 varchar2(10))", + "insert into imp_res_get_1_tab_1 values (1, 'abcde')", + "insert into imp_res_get_1_tab_1 values (2, 'fghij')", + "insert into imp_res_get_1_tab_1 values (3, 'klmno')", + + "drop table imp_res_get_1_tab_2", + "create table imp_res_get_1_tab_2 (c3 varchar2(1))", + "insert into imp_res_get_1_tab_2 values ('t')", + "insert into imp_res_get_1_tab_2 values ('u')", + "insert into imp_res_get_1_tab_2 values ('v')", + + "create or replace procedure imp_res_get_1_proc as + c1 sys_refcursor; + begin + open c1 for select * from imp_res_get_1_tab_1 order by 1; + dbms_sql.return_result(c1); + + open c1 for select * from imp_res_get_1_tab_2 where rownum < 3 order by 1; + dbms_sql.return_result(c1); + + open c1 for select * from dual; + dbms_sql.return_result (c1); + end;" +); + +oci8_test_sql_execute($c, $stmtarray); + +// Run Test + +echo "Test 1\n"; +$s = oci_parse($c, "begin imp_res_get_1_proc(); end;"); +oci_execute($s); +while (($s1 = oci_get_implicit_resultset($s))) { + while (($row = oci_fetch_array($s1, OCI_ASSOC+OCI_RETURN_NULLS)) != false) { + foreach ($row as $item) { + echo " ".$item; + } + echo "\n"; + } +} + +echo "\nTest 2 - with execute\n"; +$s = oci_parse($c, "begin imp_res_get_1_proc(); end;"); +oci_execute($s); +while (($s1 = oci_get_implicit_resultset($s))) { + oci_execute($s1); // no op + while (($row = oci_fetch_array($s1, OCI_ASSOC+OCI_RETURN_NULLS)) != false) { + foreach ($row as $item) { + echo " ".$item; + } + echo "\n"; + } +} + +// Clean up + +$stmtarray = array( + "drop procedure imp_res_get_1_proc", + "drop table imp_res_get_1_tab_1", + "drop table imp_res_get_1_tab_2" +); + +oci8_test_sql_execute($c, $stmtarray); + +?> +===DONE=== +<?php exit(0); ?> +--EXPECTF-- +Test 1 + 1 abcde + 2 fghij + 3 klmno + t + u + X + +Test 2 - with execute + 1 abcde + 2 fghij + 3 klmno + t + u + X +===DONE=== diff --git a/ext/oci8/tests/imp_res_get_2.phpt b/ext/oci8/tests/imp_res_get_2.phpt new file mode 100644 index 000000000..b20b8dd39 --- /dev/null +++ b/ext/oci8/tests/imp_res_get_2.phpt @@ -0,0 +1,107 @@ +--TEST-- +Oracle Database 12c Implicit Result Sets: oci_get_implicit_resultset: similar to imp_res_get_1 but with unrolled loop +--SKIPIF-- +<?php +if (!extension_loaded('oci8')) die ("skip no oci8 extension"); +$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); +if (!(isset($matches[0]) && $matches[1] >= 12)) { + die("skip expected output only valid when using Oracle Database 12c or greater"); +} +preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); +if (!(isset($matches[0]) && $matches[0] >= 12)) { + die("skip works only with Oracle 12c or greater version of Oracle client libraries"); +} +?> +--FILE-- +<?php + +require(dirname(__FILE__).'/connect.inc'); + +// Initialization + +$stmtarray = array( + "drop table imp_res_get_2_tab_1", + "create table imp_res_get_2_tab_1 (c1 number, c2 varchar2(10))", + "insert into imp_res_get_2_tab_1 values (1, 'abcde')", + "insert into imp_res_get_2_tab_1 values (2, 'fghij')", + "insert into imp_res_get_2_tab_1 values (3, 'klmno')", + + "drop table imp_res_get_2_tab_2", + "create table imp_res_get_2_tab_2 (c3 varchar2(1))", + "insert into imp_res_get_2_tab_2 values ('t')", + "insert into imp_res_get_2_tab_2 values ('u')", + "insert into imp_res_get_2_tab_2 values ('v')", + + "create or replace procedure imp_res_get_2_proc as + c1 sys_refcursor; + begin + open c1 for select * from imp_res_get_2_tab_1 order by 1; + dbms_sql.return_result(c1); + + open c1 for select * from imp_res_get_2_tab_2 where rownum < 3 order by 1; + dbms_sql.return_result(c1); + + open c1 for select * from dual; + dbms_sql.return_result (c1); + end;" +); + +oci8_test_sql_execute($c, $stmtarray); + +// Run Test + +echo "Test 1\n"; + +$s = oci_parse($c, "begin imp_res_get_2_proc(); end;"); +oci_execute($s); + +$s1 = oci_get_implicit_resultset($s); +while (($row = oci_fetch_array($s1, OCI_ASSOC+OCI_RETURN_NULLS))) { + foreach ($row as $item) { + echo " ".$item; + } + echo "\n"; +} + +$s2 = oci_get_implicit_resultset($s); +while (($row = oci_fetch_array($s2, OCI_ASSOC+OCI_RETURN_NULLS))) { + foreach ($row as $item) { + echo " ".$item; + } + echo "\n"; +} +oci_free_statement($s2); + +$s3 = oci_get_implicit_resultset($s); +while (($row = oci_fetch_array($s3, OCI_ASSOC+OCI_RETURN_NULLS))) { + foreach ($row as $item) { + echo " ".$item; + } + echo "\n"; +} +oci_free_statement($s3); + +// Clean up + +$stmtarray = array( + "drop procedure imp_res_get_2_proc", + "drop table imp_res_get_2_tab_1", + "drop table imp_res_get_2_tab_2" +); + +oci8_test_sql_execute($c, $stmtarray); + +?> +===DONE=== +<?php exit(0); ?> +--EXPECTF-- +Test 1 + 1 abcde + 2 fghij + 3 klmno + t + u + X +===DONE=== diff --git a/ext/oci8/tests/imp_res_get_3.phpt b/ext/oci8/tests/imp_res_get_3.phpt new file mode 100644 index 000000000..15b2efaef --- /dev/null +++ b/ext/oci8/tests/imp_res_get_3.phpt @@ -0,0 +1,267 @@ +--TEST-- +Oracle Database 12c Implicit Result Sets: oci_get_implicit_resultset: basic test 3 +--SKIPIF-- +<?php +if (!extension_loaded('oci8')) die ("skip no oci8 extension"); +$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); +if (!(isset($matches[0]) && $matches[1] >= 12)) { + die("skip expected output only valid when using Oracle Database 12c or greater"); +} +preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); +if (!(isset($matches[0]) && $matches[0] >= 12)) { + die("skip works only with Oracle 12c or greater version of Oracle client libraries"); +} +?> +--INI-- +oci8.statement_cache_size = 0 +--FILE-- +<?php + +require(dirname(__FILE__).'/connect.inc'); + +// Initialization + +$stmtarray = array( + "drop table imp_res_get_3_tab_1", + "create table imp_res_get_3_tab_1 (c1 number, c2 varchar2(10))", + "insert into imp_res_get_3_tab_1 values (1, 'abcde')", + "insert into imp_res_get_3_tab_1 values (2, 'fghij')", + "insert into imp_res_get_3_tab_1 values (3, 'klmno')", + + "drop table imp_res_get_3_tab_2", + "create table imp_res_get_3_tab_2 (c3 varchar2(1))", + "insert into imp_res_get_3_tab_2 values ('t')", + "insert into imp_res_get_3_tab_2 values ('u')", + "insert into imp_res_get_3_tab_2 values ('v')", + + "create or replace procedure imp_res_get_3_proc as + c1 sys_refcursor; + i pls_integer; + begin + for i in 1..30 loop -- if this value is too big for Oracle's open_cursors, calling imp_res_get_3_proc() can fail with ORA-1000 + open c1 for select * from imp_res_get_3_tab_1 order by 1; + dbms_sql.return_result(c1); + open c1 for select * from imp_res_get_3_tab_2 where rownum < 3 order by 1; + dbms_sql.return_result(c1); + open c1 for select * from dual; + dbms_sql.return_result (c1); + end loop; + end;" +); + +oci8_test_sql_execute($c, $stmtarray); + +// Run Test + +echo "Test 1\n"; + +$s = oci_parse($c, "begin imp_res_get_3_proc(); end;"); +oci_execute($s); + +while (($s1 = oci_get_implicit_resultset($s))) { + while (($row = oci_fetch_array($s1, OCI_ASSOC+OCI_RETURN_NULLS)) != false) { + foreach ($row as $item) { + echo " ".$item; + } + echo "\n"; + } +} + +// Clean up + +$stmtarray = array( + "drop procedure imp_res_get_3_proc", + "drop table imp_res_get_3_tab_1", + "drop table imp_res_get_3_tab_2" +); + +oci8_test_sql_execute($c, $stmtarray); + +?> +===DONE=== +<?php exit(0); ?> +--EXPECTF-- +Test 1 + 1 abcde + 2 fghij + 3 klmno + t + u + X + 1 abcde + 2 fghij + 3 klmno + t + u + X + 1 abcde + 2 fghij + 3 klmno + t + u + X + 1 abcde + 2 fghij + 3 klmno + t + u + X + 1 abcde + 2 fghij + 3 klmno + t + u + X + 1 abcde + 2 fghij + 3 klmno + t + u + X + 1 abcde + 2 fghij + 3 klmno + t + u + X + 1 abcde + 2 fghij + 3 klmno + t + u + X + 1 abcde + 2 fghij + 3 klmno + t + u + X + 1 abcde + 2 fghij + 3 klmno + t + u + X + 1 abcde + 2 fghij + 3 klmno + t + u + X + 1 abcde + 2 fghij + 3 klmno + t + u + X + 1 abcde + 2 fghij + 3 klmno + t + u + X + 1 abcde + 2 fghij + 3 klmno + t + u + X + 1 abcde + 2 fghij + 3 klmno + t + u + X + 1 abcde + 2 fghij + 3 klmno + t + u + X + 1 abcde + 2 fghij + 3 klmno + t + u + X + 1 abcde + 2 fghij + 3 klmno + t + u + X + 1 abcde + 2 fghij + 3 klmno + t + u + X + 1 abcde + 2 fghij + 3 klmno + t + u + X + 1 abcde + 2 fghij + 3 klmno + t + u + X + 1 abcde + 2 fghij + 3 klmno + t + u + X + 1 abcde + 2 fghij + 3 klmno + t + u + X + 1 abcde + 2 fghij + 3 klmno + t + u + X + 1 abcde + 2 fghij + 3 klmno + t + u + X + 1 abcde + 2 fghij + 3 klmno + t + u + X + 1 abcde + 2 fghij + 3 klmno + t + u + X + 1 abcde + 2 fghij + 3 klmno + t + u + X + 1 abcde + 2 fghij + 3 klmno + t + u + X + 1 abcde + 2 fghij + 3 klmno + t + u + X +===DONE=== diff --git a/ext/oci8/tests/imp_res_get_4.phpt b/ext/oci8/tests/imp_res_get_4.phpt new file mode 100644 index 000000000..ea7fb8775 --- /dev/null +++ b/ext/oci8/tests/imp_res_get_4.phpt @@ -0,0 +1,146 @@ +--TEST-- +Oracle Database 12c Implicit Result Sets: oci_get_implicit_resultset: interleaved fetches +--SKIPIF-- +<?php +if (!extension_loaded('oci8')) die ("skip no oci8 extension"); +$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); +if (!(isset($matches[0]) && $matches[1] >= 12)) { + die("skip expected output only valid when using Oracle Database 12c or greater"); +} +preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); +if (!(isset($matches[0]) && $matches[0] >= 12)) { + die("skip works only with Oracle 12c or greater version of Oracle client libraries"); +} +?> +--FILE-- +<?php + +require(dirname(__FILE__).'/connect.inc'); + +// Initialization + +$stmtarray = array( + "drop table imp_res_get_4_tab_1", + "create table imp_res_get_4_tab_1 (c1 number, c2 varchar2(10))", + "insert into imp_res_get_4_tab_1 values (1, 'abcde')", + "insert into imp_res_get_4_tab_1 values (2, 'fghij')", + "insert into imp_res_get_4_tab_1 values (3, 'klmno')", + + "drop table imp_res_get_4_tab_2", + "create table imp_res_get_4_tab_2 (c3 varchar2(1))", + "insert into imp_res_get_4_tab_2 values ('t')", + "insert into imp_res_get_4_tab_2 values ('u')", + "insert into imp_res_get_4_tab_2 values ('v')", + + "create or replace procedure imp_res_get_4_proc as + c1 sys_refcursor; + begin + open c1 for select * from imp_res_get_4_tab_1 order by 1; + dbms_sql.return_result(c1); + + open c1 for select * from imp_res_get_4_tab_2 order by 1; + dbms_sql.return_result(c1); + end;" +); + +oci8_test_sql_execute($c, $stmtarray); + +function print_row($row) +{ + if ($row === false) { + print "Return is false\n"; + return; + } + foreach ($row as $item) { + echo " ".$item; + } + echo "\n"; +} + +// Run Test + +echo "Test 1\n"; + +$s = oci_parse($c, "begin imp_res_get_4_proc(); end;"); +oci_execute($s); +$s1 = oci_get_implicit_resultset($s); +$s2 = oci_get_implicit_resultset($s); +$row = oci_fetch_array($s1, OCI_ASSOC+OCI_RETURN_NULLS); +print_row($row); +$row = oci_fetch_array($s2, OCI_ASSOC+OCI_RETURN_NULLS); +print_row($row); +$row = oci_fetch_array($s1, OCI_ASSOC+OCI_RETURN_NULLS); +print_row($row); +$row = oci_fetch_array($s2, OCI_ASSOC+OCI_RETURN_NULLS); +print_row($row); +$row = oci_fetch_array($s1, OCI_ASSOC+OCI_RETURN_NULLS); +print_row($row); +$row = oci_fetch_array($s2, OCI_ASSOC+OCI_RETURN_NULLS); +print_row($row); + +echo "Test 2 - too many fetches\n"; + +$s = oci_parse($c, "begin imp_res_get_4_proc(); end;"); +oci_execute($s); +$s1 = oci_get_implicit_resultset($s); +$s2 = oci_get_implicit_resultset($s); +$row = oci_fetch_array($s1, OCI_ASSOC+OCI_RETURN_NULLS); +print_row($row); +$row = oci_fetch_array($s2, OCI_ASSOC+OCI_RETURN_NULLS); +print_row($row); +$row = oci_fetch_array($s1, OCI_ASSOC+OCI_RETURN_NULLS); +print_row($row); +$row = oci_fetch_array($s2, OCI_ASSOC+OCI_RETURN_NULLS); +print_row($row); +$row = oci_fetch_array($s1, OCI_ASSOC+OCI_RETURN_NULLS); +print_row($row); +$row = oci_fetch_array($s2, OCI_ASSOC+OCI_RETURN_NULLS); +print_row($row); +$row = oci_fetch_array($s1, OCI_ASSOC+OCI_RETURN_NULLS); +print_row($row); +$row = oci_fetch_array($s2, OCI_ASSOC+OCI_RETURN_NULLS); +print_row($row); +$row = oci_fetch_array($s1, OCI_ASSOC+OCI_RETURN_NULLS); +print_row($row); +$row = oci_fetch_array($s2, OCI_ASSOC+OCI_RETURN_NULLS); +print_row($row); + +// Clean up + +$stmtarray = array( + "drop procedure imp_res_get_4_proc", + "drop table imp_res_get_4_tab_1", + "drop table imp_res_get_4_tab_2" +); + +oci8_test_sql_execute($c, $stmtarray); + +?> +===DONE=== +<?php exit(0); ?> +--EXPECTF-- +Test 1 + 1 abcde + t + 2 fghij + u + 3 klmno + v +Test 2 - too many fetches + 1 abcde + t + 2 fghij + u + 3 klmno + v +Return is false +Return is false + +Warning: oci_fetch_array(): ORA-01002: %s in %simp_res_get_4.php on line %d +Return is false + +Warning: oci_fetch_array(): ORA-01002: %s in %simp_res_get_4.php on line %d +Return is false +===DONE=== diff --git a/ext/oci8/tests/imp_res_get_5.phpt b/ext/oci8/tests/imp_res_get_5.phpt new file mode 100644 index 000000000..3cfa0967a --- /dev/null +++ b/ext/oci8/tests/imp_res_get_5.phpt @@ -0,0 +1,124 @@ +--TEST-- +Oracle Database 12c Implicit Result Sets: oci_get_implicit_resultset: get from wrong statement +--SKIPIF-- +<?php +if (!extension_loaded('oci8')) die ("skip no oci8 extension"); +$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); +if (!(isset($matches[0]) && $matches[1] >= 12)) { + die("skip expected output only valid when using Oracle Database 12c or greater"); +} +preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); +if (!(isset($matches[0]) && $matches[0] >= 12)) { + die("skip works only with Oracle 12c or greater version of Oracle client libraries"); +} +?> +--FILE-- +<?php + +require(dirname(__FILE__).'/connect.inc'); + +function print_row($row) +{ + foreach ($row as $item) { + echo " ".$item; + } + echo "\n"; +} + +$plsql = + "declare + c1 sys_refcursor; + begin + open c1 for select 1 from dual union all select 2 from dual; + dbms_sql.return_result(c1); + open c1 for select 3 from dual union all select 4 from dual; + dbms_sql.return_result(c1); + open c1 for select 5 from dual union all select 6 from dual; + dbms_sql.return_result(c1); + end;"; + +// Run Test + +echo "Test 1\n"; +// This test effectively discards all the first IRS results +$s = oci_parse($c, $plsql); +oci_execute($s); +while (($s1 = oci_get_implicit_resultset($s))) { // $s1 is never used again so its results are lost + while (($row = oci_fetch_array($s, OCI_ASSOC+OCI_RETURN_NULLS)) != false) { // use parent $s instead of $s1 + print_row($row); + } +} +oci_free_statement($s); + +echo "\nTest 2 - fetch first IRS explicitly\n"; +$s = oci_parse($c, $plsql); +oci_execute($s); +$s1 = oci_get_implicit_resultset($s); +while (($row = oci_fetch_row($s1)) != false) { + print_row($row); +} +while (($row = oci_fetch_row($s)) != false) { + print_row($row); +} +oci_free_statement($s); + +echo "\nTest 3 - fetch part of IRS explicitly\n"; +$s = oci_parse($c, $plsql); +oci_execute($s); +$s1 = oci_get_implicit_resultset($s); +while (($row = oci_fetch_row($s1)) != false) { + print_row($row); +} +$row = oci_fetch_row($s); +print_row($row); +$s1 = oci_get_implicit_resultset($s); +while (($row = oci_fetch_row($s1)) != false) { + print_row($row); +} +while (($row = oci_fetch_row($s)) != false) { + print_row($row); +} +oci_free_statement($s); + +echo "\nTest 4 - skip IRSs\n"; +$s = oci_parse($c, $plsql); +oci_execute($s); +$s1 = oci_get_implicit_resultset($s); +$s1 = oci_get_implicit_resultset($s); +while (($row = oci_fetch_row($s)) != false) { // parent + print_row($row); +} +oci_free_statement($s); + +?> +===DONE=== +<?php exit(0); ?> +--EXPECTF-- +Test 1 + 3 + 4 + 5 + 6 + +Test 2 - fetch first IRS explicitly + 1 + 2 + 3 + 4 + 5 + 6 + +Test 3 - fetch part of IRS explicitly + 1 + 2 + 3 + 5 + 6 + 4 + +Test 4 - skip IRSs + 5 + 6 +===DONE=== diff --git a/ext/oci8/tests/imp_res_get_all.phpt b/ext/oci8/tests/imp_res_get_all.phpt new file mode 100644 index 000000000..d2dcbea6c --- /dev/null +++ b/ext/oci8/tests/imp_res_get_all.phpt @@ -0,0 +1,120 @@ +--TEST-- +Oracle Database 12c Implicit Result Sets: oci_get_implicit_resultset: oci_fetch_all +--SKIPIF-- +<?php +if (!extension_loaded('oci8')) die ("skip no oci8 extension"); +$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); +if (!(isset($matches[0]) && $matches[1] >= 12)) { + die("skip expected output only valid when using Oracle Database 12c or greater"); +} +preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); +if (!(isset($matches[0]) && $matches[0] >= 12)) { + die("skip works only with Oracle 12c or greater version of Oracle client libraries"); +} +?> +--FILE-- +<?php + +require(dirname(__FILE__).'/connect.inc'); + +$plsql = "declare + c1 sys_refcursor; + begin + open c1 for select 1 from dual union all select 2 from dual; + dbms_sql.return_result(c1); + open c1 for select 3 from dual union all select 4 from dual; + dbms_sql.return_result(c1); + open c1 for select 5 from dual union all select 6 from dual; + dbms_sql.return_result(c1); + end;"; + +// Run Test + +echo "Test 1\n"; +$s = oci_parse($c, $plsql); +oci_execute($s); + +$s1 = oci_get_implicit_resultset($s); +oci_fetch_all($s1, $res); +var_dump($res); + +$s2 = oci_get_implicit_resultset($s); +oci_fetch_all($s2, $res); +var_dump($res); + +$s3 = oci_get_implicit_resultset($s); +oci_fetch_all($s3, $res); +var_dump($res); + +echo "\nTest 2\n"; +$s = oci_parse($c, $plsql); +oci_execute($s); +while (($s1 = oci_get_implicit_resultset($s))) { + $r = oci_fetch_all($s1, $res); + var_dump($res); +} + +?> +===DONE=== +<?php exit(0); ?> +--EXPECTF-- +Test 1 +array(1) { + [1]=> + array(2) { + [0]=> + string(1) "1" + [1]=> + string(1) "2" + } +} +array(1) { + [3]=> + array(2) { + [0]=> + string(1) "3" + [1]=> + string(1) "4" + } +} +array(1) { + [5]=> + array(2) { + [0]=> + string(1) "5" + [1]=> + string(1) "6" + } +} + +Test 2 +array(1) { + [1]=> + array(2) { + [0]=> + string(1) "1" + [1]=> + string(1) "2" + } +} +array(1) { + [3]=> + array(2) { + [0]=> + string(1) "3" + [1]=> + string(1) "4" + } +} +array(1) { + [5]=> + array(2) { + [0]=> + string(1) "5" + [1]=> + string(1) "6" + } +} +===DONE=== diff --git a/ext/oci8/tests/imp_res_get_cancel.phpt b/ext/oci8/tests/imp_res_get_cancel.phpt new file mode 100644 index 000000000..7dbcecbfe --- /dev/null +++ b/ext/oci8/tests/imp_res_get_cancel.phpt @@ -0,0 +1,56 @@ +--TEST-- +Oracle Database 12c Implicit Result Sets: oci_get_implicit_resultset: oci_cancel +--SKIPIF-- +<?php +if (!extension_loaded('oci8')) die ("skip no oci8 extension"); +$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); +if (!(isset($matches[0]) && $matches[1] >= 12)) { + die("skip expected output only valid when using Oracle Database 12c or greater"); +} +preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); +if (!(isset($matches[0]) && $matches[0] >= 12)) { + die("skip works only with Oracle 12c or greater version of Oracle client libraries"); +} +?> +--FILE-- +<?php + +require(dirname(__FILE__).'/connect.inc'); + +$plsql = + "declare + c1 sys_refcursor; + c2 sys_refcursor; + begin + open c1 for select 1 from dual union all select 2 from dual; + dbms_sql.return_result(c1); + open c2 for select 3 from dual; + dbms_sql.return_result (c2); + end;"; + +// Run Test + +echo "Test 1\n"; +$s = oci_parse($c, $plsql); +oci_execute($s); +while (($s1 = oci_get_implicit_resultset($s))) { + while (($row = oci_fetch_array($s1, OCI_ASSOC+OCI_RETURN_NULLS)) != false) { + foreach ($row as $item) { + echo " ".$item; + } + echo "\n"; + oci_cancel($s1); + } +} + +?> +===DONE=== +<?php exit(0); ?> +--EXPECTF-- +Test 1 + 1 + 3 +===DONE=== + diff --git a/ext/oci8/tests/imp_res_get_close_1.phpt b/ext/oci8/tests/imp_res_get_close_1.phpt new file mode 100644 index 000000000..2edc8bf60 --- /dev/null +++ b/ext/oci8/tests/imp_res_get_close_1.phpt @@ -0,0 +1,68 @@ +--TEST-- +Oracle Database 12c Implicit Result Sets: oci_get_implicit_resultset: oci_free_statement #1 +--SKIPIF-- +<?php +if (!extension_loaded('oci8')) die ("skip no oci8 extension"); +$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); +if (!(isset($matches[0]) && $matches[1] >= 12)) { + die("skip expected output only valid when using Oracle Database 12c or greater"); +} +preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); +if (!(isset($matches[0]) && $matches[0] >= 12)) { + die("skip works only with Oracle 12c or greater version of Oracle client libraries"); +} +?> +--FILE-- +<?php + +require(dirname(__FILE__).'/connect.inc'); + +// Initialization + +$plsql = + "declare + c1 sys_refcursor; + begin + open c1 for select 1 from dual union all select 2 from dual; + dbms_sql.return_result(c1); + open c1 for select 3 from dual union all select 4 from dual; + dbms_sql.return_result(c1); + open c1 for select 5 from dual union all select 6 from dual; + dbms_sql.return_result(c1); + end;"; + +// Run Test + +echo "Test 1\n"; + +$s = oci_parse($c, $plsql); +oci_execute($s); + +while (($s1 = oci_get_implicit_resultset($s))) { + while (($row = oci_fetch_array($s1, OCI_ASSOC+OCI_RETURN_NULLS)) != false) { + foreach ($row as $item) { + echo " ".$item; + } + echo "\n"; + oci_free_statement($s1); // Free the implicit result handle + } +} +oci_free_statement($s); + +?> +===DONE=== +<?php exit(0); ?> +--EXPECTF-- +Test 1 + 1 + +Warning: oci_fetch_array(): %d is not a valid oci8 statement resource in %s on line %d + 3 + +Warning: oci_fetch_array(): %d is not a valid oci8 statement resource in %s on line %d + 5 + +Warning: oci_fetch_array(): %d is not a valid oci8 statement resource in %s on line %d +===DONE=== diff --git a/ext/oci8/tests/imp_res_get_close_2.phpt b/ext/oci8/tests/imp_res_get_close_2.phpt new file mode 100644 index 000000000..b3153834b --- /dev/null +++ b/ext/oci8/tests/imp_res_get_close_2.phpt @@ -0,0 +1,64 @@ +--TEST-- +Oracle Database 12c Implicit Result Sets: oci_get_implicit_resultset: oci_free_statement #2 +--SKIPIF-- +<?php +if (!extension_loaded('oci8')) die ("skip no oci8 extension"); +$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); +if (!(isset($matches[0]) && $matches[1] >= 12)) { + die("skip expected output only valid when using Oracle Database 12c or greater"); +} +preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); +if (!(isset($matches[0]) && $matches[0] >= 12)) { + die("skip works only with Oracle 12c or greater version of Oracle client libraries"); +} +?> +--FILE-- +<?php + +require(dirname(__FILE__).'/connect.inc'); + +// Initialization + +$plsql = + "declare + c1 sys_refcursor; + begin + open c1 for select 1 from dual union all select 2 from dual; + dbms_sql.return_result(c1); + open c1 for select 3 from dual union all select 4 from dual; + dbms_sql.return_result(c1); + open c1 for select 5 from dual union all select 6 from dual; + dbms_sql.return_result(c1); + end;"; + +// Run Test + +echo "Test 1\n"; + +$s = oci_parse($c, $plsql); +oci_execute($s); + +while (($s1 = oci_get_implicit_resultset($s))) { + while (($row = oci_fetch_array($s1, OCI_ASSOC+OCI_RETURN_NULLS)) != false) { + foreach ($row as $item) { + echo " ".$item; + } + echo "\n"; + oci_free_statement($s); // close parent + } +} + +?> +===DONE=== +<?php exit(0); ?> +--EXPECTF-- +Test 1 + 1 + 2 + +Warning: oci_fetch_array(): OCI_INVALID_HANDLE in %s on line %d + +Warning: oci_get_implicit_resultset(): %d is not a valid oci8 statement resource in %s on line %d +===DONE=== diff --git a/ext/oci8/tests/imp_res_get_close_3.phpt b/ext/oci8/tests/imp_res_get_close_3.phpt new file mode 100644 index 000000000..4793a6c88 --- /dev/null +++ b/ext/oci8/tests/imp_res_get_close_3.phpt @@ -0,0 +1,65 @@ +--TEST-- +Oracle Database 12c Implicit Result Sets: oci_get_implicit_resultset: oci_free_statement #3 +--SKIPIF-- +<?php +if (!extension_loaded('oci8')) die ("skip no oci8 extension"); +$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); +if (!(isset($matches[0]) && $matches[1] >= 12)) { + die("skip expected output only valid when using Oracle Database 12c or greater"); +} +preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); +if (!(isset($matches[0]) && $matches[0] >= 12)) { + die("skip works only with Oracle 12c or greater version of Oracle client libraries"); +} +?> +--FILE-- +<?php + +require(dirname(__FILE__).'/connect.inc'); + +// Initialization + +$plsql = + "declare + c1 sys_refcursor; + begin + open c1 for select 1 from dual union all select 2 from dual; + dbms_sql.return_result(c1); + open c1 for select 3 from dual union all select 4 from dual; + dbms_sql.return_result(c1); + open c1 for select 5 from dual union all select 6 from dual; + dbms_sql.return_result(c1); + end;"; + +// Run Test + +echo "Test 1\n"; + +$s = oci_parse($c, $plsql); +oci_execute($s); + +while (($s1 = oci_get_implicit_resultset($s))) { + while (($row = oci_fetch_array($s1, OCI_ASSOC+OCI_RETURN_NULLS)) != false) { + foreach ($row as $item) { + echo " ".$item; + } + echo "\n"; + } + oci_free_statement($s1); +} +oci_free_statement($s); + +?> +===DONE=== +<?php exit(0); ?> +--EXPECTF-- +Test 1 + 1 + 2 + 3 + 4 + 5 + 6 +===DONE=== diff --git a/ext/oci8/tests/imp_res_get_cursor.phpt b/ext/oci8/tests/imp_res_get_cursor.phpt new file mode 100644 index 000000000..ccdb6f549 --- /dev/null +++ b/ext/oci8/tests/imp_res_get_cursor.phpt @@ -0,0 +1,101 @@ +--TEST-- +Oracle Database 12c Implicit Result Sets: oci_get_implicit_resultset: nested cursor +--SKIPIF-- +<?php +if (!extension_loaded('oci8')) die ("skip no oci8 extension"); +$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); +if (!(isset($matches[0]) && $matches[1] >= 12)) { + die("skip expected output only valid when using Oracle Database 12c or greater"); +} +preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); +if (!(isset($matches[0]) && $matches[0] >= 12)) { + die("skip works only with Oracle 12c or greater version of Oracle client libraries"); +} +?> +--FILE-- +<?php + +require(dirname(__FILE__).'/connect.inc'); + +// Initialization + +$stmtarray = array( + "drop table imp_res_get_cursor_tab_1", + "create table imp_res_get_cursor_tab_1 (c1 number, c2 varchar2(10))", + "insert into imp_res_get_cursor_tab_1 values (1, 'abcde')", + "insert into imp_res_get_cursor_tab_1 values (2, 'fghij')", + "insert into imp_res_get_cursor_tab_1 values (3, 'klmno')", + + "drop table imp_res_get_cursor_tab_2", + "create table imp_res_get_cursor_tab_2 (c3 varchar2(1))", + "insert into imp_res_get_cursor_tab_2 values ('t')", + "insert into imp_res_get_cursor_tab_2 values ('u')", + "insert into imp_res_get_cursor_tab_2 values ('v')", + + "create or replace procedure imp_res_get_cursor_proc as + c1 sys_refcursor; + begin + open c1 for select cursor(select c1, c2 from imp_res_get_cursor_tab_1 order by 1) as curs from dual; + dbms_sql.return_result(c1); + + open c1 for select * from imp_res_get_cursor_tab_2 where rownum < 3 order by 1; + dbms_sql.return_result(c1); + + open c1 for select * from dual; + dbms_sql.return_result (c1); + end;" +); + +oci8_test_sql_execute($c, $stmtarray); + +function do_fetch($s) +{ + while (($row = oci_fetch_assoc($s)) != false) { + foreach ($row as $item) { + if (is_resource($item)) { // Nested cursor + oci_execute($item); + do_fetch($item); + } else { + echo " ".$item; + } + } + echo "\n"; + } +} + +// Run Test + +echo "Test 1\n"; + +$s = oci_parse($c, "begin imp_res_get_cursor_proc(); end;"); +oci_execute($s); + +while (($s1 = oci_get_implicit_resultset($s))) { + do_fetch($s1); +} + +// Clean up + +$stmtarray = array( + "drop procedure imp_res_get_cursor_proc", + "drop table imp_res_get_cursor_tab_1", + "drop table imp_res_get_cursor_tab_2" +); + +oci8_test_sql_execute($c, $stmtarray); + +?> +===DONE=== +<?php exit(0); ?> +--EXPECTF-- +Test 1 + 1 abcde + 2 fghij + 3 klmno + + t + u + X +===DONE=== diff --git a/ext/oci8/tests/imp_res_get_dbmsoutput.phpt b/ext/oci8/tests/imp_res_get_dbmsoutput.phpt new file mode 100644 index 000000000..cbc2389e4 --- /dev/null +++ b/ext/oci8/tests/imp_res_get_dbmsoutput.phpt @@ -0,0 +1,156 @@ +--TEST-- +Oracle Database 12c Implicit Result Sets: oci_get_implicit_resultset: interleaved with DBMS_OUTPUT +--SKIPIF-- +<?php +if (!extension_loaded('oci8')) die ("skip no oci8 extension"); +$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); +if (!(isset($matches[0]) && $matches[1] >= 12)) { + die("skip expected output only valid when using Oracle Database 12c or greater"); +} +preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); +if (!(isset($matches[0]) && $matches[0] >= 12)) { + die("skip works only with Oracle 12c or greater version of Oracle client libraries"); +} +?> +--FILE-- +<?php + +require(dirname(__FILE__).'/connect.inc'); + +// Initialization + +$stmtarray = array( + "drop table imp_res_get_dbmsoutput_tab_1", + "create table imp_res_get_dbmsoutput_tab_1 (c1 number, c2 varchar2(10))", + "insert into imp_res_get_dbmsoutput_tab_1 values (1, 'abcde')", + "insert into imp_res_get_dbmsoutput_tab_1 values (2, 'fghij')", + "insert into imp_res_get_dbmsoutput_tab_1 values (3, 'klmno')", + + "drop table imp_res_get_dbmsoutput_tab_2", + "create table imp_res_get_dbmsoutput_tab_2 (c3 varchar2(1))", + "insert into imp_res_get_dbmsoutput_tab_2 values ('t')", + "insert into imp_res_get_dbmsoutput_tab_2 values ('u')", + "insert into imp_res_get_dbmsoutput_tab_2 values ('v')", + + "create or replace procedure imp_res_get_dbmsoutput_proc as + c1 sys_refcursor; + begin + dbms_output.put_line('Line 1'); + open c1 for select * from imp_res_get_dbmsoutput_tab_1 order by 1; + dbms_sql.return_result(c1); + dbms_output.put_line('Line 2'); + open c1 for select * from imp_res_get_dbmsoutput_tab_2 order by 1; + dbms_sql.return_result(c1); + dbms_output.put_line('Line 3'); + open c1 for select * from dual; + dbms_sql.return_result (c1); + end;" +); + +oci8_test_sql_execute($c, $stmtarray); + +// Turn DBMS_OUTPUT on +function setserveroutputon($c) +{ + $s = oci_parse($c, "begin dbms_output.enable(null); end;"); + oci_execute($s); +} + +function getdbmsoutput_do($c) +{ + $s = oci_parse($c, "begin dbms_output.get_line(:ln, :st); end;"); + oci_bind_by_name($s, ":ln", $ln, 100); + oci_bind_by_name($s, ":st", $st, -1, SQLT_INT); + $res = false; + while (($succ = oci_execute($s)) && !$st) { + $res[] = $ln; // append each line to the array + } + return $res; +} + +setserveroutputon($c); + +// Run Test + +echo "Test 1\n"; + +$s = oci_parse($c, "begin imp_res_get_dbmsoutput_proc(); end;"); +oci_execute($s); + +var_dump(getdbmsoutput_do($c)); + +while (($s1 = oci_get_implicit_resultset($s))) { + while (($row = oci_fetch_array($s1, OCI_ASSOC+OCI_RETURN_NULLS)) != false) { + foreach ($row as $item) { + echo " ".$item; + } + echo "\n"; + } +} + +echo "Test 2\n"; + +$s = oci_parse($c, "begin imp_res_get_dbmsoutput_proc(); end;"); +oci_execute($s); + +while (($s1 = oci_get_implicit_resultset($s))) { + while (($row = oci_fetch_array($s1, OCI_ASSOC+OCI_RETURN_NULLS)) != false) { + foreach ($row as $item) { + echo " ".$item; + } + echo "\n"; + } +} + +var_dump(getdbmsoutput_do($c)); + +// Clean up + +$stmtarray = array( + "drop procedure imp_res_get_dbmsoutput_proc", + "drop table imp_res_get_dbmsoutput_tab_1", + "drop table imp_res_get_dbmsoutput_tab_2" +); + +oci8_test_sql_execute($c, $stmtarray); + +?> +===DONE=== +<?php exit(0); ?> +--EXPECTF-- +Test 1 +array(3) { + [0]=> + string(6) "Line 1" + [1]=> + string(6) "Line 2" + [2]=> + string(6) "Line 3" +} + 1 abcde + 2 fghij + 3 klmno + t + u + v + X +Test 2 + 1 abcde + 2 fghij + 3 klmno + t + u + v + X +array(3) { + [0]=> + string(6) "Line 1" + [1]=> + string(6) "Line 2" + [2]=> + string(6) "Line 3" +} +===DONE=== + diff --git a/ext/oci8/tests/imp_res_get_exec.phpt b/ext/oci8/tests/imp_res_get_exec.phpt new file mode 100644 index 000000000..dbd8f3ef3 --- /dev/null +++ b/ext/oci8/tests/imp_res_get_exec.phpt @@ -0,0 +1,55 @@ +--TEST-- +Oracle Database 12c Implicit Result Sets: oci_get_implicit_resultset: Execute twice +--SKIPIF-- +<?php +if (!extension_loaded('oci8')) die ("skip no oci8 extension"); +$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); +if (!(isset($matches[0]) && $matches[1] >= 12)) { + die("skip expected output only valid when using Oracle Database 12c or greater"); +} +preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); +if (!(isset($matches[0]) && $matches[0] >= 12)) { + die("skip works only with Oracle 12c or greater version of Oracle client libraries"); +} +?> +--FILE-- +<?php + +require(dirname(__FILE__).'/connect.inc'); + +$plsql = "declare + c1 sys_refcursor; + begin + open c1 for select 1 from dual union all select 2 from dual; + dbms_sql.return_result(c1); + end;"; + +// Run Test + +echo "Test 1\n"; + +$s = oci_parse($c, $plsql); +oci_execute($s); + +$s1 = oci_get_implicit_resultset($s); +oci_execute($s1); +oci_execute($s1); // execute twice; should be NOP +while (($row = oci_fetch_array($s1, OCI_ASSOC+OCI_RETURN_NULLS)) != false) { + foreach ($row as $item) { + echo " ".$item; + } + echo "\n"; +} +oci_free_statement($s); + + +?> +===DONE=== +<?php exit(0); ?> +--EXPECTF-- +Test 1 + 1 + 2 +===DONE=== diff --git a/ext/oci8/tests/imp_res_get_none.phpt b/ext/oci8/tests/imp_res_get_none.phpt new file mode 100644 index 000000000..981f4945e --- /dev/null +++ b/ext/oci8/tests/imp_res_get_none.phpt @@ -0,0 +1,46 @@ +--TEST-- +Oracle Database 12c Implicit Result Sets: oci_get_implicit_resultset: no implicit results +--SKIPIF-- +<?php +if (!extension_loaded('oci8')) die ("skip no oci8 extension"); +$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); +if (!(isset($matches[0]) && $matches[1] >= 12)) { + die("skip expected output only valid when using Oracle Database 12c or greater"); +} +preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); +if (!(isset($matches[0]) && $matches[0] >= 12)) { + die("skip works only with Oracle 12c or greater version of Oracle client libraries"); +} +?> +--FILE-- +<?php + +require(dirname(__FILE__).'/connect.inc'); + +// Run Test + +echo "Test 1\n"; + +$s = oci_parse($c, "select * from dual"); +oci_execute($s); + +while (($s1 = oci_get_implicit_resultset($s))) { + while (($row = oci_fetch_array($s1, OCI_ASSOC+OCI_RETURN_NULLS)) != false) { + foreach ($row as $item) { + echo " ".$item; + } + echo "\n"; + } +} + +var_dump($s1); + +?> +===DONE=== +<?php exit(0); ?> +--EXPECTF-- +Test 1 +bool(false) +===DONE=== diff --git a/ext/oci8/tests/imp_res_insert.phpt b/ext/oci8/tests/imp_res_insert.phpt new file mode 100644 index 000000000..d9c0705b5 --- /dev/null +++ b/ext/oci8/tests/imp_res_insert.phpt @@ -0,0 +1,152 @@ +--TEST-- +Oracle Database 12c Implicit Result Sets: Commit modes +--SKIPIF-- +<?php +if (!extension_loaded('oci8')) die ("skip no oci8 extension"); +$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); +if (!(isset($matches[0]) && $matches[1] >= 12)) { + die("skip expected output only valid when using Oracle Database 12c or greater"); +} +preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); +if (!(isset($matches[0]) && $matches[0] >= 12)) { + die("skip works only with Oracle 12c or greater version of Oracle client libraries"); +} +?> +--FILE-- +<?php + +require(dirname(__FILE__).'/connect.inc'); + +// Initialization + +$c2 = oci_new_connect($user, $password, $dbase); + +$stmtarray = array( + "drop table imp_res_insert_tab", + "create table imp_res_insert_tab (c1 number)", + + "create or replace procedure imp_res_insert_proc_nc (p1 in number) as + c1 sys_refcursor; + begin + execute immediate 'insert into imp_res_insert_tab values ('||p1||')'; + open c1 for select * from imp_res_insert_tab order by 1; + dbms_sql.return_result(c1); + end;", + + "create or replace procedure imp_res_insert_proc_c (p1 in number) as + c1 sys_refcursor; + begin + execute immediate 'insert into imp_res_insert_tab values ('||p1||')'; + commit; + open c1 for select * from imp_res_insert_tab order by 1; + dbms_sql.return_result(c1); + end;" + +); + +oci8_test_sql_execute($c, $stmtarray); + +// Run Test + +echo "Test 1 - No commit in procedure, OCI_COMMIT_ON_SUCCESS mode\n"; +$s = oci_parse($c, "begin imp_res_insert_proc_nc(111); end;"); +oci_execute($s, OCI_COMMIT_ON_SUCCESS); +while (($row = oci_fetch_row($s)) !== false) + echo $row[0], "\n"; +$s2 = oci_parse($c2, "select * from imp_res_insert_tab order by 1"); +oci_execute($s2, OCI_NO_AUTO_COMMIT); +oci_fetch_all($s2, $res); +var_dump($res['C1']); + +echo "\nTest 2 - No commit in procedure, OCI_NO_AUTO_COMMIT mode\n"; +$s = oci_parse($c, "begin imp_res_insert_proc_nc(222); end;"); +oci_execute($s, OCI_NO_AUTO_COMMIT); +while (($row = oci_fetch_row($s)) !== false) + echo $row[0], "\n"; +// The 2nd connection won't see the newly inserted data +$s2 = oci_parse($c2, "select * from imp_res_insert_tab order by 1"); +oci_execute($s2, OCI_NO_AUTO_COMMIT); +oci_fetch_all($s2, $res); +var_dump($res['C1']); + +echo "\nTest 3 - Commit in procedure, OCI_COMMIT_ON_SUCCESS mode\n"; +$s = oci_parse($c, "begin imp_res_insert_proc_c(333); end;"); +oci_execute($s, OCI_COMMIT_ON_SUCCESS); +// The 2nd connection will now see the previously uncommitted data inserted in the previous test +while (($row = oci_fetch_row($s)) !== false) + echo $row[0], "\n"; +$s2 = oci_parse($c2, "select * from imp_res_insert_tab order by 1"); +oci_execute($s2, OCI_NO_AUTO_COMMIT); +oci_fetch_all($s2, $res); +var_dump($res['C1']); + +echo "\nTest 4 - Commit in procedure, OCI_NO_AUTO_COMMIT mode\n"; +$s = oci_parse($c, "begin imp_res_insert_proc_c(444); end;"); +oci_execute($s, OCI_NO_AUTO_COMMIT); +while (($row = oci_fetch_row($s)) !== false) + echo $row[0], "\n"; +$s2 = oci_parse($c2, "select * from imp_res_insert_tab order by 1"); +oci_execute($s2, OCI_NO_AUTO_COMMIT); +oci_fetch_all($s2, $res); +var_dump($res['C1']); + +// Clean up + +$stmtarray = array( + "drop procedure imp_res_insert_proc_nc", + "drop procedure imp_res_insert_proc_c", + "drop table imp_res_insert_tab", +); + +oci8_test_sql_execute($c, $stmtarray); + +?> +===DONE=== +<?php exit(0); ?> +--EXPECTF-- +Test 1 - No commit in procedure, OCI_COMMIT_ON_SUCCESS mode +111 +array(1) { + [0]=> + string(3) "111" +} + +Test 2 - No commit in procedure, OCI_NO_AUTO_COMMIT mode +111 +222 +array(1) { + [0]=> + string(3) "111" +} + +Test 3 - Commit in procedure, OCI_COMMIT_ON_SUCCESS mode +111 +222 +333 +array(3) { + [0]=> + string(3) "111" + [1]=> + string(3) "222" + [2]=> + string(3) "333" +} + +Test 4 - Commit in procedure, OCI_NO_AUTO_COMMIT mode +111 +222 +333 +444 +array(4) { + [0]=> + string(3) "111" + [1]=> + string(3) "222" + [2]=> + string(3) "333" + [3]=> + string(3) "444" +} +===DONE=== diff --git a/ext/oci8/tests/imp_res_lob.phpt b/ext/oci8/tests/imp_res_lob.phpt new file mode 100644 index 000000000..247803581 --- /dev/null +++ b/ext/oci8/tests/imp_res_lob.phpt @@ -0,0 +1,101 @@ +--TEST-- +Oracle Database 12c Implicit Result Sets: LOBs +--SKIPIF-- +<?php +if (!extension_loaded('oci8')) die ("skip no oci8 extension"); +$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); +if (!(isset($matches[0]) && $matches[1] >= 12)) { + die("skip expected output only valid when using Oracle Database 12c or greater"); +} +preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); +if (!(isset($matches[0]) && $matches[0] >= 12)) { + die("skip works only with Oracle 12c or greater version of Oracle client libraries"); +} +?> +--FILE-- +<?php + +require(dirname(__FILE__).'/connect.inc'); + +// Initialization + +$stmtarray = array( + "drop table imp_res_lob_tab", + "create table imp_res_lob_tab (c1 number, c2 clob, c3 varchar2(10))", + "insert into imp_res_lob_tab values (1, 'aaaaa', 'a')", + "insert into imp_res_lob_tab values (2, 'bbbbb', 'b')", + "insert into imp_res_lob_tab values (3, 'ccccc', 'c')", + "insert into imp_res_lob_tab values (4, 'ddddd', 'd')", + + "create or replace procedure imp_res_lob_proc as + c1 sys_refcursor; + begin + open c1 for select * from imp_res_lob_tab order by 1; + dbms_sql.return_result(c1); + open c1 for select * from dual; + dbms_sql.return_result(c1); + open c1 for select c2 from imp_res_lob_tab order by c1; + dbms_sql.return_result(c1); + end;" +); + +oci8_test_sql_execute($c, $stmtarray); + +// Run Test + +echo "Test 1\n"; +$s = oci_parse($c, "begin imp_res_lob_proc(); end;"); +oci_execute($s); +while (($row = oci_fetch_row($s)) != false) { + foreach ($row as $item) { + if (is_object($item)) { + echo " " . $item->load(); + } else { + echo " " . $item; + } + } + echo "\n"; +} + +echo "\nTest 2 - don't fetch all rows\n"; +$s = oci_parse($c, "begin imp_res_lob_proc(); end;"); +oci_execute($s); +$row = oci_fetch_row($s); +foreach ($row as $item) { + if (is_object($item)) { + echo " " . $item->load(); + } else { + echo " " . $item; + } +} +echo "\n"; + +// Clean up + +$stmtarray = array( + "drop procedure imp_res_lob_proc", + "drop table imp_res_lob_tab", +); + +oci8_test_sql_execute($c, $stmtarray); + +?> +===DONE=== +<?php exit(0); ?> +--EXPECTF-- +Test 1 + 1 aaaaa a + 2 bbbbb b + 3 ccccc c + 4 ddddd d + X + aaaaa + bbbbb + ccccc + ddddd + +Test 2 - don't fetch all rows + 1 aaaaa a +===DONE=== diff --git a/ext/oci8/tests/imp_res_prefetch.phpt b/ext/oci8/tests/imp_res_prefetch.phpt new file mode 100644 index 000000000..5acdd518e --- /dev/null +++ b/ext/oci8/tests/imp_res_prefetch.phpt @@ -0,0 +1,185 @@ +--TEST-- +Oracle Database 12c Implicit Result Sets: basic test +--SKIPIF-- +<?php +if (!extension_loaded('oci8')) die ("skip no oci8 extension"); +$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); +if (!(isset($matches[0]) && $matches[1] >= 12)) { + die("skip expected output only valid when using Oracle Database 12c or greater"); +} +preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); +if (!(isset($matches[0]) && $matches[0] >= 12)) { + die("skip works only with Oracle 12c or greater version of Oracle client libraries"); +} +?> +--FILE-- +<?php + +require(dirname(__FILE__).'/connect.inc'); + +// Initialization + +$stmtarray = array( + "drop table imp_res_prefetch_tab_1", + "create table imp_res_prefetch_tab_1 (c1 number, c2 varchar2(10))", + "insert into imp_res_prefetch_tab_1 values (1, 'abcde')", + "insert into imp_res_prefetch_tab_1 values (2, 'fghij')", + "insert into imp_res_prefetch_tab_1 values (3, 'klmno')", + + "drop table imp_res_prefetch_tab_2", + "create table imp_res_prefetch_tab_2 (c3 varchar2(1))", + "insert into imp_res_prefetch_tab_2 values ('t')", + "insert into imp_res_prefetch_tab_2 values ('u')", + "insert into imp_res_prefetch_tab_2 values ('v')", + + "create or replace procedure imp_res_prefetch_proc as + c1 sys_refcursor; + begin + open c1 for select * from imp_res_prefetch_tab_1 order by 1; + dbms_sql.return_result(c1); + + open c1 for select * from imp_res_prefetch_tab_2 order by 1; + dbms_sql.return_result(c1); + end;" +); + +oci8_test_sql_execute($c, $stmtarray); + +// Run Test + +echo "Test 1 - prefetch 0\n"; +$s = oci_parse($c, "begin imp_res_prefetch_proc(); end;"); +oci_execute($s); +var_dump(oci_set_prefetch($s, 0)); +while (($row = oci_fetch_row($s)) != false) + var_dump($row); + +echo "\nTest 1 - prefetch 1\n"; +$s = oci_parse($c, "begin imp_res_prefetch_proc(); end;"); +oci_execute($s); +var_dump(oci_set_prefetch($s, 1)); +while (($row = oci_fetch_row($s)) != false) + var_dump($row); + +echo "\nTest 1 - prefetch 2\n"; +$s = oci_parse($c, "begin imp_res_prefetch_proc(); end;"); +oci_execute($s); +var_dump(oci_set_prefetch($s, 2)); +while (($row = oci_fetch_row($s)) != false) + var_dump($row); + +// Clean up + +$stmtarray = array( + "drop procedure imp_res_prefetch_proc", + "drop table imp_res_prefetch_tab_1", + "drop table imp_res_prefetch_tab_2" +); + +oci8_test_sql_execute($c, $stmtarray); + +?> +===DONE=== +<?php exit(0); ?> +--EXPECTF-- +Test 1 - prefetch 0 +bool(true) +array(2) { + [0]=> + string(1) "1" + [1]=> + string(5) "abcde" +} +array(2) { + [0]=> + string(1) "2" + [1]=> + string(5) "fghij" +} +array(2) { + [0]=> + string(1) "3" + [1]=> + string(5) "klmno" +} +array(1) { + [0]=> + string(1) "t" +} +array(1) { + [0]=> + string(1) "u" +} +array(1) { + [0]=> + string(1) "v" +} + +Test 1 - prefetch 1 +bool(true) +array(2) { + [0]=> + string(1) "1" + [1]=> + string(5) "abcde" +} +array(2) { + [0]=> + string(1) "2" + [1]=> + string(5) "fghij" +} +array(2) { + [0]=> + string(1) "3" + [1]=> + string(5) "klmno" +} +array(1) { + [0]=> + string(1) "t" +} +array(1) { + [0]=> + string(1) "u" +} +array(1) { + [0]=> + string(1) "v" +} + +Test 1 - prefetch 2 +bool(true) +array(2) { + [0]=> + string(1) "1" + [1]=> + string(5) "abcde" +} +array(2) { + [0]=> + string(1) "2" + [1]=> + string(5) "fghij" +} +array(2) { + [0]=> + string(1) "3" + [1]=> + string(5) "klmno" +} +array(1) { + [0]=> + string(1) "t" +} +array(1) { + [0]=> + string(1) "u" +} +array(1) { + [0]=> + string(1) "v" +} +===DONE=== diff --git a/ext/oci8/tests/ini_1.phpt b/ext/oci8/tests/ini_1.phpt index 4c23b72b4..2fba79813 100644 --- a/ext/oci8/tests/ini_1.phpt +++ b/ext/oci8/tests/ini_1.phpt @@ -1,7 +1,13 @@ --TEST-- Test OCI8 php.ini settings --SKIPIF-- -<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?> +<?php +if (!extension_loaded('oci8')) die ("skip no oci8 extension"); +preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); +if (!(isset($matches[0]) && $matches[0] >= 11)) { + die("skip works only with Oracle 11g or greater version of Oracle client libraries"); +} +?> --INI-- oci8.privileged_connect = On oci8.max_persistent = 111 diff --git a/ext/oci8/tests/lob_015.phpt b/ext/oci8/tests/lob_015.phpt index b4a19684a..59e8fec42 100644 --- a/ext/oci8/tests/lob_015.phpt +++ b/ext/oci8/tests/lob_015.phpt @@ -48,7 +48,7 @@ Warning: oci_bind_by_name() expects at least 3 parameters, 2 given in %s on line Warning: oci_bind_by_name() expects at least 3 parameters, 1 given in %s on line %d -Warning: oci_execute(): ORA-00932: %s NUMBER %s BLOB in %s on line %d +Warning: oci_execute(): ORA-00932: %s on line %d object(OCI-Lob)#%d (1) { ["descriptor"]=> resource(%d) of type (oci8 descriptor) diff --git a/ext/oci8/tests/lob_temp2.phpt b/ext/oci8/tests/lob_temp2.phpt new file mode 100644 index 000000000..d774b4d72 --- /dev/null +++ b/ext/oci8/tests/lob_temp2.phpt @@ -0,0 +1,40 @@ +--TEST-- +Writing temporary lob before binding +--SKIPIF-- +<?php +if (!extension_loaded('oci8')) die ("skip no oci8 extension"); +$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs +require(dirname(__FILE__).'/skipif.inc'); +?> +--FILE-- +<?php + +require(dirname(__FILE__).'/connect.inc'); +require(dirname(__FILE__).'/create_table.inc'); + +$ora_sql = "INSERT INTO ".$schema.$table_name." (clob) VALUES (:v_clob)"; + +$clob = oci_new_descriptor($c, OCI_D_LOB); +var_dump($clob->writeTemporary("test")); + +$statement = oci_parse($c, $ora_sql); +oci_bind_by_name($statement, ":v_clob", $clob, -1, OCI_B_CLOB); +oci_execute($statement, OCI_DEFAULT); + +$s = oci_parse($c, "select clob from ". $schema.$table_name); +oci_execute($s); +oci_fetch_all($s, $res); +var_dump($res); + +?> +===DONE=== +--EXPECTF-- +bool(true) +array(1) { + ["CLOB"]=> + array(1) { + [0]=> + string(4) "test" + } +} +===DONE=== diff --git a/ext/oci8/tests/minfo.phpt b/ext/oci8/tests/minfo.phpt index f6b95ff29..34a19ca69 100644 --- a/ext/oci8/tests/minfo.phpt +++ b/ext/oci8/tests/minfo.phpt @@ -8,12 +8,12 @@ Code coverage for PHP_MINFO_FUNCTION(oci) ob_start(); phpinfo(INFO_MODULES); $v = ob_get_clean(); -$r = strpos($v, 'OCI8 Support => enabled'); -var_dump($r); +$r = preg_match('/OCI8 Support .* enabled/', $v); +if ($r !== 1) + var_dump($r); echo "Done\n"; ?> --EXPECTF-- -int(%d) Done diff --git a/ext/oci8/tests/password.phpt b/ext/oci8/tests/password.phpt index 1738702cb..8ea81d3fc 100644 --- a/ext/oci8/tests/password.phpt +++ b/ext/oci8/tests/password.phpt @@ -14,28 +14,28 @@ if ($test_drcp) die("skip password change not supported in DRCP Mode"); require(dirname(__FILE__)."/connect.inc"); $stmtarray = array( - "drop user testuser cascade", - "create user testuser identified by testuserpwd", - "grant connect, create session to testuser" + "drop user testuser_pw cascade", + "create user testuser_pw identified by testuserpwd", + "grant connect, create session to testuser_pw" ); oci8_test_sql_execute($c, $stmtarray); // Connect and change the password -$c1 = oci_connect("testuser", "testuserpwd", $dbase); +$c1 = oci_connect("testuser_pw", "testuserpwd", $dbase); var_dump($c1); $rn1 = (int)$c1; -oci_password_change($c1, "testuser", "testuserpwd", "testuserpwd2"); +oci_password_change($c1, "testuser_pw", "testuserpwd", "testuserpwd2"); // Second connect should return a new resource because the hash string will be different from $c1 -$c2 = oci_connect("testuser", "testuserpwd2", $dbase); +$c2 = oci_connect("testuser_pw", "testuserpwd2", $dbase); var_dump($c2); $rn2 = (int)$c2; // Despite using the old password this connect should succeed and return the original resource -$c3 = oci_connect("testuser", "testuserpwd", $dbase); +$c3 = oci_connect("testuser_pw", "testuserpwd", $dbase); var_dump($c3); $rn3 = (int)$c3; @@ -67,7 +67,7 @@ echo "Done\n"; require(dirname(__FILE__)."/connect.inc"); $stmtarray = array( - "drop user testuser cascade" + "drop user testuser_pw cascade" ); oci8_test_sql_execute($c, $stmtarray); diff --git a/ext/oci8/tests/password_2.phpt b/ext/oci8/tests/password_2.phpt index ceba0bba8..13da9ff7b 100644 --- a/ext/oci8/tests/password_2.phpt +++ b/ext/oci8/tests/password_2.phpt @@ -14,27 +14,27 @@ if ($test_drcp) die("skip password change not supported in DRCP Mode"); require(dirname(__FILE__)."/connect.inc"); $stmtarray = array( - "drop user testuser cascade", - "create user testuser identified by testuserpwd", - "grant connect, create session to testuser" + "drop user testuser_pw2 cascade", + "create user testuser_pw2 identified by testuserpwd", + "grant connect, create session to testuser_pw2" ); oci8_test_sql_execute($c, $stmtarray); // Connect (persistent) and change the password -$c1 = oci_pconnect("testuser", "testuserpwd", $dbase); +$c1 = oci_pconnect("testuser_pw2", "testuserpwd", $dbase); var_dump($c1); $rn1 = (int)$c1; -oci_password_change($c1, "testuser", "testuserpwd", "testuserpwd2"); +oci_password_change($c1, "testuser_pw2", "testuserpwd", "testuserpwd2"); // Second connect should return a new resource because the hash string will be different from $c1 -$c2 = oci_pconnect("testuser", "testuserpwd2", $dbase); +$c2 = oci_pconnect("testuser_pw2", "testuserpwd2", $dbase); var_dump($c2); $rn2 = (int)$c2; // Despite using the old password this connect should succeed and return the original resource -$c3 = oci_pconnect("testuser", "testuserpwd", $dbase); +$c3 = oci_pconnect("testuser_pw2", "testuserpwd", $dbase); var_dump($c3); $rn3 = (int)$c3; @@ -66,7 +66,7 @@ echo "Done\n"; require(dirname(__FILE__)."/connect.inc"); $stmtarray = array( - "drop user testuser cascade" + "drop user testuser_pw2 cascade" ); oci8_test_sql_execute($c, $stmtarray); diff --git a/ext/oci8/tests/password_new.phpt b/ext/oci8/tests/password_new.phpt index c218d904f..a29fb8f52 100644 --- a/ext/oci8/tests/password_new.phpt +++ b/ext/oci8/tests/password_new.phpt @@ -3,36 +3,40 @@ oci_password_change() --SKIPIF-- <?php $target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on thes -require(dirname(__FILE__).'/skipif.inc'); +require(dirname(__FILE__).'/connect.inc'); if (empty($dbase)) die ("skip requires database connection string be set"); if ($test_drcp) die("skip password change not supported in DRCP Mode"); -// This test is known to fail with Oracle 10.2.0.4 client libraries -// connecting to Oracle Database 11 (Oracle bug 6277160, fixed 10.2.0.5) -if (preg_match('/Release (11|12)\./', oci_server_version($c), $matches) === 1 && - preg_match('/^10\.2\.0\.[1234]/', oci_client_version()) === 1) { - die ("skip test known to fail using Oracle 10.2.0.4 client libs connecting to Oracle 11 (6277160)"); +preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches_sv); +preg_match('/([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)/', oci_client_version(), $matches); +if (!(isset($matches_sv[0]) && isset($matches[0]) + && $matches_sv[1] == $matches[1] + && $matches_sv[2] == $matches[2] + && $matches_sv[3] == $matches[3] + && $matches_sv[4] == $matches[4])) { + // Avoid diffs due to cross version protocol changes (e.g. like 11.2.0.2-11.2.0.3) and bugs like Oracle bug: 6277160 + die ("skip test only runs when database client libraries and database server are the same version"); +} + +// This test in Oracle 12c needs a non-CDB or the root container +if (isset($matches_sv[0]) && $matches_sv[1] >= 12) { + $s = oci_parse($c, "select nvl(sys_context('userenv', 'con_name'), 'notacdb') as dbtype from dual"); + $r = @oci_execute($s); + if (!$r) + die('skip could not identify container type'); + $r = oci_fetch_array($s); + if ($r['DBTYPE'] !== 'CDB$ROOT') + die('skip cannot run test using a PDB'); } ?> --FILE-- <?php -// This test will diff if either the client or the server is 11.2.0.3 -// (or greater) and the other is 11.2.0.2 (or earlier). Both client -// and server must be upgraded at the same time. - require dirname(__FILE__)."/connect.inc"; $new_password = "test"; var_dump(oci_password_change($dbase, $user, $password, $new_password)); - -if (!empty($dbase)) { - var_dump($new_c = ocilogon($user,$new_password,$dbase)); -} -else { - var_dump($new_c = ocilogon($user,$new_password)); -} - +var_dump($new_c = ocilogon($user,$new_password,$dbase)); var_dump(oci_password_change($dbase, $user, $new_password, $password)); diff --git a/ext/oci8/tests/password_old.phpt b/ext/oci8/tests/password_old.phpt index fdbb1f9e8..873fd4f59 100644 --- a/ext/oci8/tests/password_old.phpt +++ b/ext/oci8/tests/password_old.phpt @@ -3,41 +3,42 @@ ocipasswordchange() --SKIPIF-- <?php $target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on thes -require(dirname(__FILE__).'/skipif.inc'); +require(dirname(__FILE__).'/connect.inc'); if (empty($dbase)) die ("skip requires database connection string be set"); if ($test_drcp) die("skip password change not supported in DRCP Mode"); -// This test is known to fail with Oracle 10.2.0.4 client libraries -// connecting to Oracle Database 11 (Oracle bug 6277160, fixed 10.2.0.5) -if (preg_match('/Release (11|12)\./', oci_server_version($c), $matches) === 1 && - preg_match('/^10\.2\.0\.[1234]/', oci_client_version()) === 1) { - die ("skip test known to fail using Oracle 10.2.0.4 client libs connecting to Oracle 11 (6277160)"); +preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches_sv); +preg_match('/([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)/', oci_client_version(), $matches); +if (!(isset($matches_sv[0]) && isset($matches[0]) + && $matches_sv[1] == $matches[1] + && $matches_sv[2] == $matches[2] + && $matches_sv[3] == $matches[3] + && $matches_sv[4] == $matches[4])) { + // Avoid diffs due to cross version protocol changes (e.g. like 11.2.0.2-11.2.0.3) and bugs like Oracle bug: 6277160 + die ("skip test only runs when database client libraries and database server are the same version"); } - +// This test in Oracle 12c needs a non-CDB or the root container +if (isset($matches_sv[0]) && $matches_sv[1] >= 12) { + $s = oci_parse($c, "select nvl(sys_context('userenv', 'con_name'), 'notacdb') as dbtype from dual"); + $r = @oci_execute($s); + if (!$r) + die('skip could not identify container type'); + $r = oci_fetch_array($s); + if ($r['DBTYPE'] !== 'CDB$ROOT') + die('skip cannot run test using a PDB'); +} ?> --FILE-- <?php -// This test will diff if either the client or the server is 11.2.0.3 -// (or greater) and the other is 11.2.0.2 (or earlier). Both client -// and server must be upgraded at the same time. - require dirname(__FILE__)."/connect.inc"; $new_password = "test"; var_dump(ocipasswordchange($dbase, $user, $password, $new_password)); - -if (!empty($dbase)) { - var_dump($new_c = ocilogon($user,$new_password,$dbase)); -} -else { - var_dump($new_c = ocilogon($user,$new_password)); -} - +var_dump($new_c = ocilogon($user,$new_password,$dbase)); var_dump(ocipasswordchange($dbase, $user, $new_password, $password)); - echo "Done\n"; ?> diff --git a/ext/oci8/tests/pecl_bug16035.phpt b/ext/oci8/tests/pecl_bug16035.phpt index ddd0038de..29ff6439d 100644 --- a/ext/oci8/tests/pecl_bug16035.phpt +++ b/ext/oci8/tests/pecl_bug16035.phpt @@ -10,9 +10,6 @@ $ov = preg_match('/Compile-time ORACLE_HOME/', $phpinfo); if ($ov !== 1) { die ("skip Test only valid when OCI8 is built with an ORACLE_HOME"); } -if (preg_match('/Unknown/', oci_client_version()) == 1) { - die("skip expected output only valid with Oracle clients > 9gR2"); -} ?> --ENV-- ORACLE_HOME="" diff --git a/ext/oci8/tests/refcur_prefetch_1.phpt b/ext/oci8/tests/refcur_prefetch_1.phpt index ea09fbcd9..c7e200932 100644 --- a/ext/oci8/tests/refcur_prefetch_1.phpt +++ b/ext/oci8/tests/refcur_prefetch_1.phpt @@ -4,9 +4,16 @@ Prefetch with REF cursor. Test different values for prefetch with oci_set_prefet <?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); if (!extension_loaded('oci8')) die("skip no oci8 extension"); require(dirname(__FILE__)."/connect.inc"); -if (preg_match('/Release 1[012]\./', oci_server_version($c), $matches) !== 1) { - die("skip expected output only valid when using Oracle 10g or greater databases"); -} else if (preg_match('/^(11\.2|12)\./', oci_client_version()) != 1) { +preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); +if (!(isset($matches[0]) && + ($matches[1] >= 10))) { + die("skip expected output only valid when using Oracle 10g or greater database server"); +} +preg_match('/^([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)/', oci_client_version(), $matches); +if (!(isset($matches[0]) && + (($matches[1] == 11 && $matches[2] >= 2) || + ($matches[1] >= 12) + ))) { die("skip test expected to work only with Oracle 11gR2 or greater version of client"); } ?> diff --git a/ext/oci8/tests/refcur_prefetch_2.phpt b/ext/oci8/tests/refcur_prefetch_2.phpt index 8d6525107..9b2472db5 100644 --- a/ext/oci8/tests/refcur_prefetch_2.phpt +++ b/ext/oci8/tests/refcur_prefetch_2.phpt @@ -4,9 +4,16 @@ Prefetch with REF cursor. Test No 2 <?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); if (!extension_loaded('oci8')) die("skip no oci8 extension"); require(dirname(__FILE__)."/connect.inc"); -if (preg_match('/Release 1[012]\./', oci_server_version($c), $matches) !== 1) { - die("skip expected output only valid when using Oracle 10g or greater databases"); -} else if (preg_match('/^(11\.2|12)\./', oci_client_version()) != 1) { +preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); +if (!(isset($matches[0]) && + ($matches[1] >= 10))) { + die("skip expected output only valid when using Oracle 10g or greater database server"); +} +preg_match('/^([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)/', oci_client_version(), $matches); +if (!(isset($matches[0]) && + (($matches[1] == 11 && $matches[2] >= 2) || + ($matches[1] >= 12) + ))) { die("skip test expected to work only with Oracle 11gR2 or greater version of client"); } ?> diff --git a/ext/oci8/tests/refcur_prefetch_3.phpt b/ext/oci8/tests/refcur_prefetch_3.phpt index 8c0414042..f29345e51 100644 --- a/ext/oci8/tests/refcur_prefetch_3.phpt +++ b/ext/oci8/tests/refcur_prefetch_3.phpt @@ -6,12 +6,20 @@ oci8.default_prefetch=5 <?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); if (!extension_loaded('oci8')) die("skip no oci8 extension"); require(dirname(__FILE__)."/connect.inc"); -if (preg_match('/Release (11\.2|12)\./', oci_server_version($c), $matches) !== 1) { - die("skip expected output only valid when using Oracle 11gR2 or greater databases"); -} else if (preg_match('/^(11\.2|12)\./', oci_client_version()) != 1) { +preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); +if (!(isset($matches[0]) && + (($matches[1] == 11 && $matches[2] >= 2) || + ($matches[1] >= 12) + ))) { + die("skip expected output only valid when using Oracle 11gR2 or greater database server"); +} +preg_match('/^([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)/', oci_client_version(), $matches); +if (!(isset($matches[0]) && + (($matches[1] == 11 && $matches[2] >= 2) || + ($matches[1] >= 12) + ))) { die("skip test expected to work only with Oracle 11gR2 or greater version of client"); } - ?> --FILE-- <?php @@ -86,52 +94,52 @@ Test with Nested Cursors Fetch Row using Nested cursor Query array(1) { [0]=> - %unicode|string%(%d) "test0" + string(%d) "test0" } Fetch Row using Nested cursor Query array(1) { [0]=> - %unicode|string%(%d) "test1" + string(%d) "test1" } Fetch Row using Nested cursor Query array(1) { [0]=> - %unicode|string%(%d) "test2" + string(%d) "test2" } Fetch Row using Nested cursor Query array(1) { [0]=> - %unicode|string%(%d) "test3" + string(%d) "test3" } Fetch Row using Nested cursor Query array(1) { [0]=> - %unicode|string%(%d) "test4" + string(%d) "test4" } Fetch Row using Nested cursor Query array(1) { [0]=> - %unicode|string%(%d) "test5" + string(%d) "test5" } Fetch Row using Nested cursor Query array(1) { [0]=> - %unicode|string%(%d) "test6" + string(%d) "test6" } Fetch Row using Nested cursor Query array(1) { [0]=> - %unicode|string%(%d) "test7" + string(%d) "test7" } Fetch Row using Nested cursor Query array(1) { [0]=> - %unicode|string%(%d) "test8" + string(%d) "test8" } Fetch Row using Nested cursor Query array(1) { [0]=> - %unicode|string%(%d) "test9" + string(%d) "test9" } Number of roundtrips made with prefetch count 5 for 10 rows is 3 Done diff --git a/ext/oci8/tests/refcur_prefetch_4.phpt b/ext/oci8/tests/refcur_prefetch_4.phpt index d24398c00..f0c7183d0 100644 --- a/ext/oci8/tests/refcur_prefetch_4.phpt +++ b/ext/oci8/tests/refcur_prefetch_4.phpt @@ -4,9 +4,16 @@ Prefetch with REF cursor. Test No 4 <?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); if (!extension_loaded('oci8')) die("skip no oci8 extension"); require(dirname(__FILE__)."/connect.inc"); -if (preg_match('/Release 1[012]\./', oci_server_version($c), $matches) !== 1) { - die("skip expected output only valid when using Oracle 10g or greater databases"); -} else if (preg_match('/^(11\.2|12)\./', oci_client_version()) != 1) { +preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); +if (!(isset($matches[0]) && + ($matches[1] >= 10))) { + die("skip expected output only valid when using Oracle 10g or greater database server"); +} +preg_match('/^([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)/', oci_client_version(), $matches); +if (!(isset($matches[0]) && + (($matches[1] == 11 && $matches[2] >= 2) || + ($matches[1] >= 12) + ))) { die("skip test expected to work only with Oracle 11gR2 or greater version of client"); } ?> diff --git a/ext/oci8/tests/reflection1.phpt b/ext/oci8/tests/reflection1.phpt index 5f2e73d80..f76d7261a 100644 --- a/ext/oci8/tests/reflection1.phpt +++ b/ext/oci8/tests/reflection1.phpt @@ -126,6 +126,7 @@ reflection::export(new reflectionfunction('oci_set_module_name')); reflection::export(new reflectionfunction('oci_set_action')); reflection::export(new reflectionfunction('oci_set_client_info')); reflection::export(new reflectionfunction('oci_set_client_identifier')); +reflection::export(new reflectionfunction('oci_get_implicit_resultset')); ?> ===DONE=== @@ -1093,4 +1094,11 @@ Function [ <internal%s> function oci_set_client_identifier ] { } } +Function [ <internal%s> function oci_get_implicit_resultset ] { + + - Parameters [1] { + Parameter #0 [ <required> $statement_resource ] + } +} + ===DONE=== |