--EXPECTF--
Warning: oci_bind_array_by_name(): OCI-21560: argument 3 is null, invalid, or out of range in %s on line %d
-Warning: oci_execute(): ORA-01008: not all variables bound in %s on line %d
+Warning: oci_execute(): ORA-%r(01008|57000)%r: %s in %s on line %d
array(1) {
[0]=>
string(0) ""
--EXPECTF--
Warning: oci_bind_array_by_name(): Maximum array length must be greater than zero in %s on line %d
-Warning: oci_execute(): ORA-01008: not all variables bound in %s on line %d
+Warning: oci_execute(): ORA-%r(01008|57000)%r: %s in %s on line %d
array(5) {
[0]=>
string(9) "06-DEC-05"
--TEST--
oci_bind_array_by_name() and invalid values 3
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
--TEST--
oci_bind_array_by_name() and invalid values 4
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
--TEST--
oci_bind_array_by_name() and invalid values 5
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
--TEST--
oci_bind_array_by_name(), SQLT_CHR and default max_length
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
--EXPECTF--
Warning: oci_bind_array_by_name(): Unknown or unsupported datatype given: -1 in %s on line %d
-Warning: oci_execute(): ORA-01008: not all variables bound in %s on line %d
+Warning: oci_execute(): ORA-%r(01008|57000)%r: %s in %s on line %d
array(5) {
[0]=>
int(1)
--TEST--
oci_bind_array_by_name() and invalid values 8
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
?>
--EXPECTF--
Warning: oci_execute(): ORA-06550: line %d, column %d:
-PLS-00418: array bind type must match PL/SQL table row type
-ORA-06550: line %d, column %d:
-PL/SQL: Statement ignored in %s on line %d
+PLS-00418: %s
+ORA-06550: %s
+PL/SQL: %s
array(5) {
[0]=>
string(1) "1"
require dirname(__FILE__).'/connect.inc';
-$statement = oci_parse($c, 'SELECT user FROM v$session');
+$statement = oci_parse($c, 'SELECT user FROM all_objects');
$array = Array(1,2,3,4,5);
--EXPECTF--
Warning: oci_bind_array_by_name(): You must provide max length value for empty arrays in %s on line %d
-Warning: oci_execute(): ORA-01008: not all variables bound in %s on line %d
+Warning: oci_execute(): ORA-%r(01008|57000)%r: %s in %s on line %d
array(0) {
}
Done
require dirname(__FILE__).'/connect.inc';
-$statement = oci_parse($c, 'SELECT user FROM v$session');
+$statement = oci_parse($c, 'SELECT user FROM all_objects');
$array = array();
--TEST--
oci_bind_array_by_name() and NUMBERs
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
--TEST--
oci_bind_array_by_name() and SQLT_ODT
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
--TEST--
oci_bind_array_by_name() and SQLT_ODT
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
--TEST--
oci_bind_array_by_name() and SQLT_FLT
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
--TEST--
oci_bind_array_by_name() and SQLT_FLT
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
--TEST--
oci_bind_array_by_name() and SQLT_INT
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
--TEST--
oci_bind_array_by_name() and SQLT_INT
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
--TEST--
-oci_bind_array_by_name() and SQLT_AVC
+oci_bind_array_by_name() and SQLT_CHR
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
--TEST--
-oci_bind_array_by_name() and SQLT_AVC
+oci_bind_array_by_name() and SQLT_CHR
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
--TEST--
Bug #47243 (Crash on exit with ZTS mode)
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
--TEST--
Bug #47243 (Crash on exit with ZTS mode)
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
--TEST--
Bug #47243 (Crash on exit with ZTS mode)
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
<?php
if (!extension_loaded('oci8')) die ("skip no oci8 extension");
require(dirname(__FILE__)."/connect.inc");
-$sv = oci_server_version($c);
-$sv = preg_match('/Release 1[01]\.2\./', $sv, $matches);
-if ($sv !== 1) {
- die ("skip expected output only valid when using Oracle 10gR2 or 11gR2 databases");
-} else {
- ob_start();
- phpinfo(INFO_MODULES);
- $phpinfo = ob_get_clean();
- $iv = preg_match('/Oracle .*Version => 1[1]\./', $phpinfo);
- if ($iv != 1) {
- die ("skip test expected to work only with Oracle 11g or greater version of client");
- }
+if (preg_match('/Release 1[01]\.2\./', oci_server_version($c), $matches) !== 1) {
+ die("skip expected output only valid when using Oracle 10gR2 or 11gR2 databases");
+} else if (preg_match('/^11\./', oci_client_version()) != 1) {
+ die("skip test expected to work only with Oracle 11g or greater version of client");
}
?>
--FILE--
"insert into bind_char_tab values (3, NULL, 'abc ')"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- @oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
// Run Test
"drop table bind_char_tab"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- oci_execute($s);
-}
-
-oci_close($c);
+oci8_test_sql_execute($c, $stmtarray);
echo "Done\n";
"insert into bind_char_tab values (3, NULL, 'abc ')"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- @oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
// Run Test
"drop table bind_char_tab"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- oci_execute($s);
-}
-
-oci_close($c);
+oci8_test_sql_execute($c, $stmtarray);
echo "Done\n";
<?php
if (!extension_loaded('oci8')) die ("skip no oci8 extension");
require(dirname(__FILE__)."/connect.inc");
-$sv = oci_server_version($c);
-$sv = preg_match('/Release 1[01]\.2\./', $sv, $matches);
-if ($sv !== 1) {
- die ("skip expected output only valid when using Oracle 10gR2 or 11gR2 databases");
-} else {
- ob_start();
- phpinfo(INFO_MODULES);
- $phpinfo = ob_get_clean();
- $iv = preg_match('/Oracle .*Version => 1[1]\./', $phpinfo);
- if ($iv != 1) {
- die ("skip test expected to work only with Oracle 11g or greater version of client");
- }
+if (preg_match('/Release 1[01]\.2\./', oci_server_version($c), $matches) !== 1) {
+ die("skip expected output only valid when using Oracle 10gR2 or 11gR2 databases");
+} else if (preg_match('/^11\./', oci_client_version()) != 1) {
+ die("skip test expected to work only with Oracle 11g or greater version of client");
}
?>
--FILE--
"insert into bind_char_tab values (1, '2008-04-20')",
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- @oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
// Run Test
"drop table bind_char_tab"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- oci_execute($s);
-}
-
-oci_close($c);
+oci8_test_sql_execute($c, $stmtarray);
echo "Done\n";
"insert into bind_char_tab values (1, '2008-04-20')",
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- @oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
// Run Test
"drop table bind_char_tab"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- oci_execute($s);
-}
-
-oci_close($c);
+oci8_test_sql_execute($c, $stmtarray);
echo "Done\n";
<?php
if (!extension_loaded('oci8')) die ("skip no oci8 extension");
require(dirname(__FILE__)."/connect.inc");
-$sv = oci_server_version($c);
-$sv = preg_match('/Release 1[01]\.2\./', $sv, $matches);
-if ($sv !== 1) {
- die ("skip expected output only valid when using Oracle 10gR2 11gR2 databases");
-} else {
- ob_start();
- phpinfo(INFO_MODULES);
- $phpinfo = ob_get_clean();
- $iv = preg_match('/Oracle .*Version => 1[1]\./', $phpinfo);
- if ($iv != 1) {
- die ("skip test expected to work only with Oracle 11g or greater version of client");
- }
+if (preg_match('/Release 1[01]\.2\./', oci_server_version($c), $matches) !== 1) {
+ die("skip expected output only valid when using Oracle 10gR2 or 11gR2 databases");
+} else if (preg_match('/^11\./', oci_client_version()) != 1) {
+ die("skip test expected to work only with Oracle 11g or greater version of client");
}
?>
--FILE--
$stmtarray = array(
"create or replace function bind_char_3_fn(p1 char) return char as begin return p1; end;",
);
-
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- @oci_execute($s);
-}
+
+oci8_test_sql_execute($c, $stmtarray);
// Run Test
// Cleanup
-//require(dirname(__FILE__).'/drop_table.inc');
-
$stmtarray = array(
"drop function bind_char_3_fn"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- oci_execute($s);
-}
-
-oci_close($c);
+oci8_test_sql_execute($c, $stmtarray);
echo "Done\n";
"create or replace function bind_char_3_fn(p1 char) return char as begin return p1; end;",
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- @oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
// Run Test
// Cleanup
-//require(dirname(__FILE__).'/drop_table.inc');
-
$stmtarray = array(
"drop function bind_char_3_fn"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- oci_execute($s);
-}
-
-oci_close($c);
+oci8_test_sql_execute($c, $stmtarray);
echo "Done\n";
<?php
if (!extension_loaded('oci8')) die ("skip no oci8 extension");
require(dirname(__FILE__)."/connect.inc");
-$sv = oci_server_version($c);
-$sv = preg_match('/Release 1[01]\.2\./', $sv, $matches);
-if ($sv !== 1) {
- die ("skip expected output only valid when using Oracle 10gR2 or 11gR2 databases");
-} else {
- ob_start();
- phpinfo(INFO_MODULES);
- $phpinfo = ob_get_clean();
- $iv = preg_match('/Oracle .*Version => 1[1]\./', $phpinfo);
- if ($iv != 1) {
- die ("skip test expected to work only with Oracle 11g or greater version of client");
- }
+if (preg_match('/Release 1[01]\.2\./', oci_server_version($c), $matches) !== 1) {
+ die("skip expected output only valid when using Oracle 10gR2 or 11gR2 databases");
+} else if (preg_match('/^11\./', oci_client_version()) != 1) {
+ die("skip test expected to work only with Oracle 11g or greater version of client");
}
?>
--FILE--
"create or replace function bind_char_3_fn(p1 varchar2) return varchar2 as begin return p1; end;",
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- @oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
// Run Test
// Cleanup
-//require(dirname(__FILE__).'/drop_table.inc');
-
$stmtarray = array(
"drop function bind_char_3_fn"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- oci_execute($s);
-}
-
-oci_close($c);
+oci8_test_sql_execute($c, $stmtarray);
echo "Done\n";
"create or replace function bind_char_3_fn(p1 varchar2) return varchar2 as begin return p1; end;",
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- @oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
// Run Test
// Cleanup
-//require(dirname(__FILE__).'/drop_table.inc');
-
$stmtarray = array(
"drop function bind_char_3_fn"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- oci_execute($s);
-}
-
-oci_close($c);
+oci8_test_sql_execute($c, $stmtarray);
echo "Done\n";
--TEST--
bind LONG field
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
$stmt = oci_parse($c, "create table phptestlng( id number(10), filetxt long)");
oci_execute($stmt);
+echo "Test 1\n";
+
$stmt = oci_parse ($c, "insert into phptestlng (id, filetxt) values (:id, :filetxt)");
$i=1;
$filetxt = file_get_contents( dirname(__FILE__)."/test.txt");
+
+oci_bind_by_name( $stmt, ":id", $i, -1);
+oci_bind_by_name( $stmt, ":filetxt", $filetxt, -1, SQLT_LNG);
+oci_execute($stmt, OCI_DEFAULT);
+oci_commit($c);
+
+$stmt = oci_parse($c, "SELECT filetxt FROM phptestlng where id = 1");
+oci_execute($stmt);
+
+$row = oci_fetch_row($stmt);
+var_dump(md5($row[0]));
+var_dump(strlen($row[0]));
+
+echo "Test 2 - test multi chunk fetch\n";
+
+$stmt = oci_parse ($c, "insert into phptestlng (id, filetxt) values (:id, :filetxt)");
+$i=2;
+$filetxt = str_repeat($filetxt, 600);
+
oci_bind_by_name( $stmt, ":id", $i, -1);
oci_bind_by_name( $stmt, ":filetxt", $filetxt, -1, SQLT_LNG);
oci_execute($stmt, OCI_DEFAULT);
oci_commit($c);
-$stmt = oci_parse($c, "SELECT filetxt FROM phptestlng");
+$stmt = oci_parse($c, "SELECT filetxt FROM phptestlng where id = 2");
oci_execute($stmt);
$row = oci_fetch_row($stmt);
?>
--EXPECT--
+Test 1
string(32) "5c7c34abf7ea51936785062dbfcaeddc"
int(394)
+Test 2 - test multi chunk fetch
+string(32) "ee2e98b977341cfb8e037066e5fcb909"
+int(236400)
Done
--TEST--
bind LONG RAW field
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
--- /dev/null
+--TEST--
+Bind miscellaneous column types using default types
+--SKIPIF--
+<?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
+
+require(dirname(__FILE__).'/connect.inc');
+
+// Initialization
+
+$stmtarray = array(
+
+ "alter session set nls_date_format = 'DD-MON-YY'",
+
+ "drop table bind_misccoltypes_tab",
+
+ "create table bind_misccoltypes_tab (
+ id number,
+ char_t char(1),
+ char_t10 char(10),
+ varchar2_t10 varchar2(10),
+ number_t number,
+ number_t92 number(9,2),
+ number_t6 number(6),
+ date_t date,
+ timestamp_t timestamp,
+ float_t float,
+ binary_float_t binary_float,
+ binary_double_t binary_double,
+ decimal_t decimal,
+ integer_t integer,
+ nchar_t nchar(10),
+ nvarchar2_t10 nvarchar2(10),
+ varchar_t10 varchar(10) )",
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+function check_col($c, $colname, $id)
+{
+ $s = oci_parse($c, "select $colname from bind_misccoltypes_tab where id = :id");
+ oci_bind_by_name($s, ":id", $id);
+ oci_execute($s);
+ oci_fetch_all($s, $r);
+ var_dump($r);
+}
+
+// Tests
+
+echo "\nTEST86 insert all ORATYPE values\n";
+
+$insert_sql = "INSERT INTO bind_misccoltypes_tab ( id, "
+ . " char_t, "
+ . " char_t10, "
+ . " varchar2_t10, "
+ . " number_t, "
+ . " number_t92, "
+ . " number_t6, "
+ . " date_t, "
+ . " timestamp_t, "
+ . " float_t, "
+ . " binary_float_t, "
+ . " binary_double_t, "
+ . " decimal_t, "
+ . " integer_t, "
+ . " nchar_t, "
+ . " nvarchar2_t10, "
+ . " varchar_t10) "
+ . " VALUES (:n1, "
+ . " :c1, "
+ . " :c2, "
+ . " :c3, "
+ . " :n2, "
+ . " :n3, "
+ . " :n4, "
+ . " to_date(:d1, 'YYYY-MM-DD HH24:MI:SS'), "
+ . " to_timestamp(:d1, 'YYYY-MM-DD HH24:MI:SS'), "
+ . " :n5, "
+ . " :n5, "
+ . " :n5, "
+ . " :n1, "
+ . " :n1, "
+ . " :c4, "
+ . " :c5, "
+ . " :c6) ";
+
+
+$n1 = "86";
+$c1 = "C";
+$c2 = "char10";
+$c3 = "varchar210";
+$n2 = "-123.456";
+$n3 = "789.346";
+$n4 = "123456.023";
+$n5 = "12345678901234567890123456789012345678.723";
+$d1 = "2010-03-29 13:09:15";
+$c4 = "nchar10";
+$c5 = "nvarchar2x";
+$c6 = "varchar";
+
+$s = oci_parse($c, $insert_sql);
+oci_bind_by_name($s, ":n1", $n1);
+oci_bind_by_name($s, ":c1", $c1);
+oci_bind_by_name($s, ":c2", $c2);
+oci_bind_by_name($s, ":c3", $c3);
+oci_bind_by_name($s, ":n2", $n2);
+oci_bind_by_name($s, ":n3", $n3);
+oci_bind_by_name($s, ":n4", $n4);
+oci_bind_by_name($s, ":d1", $d1);
+oci_bind_by_name($s, ":n5", $n5);
+oci_bind_by_name($s, ":c4", $c4);
+oci_bind_by_name($s, ":c5", $c5);
+oci_bind_by_name($s, ":c6", $c6);
+
+oci_execute($s);
+
+echo "\nTEST87 SELECT all values using DEFINEs\n";
+$select_sql = "select "
+ . "id, "
+ . "char_t, "
+ . "char_t10, "
+ . "varchar2_t10, "
+ . "number_t, "
+ . "number_t92, "
+ . "number_t6, "
+ . "date_t, "
+ . "timestamp_t, "
+ . "float_t, "
+ . "binary_float_t, "
+ . "binary_double_t, "
+ . "decimal_t, "
+ . "integer_t, "
+ . "nchar_t, "
+ . "nvarchar2_t10, "
+ . "varchar_t10 "
+ . "from bind_misccoltypes_tab where id = 86";
+
+$s = oci_parse($c, $select_sql);
+
+oci_define_by_name($s, "ID", $ID);
+oci_define_by_name($s, "CHAR_T", $CHAR_T);
+oci_define_by_name($s, "CHAR_T10", $CHAR_T10);
+oci_define_by_name($s, "VARCHAR2_T10", $VARCHAR2_T10);
+oci_define_by_name($s, "NUMBER_T", $NUMBER_T);
+oci_define_by_name($s, "NUMBER_T92", $NUMBER_T92);
+oci_define_by_name($s, "NUMBER_T6", $NUMBER_T6);
+oci_define_by_name($s, "DATE_T", $DATE_T);
+oci_define_by_name($s, "TIMESTAMP_T", $TIMESTAMP_T);
+oci_define_by_name($s, "FLOAT_T", $FLOAT_T);
+oci_define_by_name($s, "BINARY_FLOAT_T", $BINARY_FLOAT_T);
+oci_define_by_name($s, "BINARY_DOUBLE_T", $BINARY_DOUBLE_T);
+oci_define_by_name($s, "DECIMAL_T", $DECIMAL_T);
+oci_define_by_name($s, "INTEGER_T", $INTEGER_T);
+oci_define_by_name($s, "NCHAR_T", $NCHAR_T);
+oci_define_by_name($s, "NVARCHAR2_T10", $NVARCHAR2_T10);
+oci_define_by_name($s, "VARCHAR_T10", $VARCHAR_T10);
+
+oci_execute($s);
+
+while (oci_fetch($s)) {
+ echo "ID is " . "$ID\n";
+ echo "CHAR_T is " . "$CHAR_T\n";
+ echo "CHAR_T10 is " . "$CHAR_T10\n";
+ echo "VARCHAR2_T10 is " . "$VARCHAR2_T10\n";
+ echo "NUMBER_T is " . "$NUMBER_T\n";
+ echo "NUMBER_T92 is " . "$NUMBER_T92\n";
+ echo "NUMBER_T6 is " . "$NUMBER_T6\n";
+ echo "DATE_T is " . "$DATE_T\n";
+ echo "TIMESTAMP_T is " . "$TIMESTAMP_T\n";
+ echo "FLOAT_T is " . "$FLOAT_T\n";
+ echo "BINARY_FLOAT_T is " . "$BINARY_FLOAT_T\n";
+ echo "BINARY_DOUBLE_T is " . "$BINARY_DOUBLE_T\n";
+ echo "DECIMAL_T is " . "$DECIMAL_T\n";
+ echo "INTEGER_T is " . "$INTEGER_T\n";
+ echo "NCHAR_T is " . "$NCHAR_T\n";
+ echo "NVARCHAR2_T10 is " . "$NVARCHAR2_T10\n";
+ echo "VARCHAR_T10 is " . "$VARCHAR_T10\n";
+}
+
+echo "\nTEST52 insert numbers\n";
+
+$s = oci_parse($c, "INSERT INTO bind_misccoltypes_tab (id, number_t92) VALUES (52, :n1)");
+$n1 = 3;
+oci_bind_by_name($s, ":n1", $n1);
+oci_execute($s);
+
+check_col($c, 'number_t92', 52);
+
+
+echo "\nTEST53 insert numbers \n";
+
+$s = oci_parse($c, "INSERT INTO bind_misccoltypes_tab (id, number_t92) VALUES (53, :n1)");
+$n1 = 8.67;
+oci_bind_by_name($s, ":n1", $n1);
+oci_execute($s);
+
+check_col($c, 'number_t92', 53);
+
+
+echo "\nTEST54 insert numbers \n";
+
+$s = oci_parse($c, "INSERT INTO bind_misccoltypes_tab (id, number_t) VALUES (54, :n1)");
+$n1 = 4.67;
+oci_bind_by_name($s, ":n1", $n1);
+oci_execute($s);
+
+check_col($c, 'number_t', 54);
+
+echo "\nTEST55 insert numbers \n";
+
+$s = oci_parse($c, "INSERT INTO bind_misccoltypes_tab (id, number_t) VALUES (55, :n1)");
+$n1 = "7.67";
+oci_bind_by_name($s, ":n1", $n1);
+oci_execute($s);
+
+check_col($c, 'number_t', 55);
+
+echo "\nTEST56 insert numbers \n";
+
+$n1 = -5.67;
+
+$s = oci_parse($c, "INSERT INTO bind_misccoltypes_tab (id, number_t) VALUES (56, :n1)");
+oci_bind_by_name($s, ":n1", $n1);
+oci_execute($s);
+
+check_col($c, 'number_t', 56);
+
+echo "\nTEST58 insert a VARCHAR2\n";
+
+$s = oci_parse($c, "INSERT INTO bind_misccoltypes_tab (id, varchar2_t10) VALUES (58, :c2)");
+$c2 = "Hood";
+oci_bind_by_name($s, ":c2", $c2);
+oci_execute($s);
+
+check_col($c, 'varchar2_t10', 58);
+
+echo "\nTEST59 insert a VARCHAR2\n";
+
+$s = oci_parse($c, "INSERT INTO bind_misccoltypes_tab (id, char_t10) VALUES (59, :c2)");
+$c2 = "Hood";
+oci_bind_by_name($s, ":c2", $c2);
+oci_execute($s);
+
+check_col($c, 'char_t10', 59);
+
+echo "\nTEST60 insert a date\n";
+
+$s = oci_parse($c, "INSERT INTO bind_misccoltypes_tab (id, date_t) VALUES (60, to_date(:c2, 'YYYY-MM-DD'))");
+$c2 = '2010-04-09';
+oci_bind_by_name($s, ":c2", $c2);
+oci_execute($s);
+
+check_col($c, 'date_t', 60);
+
+
+// Clean up
+
+$stmtarray = array(
+ "drop table bind_misccoltypes_tab"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+oci_close($c);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+TEST86 insert all ORATYPE values
+
+TEST87 SELECT all values using DEFINEs
+ID is 86
+CHAR_T is C
+CHAR_T10 is char10
+VARCHAR2_T10 is varchar210
+NUMBER_T is -123.456
+NUMBER_T92 is 789.35
+NUMBER_T6 is 123456
+DATE_T is 29-MAR-10
+TIMESTAMP_T is 29-MAR-10 01.09.15.000000 PM
+FLOAT_T is 12345678901234567890123456789012345679
+BINARY_FLOAT_T is 1.23456784E+037
+BINARY_DOUBLE_T is 1.2345678901234568E+037
+DECIMAL_T is 86
+INTEGER_T is 86
+NCHAR_T is nchar10
+NVARCHAR2_T10 is nvarchar2x
+VARCHAR_T10 is varchar
+
+TEST52 insert numbers
+array(1) {
+ ["NUMBER_T92"]=>
+ array(1) {
+ [0]=>
+ string(1) "3"
+ }
+}
+
+TEST53 insert numbers
+array(1) {
+ ["NUMBER_T92"]=>
+ array(1) {
+ [0]=>
+ string(4) "8.67"
+ }
+}
+
+TEST54 insert numbers
+array(1) {
+ ["NUMBER_T"]=>
+ array(1) {
+ [0]=>
+ string(4) "4.67"
+ }
+}
+
+TEST55 insert numbers
+array(1) {
+ ["NUMBER_T"]=>
+ array(1) {
+ [0]=>
+ string(4) "7.67"
+ }
+}
+
+TEST56 insert numbers
+array(1) {
+ ["NUMBER_T"]=>
+ array(1) {
+ [0]=>
+ string(5) "-5.67"
+ }
+}
+
+TEST58 insert a VARCHAR2
+array(1) {
+ ["VARCHAR2_T10"]=>
+ array(1) {
+ [0]=>
+ string(4) "Hood"
+ }
+}
+
+TEST59 insert a VARCHAR2
+array(1) {
+ ["CHAR_T10"]=>
+ array(1) {
+ [0]=>
+ string(10) "Hood "
+ }
+}
+
+TEST60 insert a date
+array(1) {
+ ["DATE_T"]=>
+ array(1) {
+ [0]=>
+ string(9) "09-APR-10"
+ }
+}
+===DONE===
--- /dev/null
+--TEST--
+Bind miscellaneous column types and generating errors
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/connect.inc');
+
+// Initialization
+
+$stmtarray = array(
+ "drop table bind_misccoltypes_errs_tab",
+
+ "create table bind_misccoltypes_errs_tab (
+ id number,
+ char_t char(1),
+ char_t10 char(10),
+ varchar2_t10 varchar2(10),
+ number_t number,
+ number_t92 number(9,2),
+ number_t6 number(6),
+ date_t date,
+ timestamp_t timestamp,
+ float_t float,
+ binary_float_t binary_float,
+ binary_double_t binary_double,
+ decimal_t decimal,
+ integer_t integer,
+ nchar_t nchar(10),
+ nvarchar2_t10 nvarchar2(10),
+ varchar_t10 varchar(10) )",
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+function check_col($c, $colname, $id)
+{
+ $s = oci_parse($c, "select $colname from bind_misccoltypes_errs_tab where id = :id");
+ oci_bind_by_name($s, ":id", $id);
+ oci_execute($s);
+ oci_fetch_all($s, $r);
+ var_dump($r);
+}
+
+// Tests
+
+echo "\nTest 1 insert numbers \n";
+
+$n1 = -23253245.3432467;
+
+$s = oci_parse($c, "INSERT INTO bind_misccoltypes_errs_tab (id, number_t6) VALUES (1, :n1)");
+oci_bind_by_name($s, ":n1", $n1);
+oci_execute($s);
+
+check_col($c, 'number_t6', 57);
+
+echo "\nTest 2 insert numbers \n";
+
+$n1 = "Hello";
+
+$s = oci_parse($c, "INSERT INTO bind_misccoltypes_errs_tab (id, number_t6) VALUES (2, :n1)");
+oci_bind_by_name($s, ":n1", $n1);
+oci_execute($s);
+
+check_col($c, 'number_t6', 57);
+
+echo "\nTest 3 - too long CHAR\n";
+
+$s = oci_parse($c, "INSERT INTO bind_misccoltypes_errs_tab (id, char_t) VALUES (3, :c2)");
+$c2 = "AB";
+oci_bind_by_name($s, ":c2", $c2, -1, SQLT_AFC);
+oci_execute($s);
+
+echo "\nTest 4 - too long VARCHAR2\n";
+
+$s = oci_parse($c, "INSERT INTO bind_misccoltypes_errs_tab (id, varchar2_t10) VALUES (4, :c2)");
+$c2 = "AAAAAAAAAAB";
+oci_bind_by_name($s, ":c2", $c2, -1, SQLT_AFC);
+oci_execute($s);
+
+echo "\nTest 5 - invalid number\n";
+
+$s = oci_parse($c, "INSERT INTO bind_misccoltypes_errs_tab (id, number_t) VALUES (5, :c2)");
+$c2 = "ABC";
+oci_bind_by_name($s, ":c2", $c2, -1, SQLT_AFC);
+oci_execute($s);
+
+echo "\nTest 6 - insert a VARCHAR2 with SQLT_BIN\n";
+
+$s = oci_parse($c, "INSERT INTO bind_misccoltypes_errs_tab (id, varchar2_t10) VALUES (6, :c2)");
+$c2 = "Hood 6";
+oci_bind_by_name($s, ":c2", $c2, -1, SQLT_BIN);
+oci_execute($s);
+
+check_col($c, 'varchar2_t10', 6);
+
+echo "\nTest 7 - insert a VARCHAR2 with SQLT_LBI\n";
+
+$s = oci_parse($c, "INSERT INTO bind_misccoltypes_errs_tab (id, varchar2_t10) VALUES (7, :c2)");
+$c2 = "Hood 7";
+oci_bind_by_name($s, ":c2", $c2, -1, SQLT_LBI);
+oci_execute($s);
+
+check_col($c, 'varchar2_t10', 7);
+
+
+// Clean up
+
+$stmtarray = array(
+ "drop table bind_misccoltypes_errs_tab"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+oci_close($c);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+Test 1 insert numbers
+
+Warning: oci_execute(): ORA-01438: %s in %sbind_misccoltypes_errs.php on line %d
+array(1) {
+ ["NUMBER_T6"]=>
+ array(0) {
+ }
+}
+
+Test 2 insert numbers
+
+Warning: oci_execute(): ORA-01722: %s in %sbind_misccoltypes_errs.php on line %d
+array(1) {
+ ["NUMBER_T6"]=>
+ array(0) {
+ }
+}
+
+Test 3 - too long CHAR
+
+Warning: oci_execute(): ORA-12899: %r(%s "%s"."BIND_MISCCOLTYPES_ERRS_TAB"."CHAR_T" \(%s: 2, %s: 1\)|String data right truncation)%r in %sbind_misccoltypes_errs.php on line %d
+
+Test 4 - too long VARCHAR2
+
+Warning: oci_execute(): ORA-12899: %r(%s "%s"."BIND_MISCCOLTYPES_ERRS_TAB"."VARCHAR2_T10" \(%s: 11, %s: 10\)|%s data right truncation)%r in %sbind_misccoltypes_errs.php on line %d
+
+Test 5 - invalid number
+
+Warning: oci_execute(): ORA-01722: %s in %sbind_misccoltypes_errs.php on line %d
+
+Test 6 - insert a VARCHAR2 with SQLT_BIN
+
+Warning: oci_execute(): ORA-12899: %r(%s "%s"."BIND_MISCCOLTYPES_ERRS_TAB"."VARCHAR2_T10" \(%s: 12, %s: 10\)|String data right truncation)%r in %sbind_misccoltypes_errs.php on line %d
+array(1) {
+ ["VARCHAR2_T10"]=>
+ array(0) {
+ }
+}
+
+Test 7 - insert a VARCHAR2 with SQLT_LBI
+
+Warning: oci_execute(): ORA-12899: %r(%s "%s"."BIND_MISCCOLTYPES_ERRS_TAB"."VARCHAR2_T10" \(%s: 12, %s: 10\)|String data right truncation)%r in %sbind_misccoltypes_errs.php on line %d
+array(1) {
+ ["VARCHAR2_T10"]=>
+ array(0) {
+ }
+}
+===DONE===
--- /dev/null
+--TEST--
+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
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/connect.inc');
+
+// Initialization
+
+$stmtarray = array(
+ "drop table bind_number_tab",
+ "create table bind_number_tab (
+ id number,
+ number_t6 number(6),
+ float_t float,
+ binary_float_t binary_float,
+ binary_double_t binary_double,
+ decimal_t decimal,
+ integer_t integer)"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+function check_col($c, $colname, $id)
+{
+ $s = oci_parse($c, "select $colname from bind_number_tab where id = :id");
+ oci_bind_by_name($s, ":id", $id);
+ oci_execute($s);
+ oci_fetch_all($s, $r);
+ var_dump($r);
+}
+
+// Run Test
+
+echo "Test 1 - invalid number\n";
+
+$s = oci_parse($c, "INSERT INTO bind_number_tab (id, number_t6) VALUES (1, :n1)");
+$n1 = "Hello";
+oci_bind_by_name($s, ":n1", $n1);
+oci_execute($s);
+
+check_col($c, "number_t6", 1);
+
+echo "\nTEST66 insert a float\n";
+
+$s = oci_parse($c, "INSERT INTO bind_number_tab (id, float_t) VALUES (66, :f1)");
+$f1 = 123.456;
+oci_bind_by_name($s, ":f1", $f1);
+oci_execute($s);
+
+check_col($c, 'float_t', 66);
+
+echo "\nTEST67 insert a binary float\n";
+
+$s = oci_parse($c, "INSERT INTO bind_number_tab (id, binary_float_t) VALUES (67, :f1)");
+$f1 = 567.456;
+oci_bind_by_name($s, ":f1", $f1);
+oci_execute($s);
+
+check_col($c, 'binary_float_t', 67);
+
+echo "\nTEST69 insert a binary double\n";
+
+$s = oci_parse($c, "INSERT INTO bind_number_tab (id, binary_double_t) VALUES (69, :f1)");
+$f1 = 567.456;
+oci_bind_by_name($s, ":f1", $f1);
+oci_execute($s);
+
+check_col($c, 'binary_double_t', 69);
+
+echo "\nTEST71 insert a decimal\n";
+
+$s = oci_parse($c, "INSERT INTO bind_number_tab (id, decimal_t) VALUES (71, :f1)");
+$f1 = 123.789;
+oci_bind_by_name($s, ":f1", $f1);
+oci_execute($s);
+
+check_col($c, 'decimal_t', 71);
+
+echo "\nTEST72 insert a decimal\n";
+
+$s = oci_parse($c, "INSERT INTO bind_number_tab (id, decimal_t) VALUES (72, :f1)");
+$f1 = 123.789;
+oci_bind_by_name($s, ":f1", $f1, -1, SQLT_NUM);
+oci_execute($s);
+
+check_col($c, 'decimal_t', 72);
+
+echo "\nTEST73 insert a double\n";
+
+$s = oci_parse($c, "INSERT INTO bind_number_tab (id, binary_double_t) VALUES (73, :f1)");
+$f1 = 483.589;
+oci_bind_by_name($s, ":f1", $f1);
+oci_execute($s);
+
+check_col($c, 'binary_double_t', 73);
+
+echo "\nTEST75 insert a INTEGER\n";
+
+$s = oci_parse($c, "INSERT INTO bind_number_tab (id, integer_t) VALUES (75, :f1)");
+$f1 = 589;
+oci_bind_by_name($s, ":f1", $f1);
+oci_execute($s);
+
+check_col($c, 'integer_t', 75);
+
+echo "\nTEST76 insert a INTEGER\n";
+
+$s = oci_parse($c, "INSERT INTO bind_number_tab (id, integer_t) VALUES (76, :f1)");
+$f1 = 42;
+oci_bind_by_name($s, ":f1", $f1, -1, SQLT_INT);
+oci_execute($s);
+
+check_col($c, 'integer_t', 76);
+
+
+// Clean up
+
+$stmtarray = array(
+ "drop table bind_number_tab"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+Test 1 - invalid number
+
+Warning: oci_execute(): ORA-01722: %s in %sbind_number.php on line %d
+array(1) {
+ ["NUMBER_T6"]=>
+ array(0) {
+ }
+}
+
+TEST66 insert a float
+array(1) {
+ ["FLOAT_T"]=>
+ array(1) {
+ [0]=>
+ string(7) "123.456"
+ }
+}
+
+TEST67 insert a binary float
+array(1) {
+ ["BINARY_FLOAT_T"]=>
+ array(1) {
+ [0]=>
+ string(%r15|8%r) "%r(5.67455994E\+002|567.4560)%r"
+ }
+}
+
+TEST69 insert a binary double
+array(1) {
+ ["BINARY_DOUBLE_T"]=>
+ array(1) {
+ [0]=>
+ string(%r23|16%r) "%r(5.6745600000000002E\+002|567.456000000000)%r"
+ }
+}
+
+TEST71 insert a decimal
+array(1) {
+ ["DECIMAL_T"]=>
+ array(1) {
+ [0]=>
+ string(3) "124"
+ }
+}
+
+TEST72 insert a decimal
+array(1) {
+ ["DECIMAL_T"]=>
+ array(1) {
+ [0]=>
+ string(1) "0"
+ }
+}
+
+TEST73 insert a double
+array(1) {
+ ["BINARY_DOUBLE_T"]=>
+ array(1) {
+ [0]=>
+ string(%r12|16%r) "%r(4.83589E\+002|483.589000000000)%r"
+ }
+}
+
+TEST75 insert a INTEGER
+array(1) {
+ ["INTEGER_T"]=>
+ array(1) {
+ [0]=>
+ string(3) "589"
+ }
+}
+
+TEST76 insert a INTEGER
+array(1) {
+ ["INTEGER_T"]=>
+ array(1) {
+ [0]=>
+ string(2) "42"
+ }
+}
+===DONE===
+
+
--- /dev/null
+--TEST--
+Bind with various WHERE conditions
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/connect.inc');
+
+// Initialization
+
+$stmtarray = array(
+ "drop table bind_query_tab",
+ "create table bind_query_tab (empno number(4), ename varchar2(10), sal number(7,2))",
+ "insert into bind_query_tab values (7934, 'MILLER', 1300)",
+ "insert into bind_query_tab values (7902, 'FORD', 3000)"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+// Run Test
+
+echo "Test 1\n";
+
+$e = 7934;
+
+$s = oci_parse($c, "select ename from bind_query_tab where empno = :eno");
+oci_bind_by_name( $s, ":eno", $e, -1, SQLT_INT);
+oci_execute($s);
+var_dump(oci_fetch_row($s));
+
+echo "Test 2\n";
+
+$v = 1000;
+$s = oci_parse($c, 'select ename from bind_query_tab where sal > :v order by ename');
+oci_bind_by_name( $s, ":v", $v);
+oci_define_by_name($s, "ENAME", $ename, 20);
+oci_execute($s);
+while (oci_fetch($s)) {
+ var_dump($ename);
+}
+
+
+echo "Test 3\n";
+
+$s = oci_parse($c, 'select ename from bind_query_tab where sal > :v order by ename');
+oci_bind_by_name( $s, ":v", $v);
+$v = 2000;
+oci_define_by_name($s, "ENAME", $ename, 20);
+oci_execute($s);
+while (oci_fetch($s)) {
+ var_dump($ename);
+}
+
+
+// Clean up
+
+$stmtarray = array(
+ "drop table bind_query_tab"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+Test 1
+array(1) {
+ [0]=>
+ string(6) "MILLER"
+}
+Test 2
+string(4) "FORD"
+string(6) "MILLER"
+Test 3
+string(4) "FORD"
+===DONE===
--TEST--
bind RAW field
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
}
}
-$stmts = array(
+$stmtarray = array(
"drop table rid_tab",
"create table rid_tab (id number, address varchar2(40))",
"insert into rid_tab (id, address) values (1, 'original text #1')",
"insert into rid_tab (id, address) values (2, 'original text #2')"
);
-foreach ($stmts as $q) {
- $s = oci_parse($c, $q);
- @oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
echo "Initial Data\n";
do_query($c);
// Cleanup
-$stmts = array("drop table rid_tab");
+$stmtarray = array(
+ "drop table rid_tab"
+);
-foreach ($stmts as $q) {
- $s = oci_parse($c, $q);
- @oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
echo "Done\n";
--- /dev/null
+--TEST--
+Bind tests with SQLT_AFC
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/connect.inc');
+
+// Initialization
+
+$stmtarray = array(
+ "drop table bind_sqltafc_tab",
+ "create table bind_sqltafc_tab (id number, char_t char(1), char_t10 char(10), varchar2_t10 varchar2(10), number_t number)",
+ "insert into bind_sqltafc_tab values (0, 'a', 'abcd', 'efghij', 1.1)"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+// Run Test
+
+function q($c, $id)
+{
+ $s = oci_parse($c, "select * from bind_sqltafc_tab where id = $id");
+ oci_execute($s);
+ oci_fetch_all($s, $r);
+ var_dump($r);
+}
+
+echo "Test 0 - base table creation without binds\n";
+
+q($c, 0);
+
+echo "\nTest 1 - successful insert\n";
+
+$s = oci_parse($c, "INSERT INTO bind_sqltafc_tab (id, char_t, char_t10, varchar2_t10, number_t) VALUES (1, :c2, :c3, :c4, :c5)");
+$c2 = "H";
+$c3 = "AAAAAAAAAA"; // max length allowed in column
+$c4 = "BBBBBBBBBB"; // max length allowed in column
+$c5 = "123.45";
+oci_bind_by_name($s, ":c2", $c2, -1, SQLT_AFC);
+oci_bind_by_name($s, ":c3", $c3, -1, SQLT_AFC);
+oci_bind_by_name($s, ":c4", $c4, -1, SQLT_AFC);
+oci_bind_by_name($s, ":c5", $c5, -1, SQLT_AFC);
+oci_execute($s);
+
+q($c, 1);
+
+echo "\nTest 2 - Empty Strings\n";
+
+$s = oci_parse($c, "INSERT INTO bind_sqltafc_tab (id, char_t, char_t10, varchar2_t10, number_t) VALUES (5, :c2, :c3, :c4, :c5)");
+$c2 = "";
+$c3 = "";
+$c4 = "";
+$c5 = "";
+oci_bind_by_name($s, ":c2", $c2, -1, SQLT_AFC);
+oci_bind_by_name($s, ":c3", $c3, -1, SQLT_AFC);
+oci_bind_by_name($s, ":c4", $c4, -1, SQLT_AFC);
+oci_bind_by_name($s, ":c5", $c5, -1, SQLT_AFC);
+oci_execute($s);
+
+q($c, 5);
+
+echo "\nTest 3 - NULLs\n";
+
+$s = oci_parse($c, "INSERT INTO bind_sqltafc_tab (id, char_t, char_t10, varchar2_t10, number_t) VALUES (6, :c2, :c3, :c4, :c5)");
+$c2 = null;
+$c3 = null;
+$c4 = null;
+$c5 = null;
+oci_bind_by_name($s, ":c2", $c2, -1, SQLT_AFC);
+oci_bind_by_name($s, ":c3", $c3, -1, SQLT_AFC);
+oci_bind_by_name($s, ":c4", $c4, -1, SQLT_AFC);
+oci_bind_by_name($s, ":c5", $c5, -1, SQLT_AFC);
+oci_execute($s);
+
+q($c, 6);
+
+// Clean up
+
+$stmtarray = array(
+ "drop table bind_sqltafc_tab"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+oci_close($c);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+Test 0 - base table creation without binds
+array(5) {
+ ["ID"]=>
+ array(1) {
+ [0]=>
+ string(1) "0"
+ }
+ ["CHAR_T"]=>
+ array(1) {
+ [0]=>
+ string(1) "a"
+ }
+ ["CHAR_T10"]=>
+ array(1) {
+ [0]=>
+ string(10) "abcd "
+ }
+ ["VARCHAR2_T10"]=>
+ array(1) {
+ [0]=>
+ string(6) "efghij"
+ }
+ ["NUMBER_T"]=>
+ array(1) {
+ [0]=>
+ string(3) "1.1"
+ }
+}
+
+Test 1 - successful insert
+array(5) {
+ ["ID"]=>
+ array(1) {
+ [0]=>
+ string(1) "1"
+ }
+ ["CHAR_T"]=>
+ array(1) {
+ [0]=>
+ string(1) "H"
+ }
+ ["CHAR_T10"]=>
+ array(1) {
+ [0]=>
+ string(10) "AAAAAAAAAA"
+ }
+ ["VARCHAR2_T10"]=>
+ array(1) {
+ [0]=>
+ string(10) "BBBBBBBBBB"
+ }
+ ["NUMBER_T"]=>
+ array(1) {
+ [0]=>
+ string(6) "123.45"
+ }
+}
+
+Test 2 - Empty Strings
+array(5) {
+ ["ID"]=>
+ array(1) {
+ [0]=>
+ string(1) "5"
+ }
+ ["CHAR_T"]=>
+ array(1) {
+ [0]=>
+ NULL
+ }
+ ["CHAR_T10"]=>
+ array(1) {
+ [0]=>
+ NULL
+ }
+ ["VARCHAR2_T10"]=>
+ array(1) {
+ [0]=>
+ NULL
+ }
+ ["NUMBER_T"]=>
+ array(1) {
+ [0]=>
+ NULL
+ }
+}
+
+Test 3 - NULLs
+array(5) {
+ ["ID"]=>
+ array(1) {
+ [0]=>
+ string(1) "6"
+ }
+ ["CHAR_T"]=>
+ array(1) {
+ [0]=>
+ NULL
+ }
+ ["CHAR_T10"]=>
+ array(1) {
+ [0]=>
+ NULL
+ }
+ ["VARCHAR2_T10"]=>
+ array(1) {
+ [0]=>
+ NULL
+ }
+ ["NUMBER_T"]=>
+ array(1) {
+ [0]=>
+ NULL
+ }
+}
+===DONE===
--- /dev/null
+--TEST--
+Bind with SQLT_CHR
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/connect.inc');
+
+// Initialization
+
+$stmtarray = array(
+ "drop table bind_sqltchr_tab",
+
+ "create table bind_sqltchr_tab (
+ id number,
+ varchar2_t10 varchar2(10),
+ number_t number,
+ number_t92 number(9,2))"
+
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+function check_col($c, $colname, $id)
+{
+ $s = oci_parse($c, "select $colname from bind_sqltchr_tab where id = :id");
+ oci_bind_by_name($s, ":id", $id);
+ oci_execute($s);
+ oci_fetch_all($s, $r);
+ var_dump($r);
+}
+
+// Run Test
+
+echo "\nTEST241 bind SQLT_CHR\n";
+
+$c2 = "Hood241";
+$s = oci_parse($c, "INSERT INTO bind_sqltchr_tab (id, varchar2_t10) VALUES (241, :c2)");
+oci_bind_by_name($s, ":c2", $c2, -1, SQLT_CHR);
+oci_execute($s);
+
+check_col($c, 'varchar2_t10', 241);
+
+
+echo "\nTEST242 insert numbers SQLT_CHR\n";
+
+$s = oci_parse($c, "INSERT INTO bind_sqltchr_tab (id, number_t) VALUES (242, :n1)");
+$n1 = 42;
+oci_bind_by_name($s, ":n1", $n1, -1, SQLT_CHR);
+oci_execute($s);
+
+check_col($c, 'number_t', 242);
+
+echo "\nTEST243 insert numbers, SQLT_CHR\n";
+
+$s = oci_parse($c, "INSERT INTO bind_sqltchr_tab (id, number_t) VALUES (243, :n1)");
+$n1 = 42.69;
+oci_bind_by_name($s, ":n1", $n1, -1, SQLT_CHR);
+oci_execute($s);
+
+check_col($c, 'number_t', 243);
+
+echo "\nTEST244 insert numbers with SQLT_CHR\n";
+
+$s = oci_parse($c, "INSERT INTO bind_sqltchr_tab (id, number_t) VALUES (244, :n1)");
+$n1 = 0;
+oci_bind_by_name($s, ":n1", $n1, -1, SQLT_CHR);
+oci_execute($s);
+
+check_col($c, 'number_t', 244);
+
+echo "\nTEST245 insert numbers with SQLT_CHR\n";
+
+$s = oci_parse($c, "INSERT INTO bind_sqltchr_tab (id, number_t) VALUES (245, :n1)");
+$n1 = -23;
+oci_bind_by_name($s, ":n1", $n1, -1, SQLT_CHR);
+oci_execute($s);
+
+check_col($c, 'number_t', 245);
+
+echo "\nTEST246 insert numbers\n";
+
+$s = oci_parse($c, "INSERT INTO bind_sqltchr_tab (id, number_t) VALUES (246, :n1)");
+$n1 = "-23";
+oci_bind_by_name($s, ":n1", $n1, -1, SQLT_CHR);
+oci_execute($s);
+
+check_col($c, 'number_t', 246);
+
+echo "\nTEST247 insert numbers with SQLT_CHR\n";
+
+$s = oci_parse($c, "INSERT INTO bind_sqltchr_tab (id, number_t) VALUES (247, :n1)");
+$n1 = "23";
+oci_bind_by_name($s, ":n1", $n1, -1, SQLT_CHR);
+oci_execute($s);
+
+check_col($c, 'number_t', 247);
+
+echo "\nTEST248 insert numbers with SQLT_CHR\n";
+
+$s = oci_parse($c, "INSERT INTO bind_sqltchr_tab (id, number_t92) VALUES (248, :n1)");
+$n1 = 123.56;
+oci_bind_by_name($s, ":n1", $n1, -1, SQLT_CHR);
+oci_execute($s);
+
+check_col($c, 'number_t92', 248);
+
+echo "\nTEST249 insert numbers with SQLT_CHR\n";
+
+$s = oci_parse($c, "INSERT INTO bind_sqltchr_tab (id, number_t92) VALUES (249, :n1)");
+$n1 = "123.56";
+oci_bind_by_name($s, ":n1", $n1, -1, SQLT_CHR);
+oci_execute($s);
+
+check_col($c, 'number_t92', 249);
+
+echo "\nTEST250 insert numbers with SQLT_CHR\n";
+
+$s = oci_parse($c, "INSERT INTO bind_sqltchr_tab (id, number_t92) VALUES (250, :n1)");
+$n1 = "";
+oci_bind_by_name($s, ":n1", $n1, -1, SQLT_CHR);
+oci_execute($s);
+
+check_col($c, 'number_t92', 250);
+
+// Clean up
+
+$stmtarray = array(
+ "drop table bind_sqltchr_tab"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+TEST241 bind SQLT_CHR
+array(1) {
+ ["VARCHAR2_T10"]=>
+ array(1) {
+ [0]=>
+ string(7) "Hood241"
+ }
+}
+
+TEST242 insert numbers SQLT_CHR
+array(1) {
+ ["NUMBER_T"]=>
+ array(1) {
+ [0]=>
+ string(2) "42"
+ }
+}
+
+TEST243 insert numbers, SQLT_CHR
+array(1) {
+ ["NUMBER_T"]=>
+ array(1) {
+ [0]=>
+ string(5) "42.69"
+ }
+}
+
+TEST244 insert numbers with SQLT_CHR
+array(1) {
+ ["NUMBER_T"]=>
+ array(1) {
+ [0]=>
+ string(1) "0"
+ }
+}
+
+TEST245 insert numbers with SQLT_CHR
+array(1) {
+ ["NUMBER_T"]=>
+ array(1) {
+ [0]=>
+ string(3) "-23"
+ }
+}
+
+TEST246 insert numbers
+array(1) {
+ ["NUMBER_T"]=>
+ array(1) {
+ [0]=>
+ string(3) "-23"
+ }
+}
+
+TEST247 insert numbers with SQLT_CHR
+array(1) {
+ ["NUMBER_T"]=>
+ array(1) {
+ [0]=>
+ string(2) "23"
+ }
+}
+
+TEST248 insert numbers with SQLT_CHR
+array(1) {
+ ["NUMBER_T92"]=>
+ array(1) {
+ [0]=>
+ string(6) "123.56"
+ }
+}
+
+TEST249 insert numbers with SQLT_CHR
+array(1) {
+ ["NUMBER_T92"]=>
+ array(1) {
+ [0]=>
+ string(6) "123.56"
+ }
+}
+
+TEST250 insert numbers with SQLT_CHR
+array(1) {
+ ["NUMBER_T92"]=>
+ array(1) {
+ [0]=>
+ NULL
+ }
+}
+===DONE===
--- /dev/null
+--TEST--
+PL/SQL bind with SQLT_CHR
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/connect.inc');
+
+// Initialization
+
+$stmtarray = array(
+ "create or replace procedure bind_sqltchr_proc (msg_in in varchar2, msg_out out varchar2)
+ as
+ begin
+ msg_out := upper(msg_in);
+ end;"
+
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+// Run Test
+
+echo "Test 1 - PL/SQL IN and OUT variables\n";
+
+$stmt = oci_parse($c, "BEGIN bind_sqltchr_proc(:a, :b); END;");
+$msg_in = "Cat got your keyboard?";
+oci_bind_by_name($stmt, ":a", $msg_in, -1, SQLT_CHR);
+oci_bind_by_name($stmt, ":b", $msg_out, 800, SQLT_CHR);
+oci_execute($stmt);
+var_dump($msg_in);
+var_dump($msg_out);
+
+// Clean up
+
+$stmtarray = array(
+ "drop procedure bind_sqltchr_proc"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+Test 1 - PL/SQL IN and OUT variables
+string(22) "Cat got your keyboard?"
+string(22) "CAT GOT YOUR KEYBOARD?"
+===DONE===
--- /dev/null
+--TEST--
+Bind with SQLT_INT
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/connect.inc');
+
+// Initialization
+
+$stmtarray = array(
+ "drop table bind_sqltint_tab",
+
+ "create table bind_sqltint_tab (
+ id number,
+ varchar2_t10 varchar2(10),
+ number_t number,
+ number_t92 number(9,2))",
+
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+function check_col($c, $colname, $id)
+{
+ $s = oci_parse($c, "select $colname from bind_sqltint_tab where id = :id");
+ oci_bind_by_name($s, ":id", $id);
+ oci_execute($s);
+ oci_fetch_all($s, $r);
+ var_dump($r);
+}
+
+// Run Test
+
+echo "\nTEST141 wrong bind type SQLT_INT\n";
+
+$c2 = "Hood141";
+$s = oci_parse($c, "INSERT INTO bind_sqltint_tab (id, varchar2_t10) VALUES (141, :c2)");
+oci_bind_by_name($s, ":c2", $c2, -1, SQLT_INT);
+oci_execute($s);
+
+check_col($c, 'varchar2_t10', 141);
+
+echo "\nTEST142 insert numbers SQLT_INT\n";
+
+$s = oci_parse($c, "INSERT INTO bind_sqltint_tab (id, number_t) VALUES (142, :n1)");
+$n1 = 42;
+oci_bind_by_name($s, ":n1", $n1, -1, SQLT_INT);
+oci_execute($s);
+
+check_col($c, 'number_t', 142);
+
+echo "\nTEST143 insert numbers, SQLT_INT\n";
+
+$s = oci_parse($c, "INSERT INTO bind_sqltint_tab (id, number_t) VALUES (143, :n1)");
+$n1 = 42.69;
+oci_bind_by_name($s, ":n1", $n1, -1, SQLT_INT);
+oci_execute($s);
+
+check_col($c, 'number_t', 143);
+
+echo "\nTEST144 insert numbers with SQLT_INT\n";
+
+$s = oci_parse($c, "INSERT INTO bind_sqltint_tab (id, number_t) VALUES (144, :n1)");
+$n1 = 0;
+oci_bind_by_name($s, ":n1", $n1, -1, SQLT_INT);
+oci_execute($s);
+
+check_col($c, 'number_t', 144);
+
+echo "\nTEST145 insert numbers with SQLT_INT\n";
+
+$s = oci_parse($c, "INSERT INTO bind_sqltint_tab (id, number_t) VALUES (145, :n1)");
+$n1 = -23;
+oci_bind_by_name($s, ":n1", $n1, -1, SQLT_INT);
+oci_execute($s);
+
+check_col($c, 'number_t', 145);
+
+echo "\nTEST146 insert numbers\n";
+
+$s = oci_parse($c, "INSERT INTO bind_sqltint_tab (id, number_t) VALUES (146, :n1)");
+$n1 = "-23";
+oci_bind_by_name($s, ":n1", $n1, -1, SQLT_INT);
+oci_execute($s);
+
+check_col($c, 'number_t', 146);
+
+echo "\nTEST147 insert numbers with SQLT_INT\n";
+
+$s = oci_parse($c, "INSERT INTO bind_sqltint_tab (id, number_t) VALUES (147, :n1)");
+$n1 = "23";
+oci_bind_by_name($s, ":n1", $n1, -1, SQLT_INT);
+oci_execute($s);
+
+check_col($c, 'number_t', 147);
+
+echo "\nTEST148 insert numbers with SQLT_INT\n";
+
+$s = oci_parse($c, "INSERT INTO bind_sqltint_tab (id, number_t92) VALUES (148, :n1)");
+$n1 = 123.56;
+oci_bind_by_name($s, ":n1", $n1, -1, SQLT_INT);
+oci_execute($s);
+
+check_col($c, 'number_t92', 148);
+
+echo "\nTEST149 insert numbers with SQLT_INT\n";
+
+$s = oci_parse($c, "INSERT INTO bind_sqltint_tab (id, number_t92) VALUES (149, :n1)");
+$n1 = "123.56";
+oci_bind_by_name($s, ":n1", $n1, -1, SQLT_INT);
+oci_execute($s);
+
+check_col($c, 'number_t92', 149);
+
+echo "\nTEST150 insert numbers with SQLT_INT\n";
+
+$s = oci_parse($c, "INSERT INTO bind_sqltint_tab (id, number_t92) VALUES (150, :n1)");
+$n1 = "";
+oci_bind_by_name($s, ":n1", $n1, -1, SQLT_INT);
+oci_execute($s);
+
+check_col($c, 'number_t92', 150);
+
+// Clean up
+
+$stmtarray = array(
+ "drop table bind_sqltint_tab"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+TEST141 wrong bind type SQLT_INT
+array(1) {
+ ["VARCHAR2_T10"]=>
+ array(1) {
+ [0]=>
+ string(1) "0"
+ }
+}
+
+TEST142 insert numbers SQLT_INT
+array(1) {
+ ["NUMBER_T"]=>
+ array(1) {
+ [0]=>
+ string(2) "42"
+ }
+}
+
+TEST143 insert numbers, SQLT_INT
+array(1) {
+ ["NUMBER_T"]=>
+ array(1) {
+ [0]=>
+ string(2) "42"
+ }
+}
+
+TEST144 insert numbers with SQLT_INT
+array(1) {
+ ["NUMBER_T"]=>
+ array(1) {
+ [0]=>
+ string(1) "0"
+ }
+}
+
+TEST145 insert numbers with SQLT_INT
+array(1) {
+ ["NUMBER_T"]=>
+ array(1) {
+ [0]=>
+ string(3) "-23"
+ }
+}
+
+TEST146 insert numbers
+array(1) {
+ ["NUMBER_T"]=>
+ array(1) {
+ [0]=>
+ string(3) "-23"
+ }
+}
+
+TEST147 insert numbers with SQLT_INT
+array(1) {
+ ["NUMBER_T"]=>
+ array(1) {
+ [0]=>
+ string(2) "23"
+ }
+}
+
+TEST148 insert numbers with SQLT_INT
+array(1) {
+ ["NUMBER_T92"]=>
+ array(1) {
+ [0]=>
+ string(3) "123"
+ }
+}
+
+TEST149 insert numbers with SQLT_INT
+array(1) {
+ ["NUMBER_T92"]=>
+ array(1) {
+ [0]=>
+ string(3) "123"
+ }
+}
+
+TEST150 insert numbers with SQLT_INT
+array(1) {
+ ["NUMBER_T92"]=>
+ array(1) {
+ [0]=>
+ string(1) "0"
+ }
+}
+===DONE===
--- /dev/null
+--TEST--
+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
+
+require(dirname(__FILE__).'/connect.inc');
+
+// Initialization
+
+$stmtarray = array(
+ "drop table bind_sqltnum_tab",
+
+ "create table bind_sqltnum_tab (
+ id number,
+ varchar2_t10 varchar2(10),
+ number_t number,
+ number_t92 number(9,2))"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+function check_col($c, $colname, $id)
+{
+ $s = oci_parse($c, "select $colname from bind_sqltnum_tab where id = :id");
+ oci_bind_by_name($s, ":id", $id);
+ oci_execute($s);
+ oci_fetch_all($s, $r);
+ var_dump($r);
+}
+
+
+// Run Test
+
+echo "Test 1 - baseline test\n";
+
+$s = oci_parse($c, "INSERT INTO bind_sqltnum_tab (id, varchar2_t10) VALUES (100, :c2)");
+$c2 = "Hood";
+$r = oci_bind_by_name($s, ":c2", $c2, -1);
+if (!$r) {
+ $e = oci_error($s);
+ var_dump($e);
+}
+$r = oci_execute($s, OCI_DEFAULT);
+if (!$r) {
+ $e = oci_error($s);
+ var_dump($e);
+}
+
+$s = oci_parse($c, "select id, varchar2_t10 from bind_sqltnum_tab");
+oci_execute($s);
+oci_fetch_all($s, $data);
+var_dump($data);
+
+echo "Test 2 - SQLT_NUM to a VARCHAR2 column\n";
+
+$s = oci_parse($c, "INSERT INTO bind_sqltnum_tab (id, varchar2_t10) VALUES (100, :c2)");
+$c2 = "Hood";
+$r = oci_bind_by_name($s, ":c2", $c2, -1, SQLT_NUM);
+if (!$r) {
+ $e = oci_error($s);
+ var_dump($e['message']);
+}
+$r = oci_execute($s, OCI_DEFAULT);
+if (!$r) {
+ $e = oci_error($s);
+ var_dump($e['message']);
+}
+
+echo "\nTEST41 wrong bind type SQLT_NUM\n";
+
+$c2 = "Hood41";
+$s = oci_parse($c, "INSERT INTO bind_sqltnum_tab (id, varchar2_t10) VALUES (41, :c2)");
+oci_bind_by_name($s, ":c2", $c2, -1, SQLT_NUM);
+oci_execute($s);
+
+echo "\nTEST42 insert numbers SQLT_NUM\n";
+
+$s = oci_parse($c, "INSERT INTO bind_sqltnum_tab (id, number_t) VALUES (42, :n1)");
+$n1 = 42;
+oci_bind_by_name($s, ":n1", $n1, -1, SQLT_NUM);
+oci_execute($s);
+
+check_col($c, 'number_t', 42);
+
+echo "\nTEST43 insert numbers SQLT_NUM\n";
+
+$s = oci_parse($c, "INSERT INTO bind_sqltnum_tab (id, number_t) VALUES (43, :n1)");
+$n1 = 42.69;
+oci_bind_by_name($s, ":n1", $n1, -1, SQLT_NUM);
+oci_execute($s);
+
+check_col($c, 'number_t', 43);
+
+echo "\nTEST44\n";
+
+$s = oci_parse($c, "INSERT INTO bind_sqltnum_tab (id, number_t) VALUES (44, :n1)");
+$n1 = 0;
+oci_bind_by_name($s, ":n1", $n1, -1, SQLT_NUM);
+oci_execute($s);
+
+check_col($c, 'number_t', 44);
+
+echo "\nTEST45\n";
+
+$s = oci_parse($c, "INSERT INTO bind_sqltnum_tab (id, number_t) VALUES (45, :n1)");
+$n1 = -23;
+oci_bind_by_name($s, ":n1", $n1, -1, SQLT_NUM);
+oci_execute($s);
+
+check_col($c, 'number_t', 45);
+
+echo "\nTEST46 insert numbers\n";
+
+$s = oci_parse($c, "INSERT INTO bind_sqltnum_tab (id, number_t) VALUES (46, :n1)");
+$n1 = "-23";
+oci_bind_by_name($s, ":n1", $n1, -1, SQLT_NUM);
+oci_execute($s);
+
+check_col($c, 'number_t', 46);
+
+echo "\nTEST47\n";
+
+$s = oci_parse($c, "INSERT INTO bind_sqltnum_tab (id, number_t) VALUES (47, :n1)");
+$n1 = "23";
+oci_bind_by_name($s, ":n1", $n1, -1, SQLT_NUM);
+oci_execute($s);
+
+check_col($c, 'number_t', 47);
+
+echo "\nTEST48\n";
+
+$s = oci_parse($c, "INSERT INTO bind_sqltnum_tab (id, number_t92) VALUES (48, :n1)");
+$n1 = 123.56;
+oci_bind_by_name($s, ":n1", $n1, -1, SQLT_NUM);
+oci_execute($s);
+
+check_col($c, 'number_t92', 48);
+
+echo "\nTEST49\n";
+
+$s = oci_parse($c, "INSERT INTO bind_sqltnum_tab (id, number_t92) VALUES (49, :n1)");
+$n1 = "123.56";
+oci_bind_by_name($s, ":n1", $n1, -1, SQLT_NUM);
+oci_execute($s);
+
+check_col($c, 'number_t92', 49);
+
+echo "\nTEST50\n";
+
+$s = oci_parse($c, "INSERT INTO bind_sqltnum_tab (id, number_t92) VALUES (50, :n1)");
+$n1 = "";
+oci_bind_by_name($s, ":n1", $n1, -1, SQLT_NUM);
+oci_execute($s);
+
+check_col($c, 'number_t92', 50);
+
+// Clean up
+
+$stmtarray = array(
+ "drop table bind_sqltnum_tab"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+Test 1 - baseline test
+array(2) {
+ ["ID"]=>
+ array(1) {
+ [0]=>
+ string(3) "100"
+ }
+ ["VARCHAR2_T10"]=>
+ array(1) {
+ [0]=>
+ string(4) "Hood"
+ }
+}
+Test 2 - SQLT_NUM to a VARCHAR2 column
+
+Warning: oci_execute(): ORA-12899: %s (%s: 40, %s: 10) in %sbind_sqltnum.php on line %d
+string(%d) "ORA-12899: %s"
+
+TEST41 wrong bind type SQLT_NUM
+
+Warning: oci_execute(): ORA-12899: %s "%s"."BIND_SQLTNUM_TAB"."VARCHAR2_T10" (%s: 40, %s: 10) in %sbind_sqltnum.php on line %d
+
+TEST42 insert numbers SQLT_NUM
+array(1) {
+ ["NUMBER_T"]=>
+ array(1) {
+ [0]=>
+ NULL
+ }
+}
+
+TEST43 insert numbers SQLT_NUM
+array(1) {
+ ["NUMBER_T"]=>
+ array(1) {
+ [0]=>
+ NULL
+ }
+}
+
+TEST44
+array(1) {
+ ["NUMBER_T"]=>
+ array(1) {
+ [0]=>
+ string(127) "-000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
+ }
+}
+
+TEST45
+array(1) {
+ ["NUMBER_T"]=>
+ array(1) {
+ [0]=>
+ NULL
+ }
+}
+
+TEST46 insert numbers
+array(1) {
+ ["NUMBER_T"]=>
+ array(1) {
+ [0]=>
+ NULL
+ }
+}
+
+TEST47
+array(1) {
+ ["NUMBER_T"]=>
+ array(1) {
+ [0]=>
+ NULL
+ }
+}
+
+TEST48
+array(1) {
+ ["NUMBER_T92"]=>
+ array(1) {
+ [0]=>
+ string(1) "0"
+ }
+}
+
+TEST49
+array(1) {
+ ["NUMBER_T92"]=>
+ array(1) {
+ [0]=>
+ string(1) "0"
+ }
+}
+
+TEST50
+
+Warning: oci_execute(): ORA-01438: %s in %sbind_sqltnum.php on line %d
+array(1) {
+ ["NUMBER_T92"]=>
+ array(0) {
+ }
+}
+===DONE===
--- /dev/null
+--TEST--
+Bind with various unsupported bind types
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/connect.inc');
+
+// These types are defined in oci8.c
+
+$types = array(
+ "SQLT_AVC" => SQLT_AVC,
+ "SQLT_STR" => SQLT_STR,
+ "SQLT_VCS" => SQLT_VCS,
+ "SQLT_AVC" => SQLT_AVC,
+ "SQLT_STR" => SQLT_STR,
+ "SQLT_LVC" => SQLT_LVC,
+ "SQLT_FLT" => SQLT_FLT,
+ "SQLT_UIN" => SQLT_UIN,
+ "SQLT_ODT" => SQLT_ODT,
+);
+
+foreach ($types as $t => $v) {
+
+ echo "Test - $t\n";
+
+ $s = oci_parse($c, "select * from dual where dummy = :c1");
+ $c1 = "Doug";
+ oci_bind_by_name($s, ":c1", $c1, -1, $v);
+}
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+Test - SQLT_AVC
+
+Warning: oci_bind_by_name(): Unknown or unsupported datatype given: 97 in %sbind_unsupported_1.php on line %d
+Test - SQLT_STR
+
+Warning: oci_bind_by_name(): Unknown or unsupported datatype given: 5 in %sbind_unsupported_1.php on line %d
+Test - SQLT_VCS
+
+Warning: oci_bind_by_name(): Unknown or unsupported datatype given: 9 in %sbind_unsupported_1.php on line %d
+Test - SQLT_LVC
+
+Warning: oci_bind_by_name(): Unknown or unsupported datatype given: 94 in %sbind_unsupported_1.php on line %d
+Test - SQLT_FLT
+
+Warning: oci_bind_by_name(): Unknown or unsupported datatype given: 4 in %sbind_unsupported_1.php on line %d
+Test - SQLT_UIN
+
+Warning: oci_bind_by_name(): Unknown or unsupported datatype given: 68 in %sbind_unsupported_1.php on line %d
+Test - SQLT_ODT
+
+Warning: oci_bind_by_name(): Unknown or unsupported datatype given: 156 in %sbind_unsupported_1.php on line %d
+===DONE===
--- /dev/null
+--TEST--
+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
+
+require(dirname(__FILE__).'/connect.inc');
+
+$types = array(
+ "SQLT_BDOUBLE" => SQLT_BDOUBLE,
+ "SQLT_BFLOAT" => SQLT_BFLOAT,
+);
+
+foreach ($types as $t => $v) {
+
+ echo "Test - $t\n";
+
+ $s = oci_parse($c, "select * from dual where dummy = :c1");
+ $c1 = "Doug";
+ oci_bind_by_name($s, ":c1", $c1, -1, $v);
+}
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+Test - SQLT_BDOUBLE
+
+Warning: oci_bind_by_name(): Unknown or unsupported datatype given: 22 in %sbind_unsupported_2.php on line %d
+Test - SQLT_BFLOAT
+
+Warning: oci_bind_by_name(): Unknown or unsupported datatype given: 21 in %sbind_unsupported_2.php on line %d
+===DONE===
--- /dev/null
+--TEST--
+Bind with various bind types not supported by TimesTen
+--SKIPIF--
+<?php
+$target_dbs = array('oracledb' => false, 'timesten' => true); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/connect.inc');
+
+$types = array(
+ "SQLT_CLOB" => SQLT_CLOB,
+ "SQLT_BLOB" => SQLT_BLOB,
+ "OCI_B_CLOB" => OCI_B_CLOB,
+ "OCI_B_BLOB" => OCI_B_BLOB,
+);
+
+foreach ($types as $t => $v) {
+
+ echo "Test - $t\n";
+
+ $s = oci_parse($c, "select * from dual where dummy = :c1");
+ $c1 = "Doug";
+ oci_bind_by_name($s, ":c1", $c1, -1, $v);
+}
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+Test - SQLT_CLOB
+
+Warning: oci_bind_by_name(): Unable to find descriptor property in %sbind_unsupported_3.php on line %d
+Test - SQLT_BLOB
+
+Warning: oci_bind_by_name(): Unable to find descriptor property in %sbind_unsupported_3.php on line %d
+Test - OCI_B_CLOB
+
+Warning: oci_bind_by_name(): Unable to find descriptor property in %sbind_unsupported_3.php on line %d
+Test - OCI_B_BLOB
+
+Warning: oci_bind_by_name(): Unable to find descriptor property in %sbind_unsupported_3.php on line %d
+===DONE===
"create table bug26133_tab (id number, value number)",
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- $r = @oci_execute($s);
- if (!$r) {
- $m = oci_error($s);
- if (!in_array($m['code'], array( // ignore expected errors
- 942 // table or view does not exist
- ))) {
- echo $stmt . PHP_EOL . $m['message'] . PHP_EOL;
- }
- }
-}
-
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
// Run Test
-$ora_sql = "INSERT INTO bug26133_tab (id, value) VALUES ('1','1') RETURNING ROWID INTO :v_rowid ";
+$ora_sql = "INSERT INTO bug26133_tab (id, value) VALUES (1,'1') RETURNING ROWID INTO :v_rowid ";
$statement = OCIParse($c,$ora_sql);
$rowid = OCINewDescriptor($c,OCI_D_ROWID);
"drop table bug26133_tab"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
echo "Done\n";
?>
<?php
if (!extension_loaded('oci8')) die ("skip no oci8 extension");
require(dirname(__FILE__)."/connect.inc");
-$sv = oci_server_version($c);
-$sv = preg_match('/Release 1[01]\.2\./', $sv, $matches);
-if ($sv !== 1) {
- die ("skip expected output only valid when using Oracle 19gR2 or 11gR2 databases");
-} else {
- ob_start();
- phpinfo(INFO_MODULES);
- $phpinfo = ob_get_clean();
- $iv = preg_match('/Oracle .*Version => 1[1]\./', $phpinfo);
- if ($iv != 1) {
- die ("skip test expected to work only with Oracle 11g or greater version of client");
- }
+if (preg_match('/Release 1[01]\.2\./', oci_server_version($c), $matches) !== 1) {
+ die("skip expected output only valid when using Oracle 10gR2 or 11gR2 databases");
+} else if (preg_match('/^11\./', oci_client_version()) != 1) {
+ die("skip test expected to work only with Oracle 11g or greater version of client");
}
?>
--FILE--
<?php
-require dirname(__FILE__).'/connect.inc';
+require(dirname(__FILE__).'/connect.inc');
-$create_st = array();
-$create_st[] = "drop sequence myseq";
-$create_st[] = "drop table mytab";
-$create_st[] = "create sequence myseq";
-$create_st[] = "create table mytab (mydata varchar2(20), seqcol number)";
+$stmtarray = array(
+ "drop sequence myseq",
+ "drop table mytab",
+ "create sequence myseq",
+ "create table mytab (mydata varchar2(20), seqcol number)"
+);
-foreach ($create_st as $statement) {
- $stmt = oci_parse($c, $statement);
- @oci_execute($stmt);
-}
+oci8_test_sql_execute($c, $stmtarray);
define('MYLIMIT', 200);
OCICommit($c);
-$drop_st = array();
-$drop_st[] = "drop sequence myseq";
-$drop_st[] = "drop table mytab";
+$stmtarray = array(
+ "drop sequence myseq",
+ "drop table mytab"
+);
-foreach ($create_st as $statement) {
- $stmt = oci_parse($c, $statement);
- oci_execute($stmt);
-}
+oci8_test_sql_execute($c, $stmtarray);
echo "Done\n";
?>
--FILE--
<?php
-require dirname(__FILE__).'/connect.inc';
-
-$create_st = array();
-$create_st[] = "drop sequence myseq";
-$create_st[] = "drop table mytab";
-$create_st[] = "create sequence myseq";
-$create_st[] = "create table mytab (mydata varchar2(20), seqcol number)";
+require(dirname(__FILE__).'/connect.inc');
-foreach ($create_st as $statement) {
- $stmt = oci_parse($c, $statement);
- @oci_execute($stmt);
-}
+$stmtarray = array(
+ "drop sequence myseq",
+ "drop table mytab",
+ "create sequence myseq",
+ "create table mytab (mydata varchar2(20), seqcol number)"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
define('MYLIMIT', 200);
OCICommit($c);
-$drop_st = array();
-$drop_st[] = "drop sequence myseq";
-$drop_st[] = "drop table mytab";
+$stmtarray = array(
+ "drop sequence myseq",
+ "drop table mytab"
+);
-foreach ($create_st as $statement) {
- $stmt = oci_parse($c, $statement);
- oci_execute($stmt);
-}
+oci8_test_sql_execute($c, $stmtarray);
echo "Done\n";
?>
<?php
if (!extension_loaded('oci8')) die ("skip no oci8 extension");
require(dirname(__FILE__)."/connect.inc");
-$sv = oci_server_version($c);
-$sv = preg_match('/Release 1[01]\.2\./', $sv, $matches);
-if ($sv !== 1) {
- die ("skip expected output only valid when using Oracle 10gR2 or 11gR2 database");
-} else {
- ob_start();
- phpinfo(INFO_MODULES);
- $phpinfo = ob_get_clean();
- $iv = preg_match('/Oracle .*Version => 1[1]\./', $phpinfo);
- if ($iv != 1) {
- die ("skip test expected to work only with Oracle 11g or greater version of client");
- }
+if (preg_match('/Release 1[01]\.2\./', oci_server_version($c), $matches) !== 1) {
+ die("skip expected output only valid when using Oracle 10gR2 or 11gR2 databases");
+} else if (preg_match('/^11\./', oci_client_version()) != 1) {
+ die("skip test expected to work only with Oracle 11g or greater version of client");
}
?>
--FILE--
require dirname(__FILE__).'/connect.inc';
-$create_st = array();
-$create_st[] = "drop sequence myseq";
-$create_st[] = "drop table mytab";
-$create_st[] = "create sequence myseq";
-$create_st[] = "create table mytab (mydata varchar2(20), seqcol number)";
+$stmtarray = array(
+ "drop sequence myseq",
+ "drop table mytab",
+ "create sequence myseq",
+ "create table mytab (mydata varchar2(20), seqcol number)"
+);
-foreach ($create_st as $statement) {
- $stmt = oci_parse($c, $statement);
- oci_execute($stmt);
-}
+oci8_test_sql_execute($c, $stmtarray);
define('MYLIMIT', 200);
define('INITMYBV', 11);
OCICommit($c);
-$drop_st = array();
-$drop_st[] = "drop sequence myseq";
-$drop_st[] = "drop table mytab";
+$stmtarray = array(
+ "drop sequence myseq",
+ "drop table mytab"
+);
-foreach ($create_st as $statement) {
- $stmt = oci_parse($c, $statement);
- oci_execute($stmt);
-}
+oci8_test_sql_execute($c, $stmtarray);
echo "Done\n";
?>
require dirname(__FILE__).'/connect.inc';
-$create_st = array();
-$create_st[] = "drop sequence myseq";
-$create_st[] = "drop table mytab";
-$create_st[] = "create sequence myseq";
-$create_st[] = "create table mytab (mydata varchar2(20), seqcol number)";
+$stmtarray = array(
+ "drop sequence myseq",
+ "drop table mytab",
+ "create sequence myseq",
+ "create table mytab (mydata varchar2(20), seqcol number)"
+);
-foreach ($create_st as $statement) {
- $stmt = oci_parse($c, $statement);
- oci_execute($stmt);
-}
+oci8_test_sql_execute($c, $stmtarray);
define('MYLIMIT', 200);
define('INITMYBV', 11);
OCICommit($c);
-$drop_st = array();
-$drop_st[] = "drop sequence myseq";
-$drop_st[] = "drop table mytab";
+$stmtarray = array(
+ "drop sequence myseq",
+ "drop table mytab"
+);
-foreach ($create_st as $statement) {
- $stmt = oci_parse($c, $statement);
- oci_execute($stmt);
-}
+oci8_test_sql_execute($c, $stmtarray);
echo "Done\n";
?>
<?php
if (!extension_loaded('oci8')) die ("skip no oci8 extension");
require(dirname(__FILE__)."/connect.inc");
-$sv = oci_server_version($c);
-$sv = preg_match('/Release 1[01]\.2\./', $sv, $matches);
-if ($sv !== 1) {
- die ("skip expected output only valid when using Oracle 10gR2 or 11gR2 databases");
-} else {
- ob_start();
- phpinfo(INFO_MODULES);
- $phpinfo = ob_get_clean();
- $iv = preg_match('/Oracle .*Version => 1[1]\./', $phpinfo);
- if ($iv != 1) {
- die ("skip test expected to work only with Oracle 11g or greater version of client");
- }
+if (preg_match('/Release 1[01]\.2\./', oci_server_version($c), $matches) !== 1) {
+ die("skip expected output only valid when using Oracle 10gR2 or 11gR2 databases");
+} else if (preg_match('/^11\./', oci_client_version()) != 1) {
+ die("skip test expected to work only with Oracle 11g or greater version of client");
}
?>
--FILE--
--TEST--
Bug #32325 (Cannot retrieve collection using OCI8)
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
"create or replace type bug32325_t as table of number"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- $r = @oci_execute($s);
- if (!$r) {
- $m = oci_error($s);
- if (!in_array($m['code'], array( // ignore expected errors
- 942 // table or view does not exist
- ))) {
- echo $stmt . PHP_EOL . $m['message'] . PHP_EOL;
- }
- }
-}
+oci8_test_sql_execute($c, $stmtarray);
// Run test
"drop type bug32325_t"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
echo "Done\n";
?>
--TEST--
Bug #35973 (Error ORA-24806 occurs when trying to fetch a NCLOB field)
--SKIPIF--
-<?php if (!extension_loaded("oci8")) print "skip"; ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
--TEST--
Bug #36010 (Crash when executing SQL statment with lob parameter twice)
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
echo "Done\n";
?>
---EXPECT--
+--EXPECTF--
bool(false)
bool(false)
-string(5) "'ABC'"
+string(%r[53]%r) "%r('ABC'|EXP)%r"
string(4) "CHAR"
Done
--TEST--
Bug #36403 (oci_execute no longer supports OCI_DESCRIBE_ONLY)
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+<?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
"create table bug36403_tab (c1 number, col2 number, column3 number, col4 number)"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- $r = @oci_execute($s);
- if (!$r) {
- $m = oci_error($s);
- if (!in_array($m['code'], array( // ignore expected errors
- 942 // table or view does not exist
- , 2289 // sequence does not exist
- , 4080 // trigger does not exist
- , 38802 // edition does not exist
- ))) {
- echo $stmt . PHP_EOL . $m['message'] . PHP_EOL;
- }
- }
-}
+oci8_test_sql_execute($c, $stmtarray);
// Run Test
// Clean up
-//require(dirname(__FILE__).'/drop_table.inc');
-
$stmtarray = array(
"drop table bug36403_tab"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- oci_execute($s);
-}
-
-oci_close($c);
+oci8_test_sql_execute($c, $stmtarray);
?>
===DONE===
C1
Test 2
-Warning: oci_fetch_array(): ORA-24338: %sbug36403.php on line %d
+Warning: oci_fetch_array(): ORA-%r(24338|01002)%r: %sbug36403.php on line %d
===DONE===
--TEST--
Bug #37220 (LOB Type mismatch when using windows & oci8.dll)
--SKIPIF--
-<?php if (!extension_loaded("oci8")) print "skip"; ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
"insert into bug37220_tab values(xmltype('<THETAG myID=\"1234\"></THETAG>'))"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- @oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
// Now let's update the row where myId = 1234 and change the tag
// 'THETAG' to 'MYTAG' (mycolumn is an XMLTYPE datatype and
"drop table bug37220_tab"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
echo "Done\n";
--TEST--
Bug #37581 (oci_bind_array_by_name clobbers input array when using SQLT_AFC, AVC)
--SKIPIF--
-<?php if (!extension_loaded("oci8")) print "skip"; ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
--TEST--
Bug #38173 (Freeing nested cursors causes OCI8 to segfault)
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
--TEST--
Bug #40078 (ORA-01405 when fetching NULL values using oci_bind_array_by_name())
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
--TEST--
Bug #40415 (Using oci_fetchall with nested cursors)
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
Bug #41069 (Oracle crash with certain data over a DB-link when prefetch memory limit used - Oracle bug 6039623)
--SKIPIF--
<?php
-if (!extension_loaded('oci8')) die ("skip no oci8 extension");
-require(dirname(__FILE__).'/details.inc');
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
if (empty($dbase)) die ("skip requires network connection alias for DB link loopback");
if ($test_drcp) die("skip DRCP does not support shared database links");
?>
"insert into bug41069_tab (c1, c2, c3, c4, c5, c6, c7, c9, c10, c12, c15) values
(113, 'aaaaaaa', 'bbbbbbbbbb', 'cccccc', 'e', 'f', 'dddd', '12/04/2006', '12/04/2006', 2224, 'zzzzzzz')"
- );
+);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- @oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
// Run Tests
$stmtarray = array(
"drop database link bug41069_dblink",
"drop table bug41069_tab"
- );
-
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- oci_execute($s);
-}
+);
-oci_close($c);
+oci8_test_sql_execute($c, $stmtarray);
echo "Done\n";
--TEST--
Bug #42134 (Collection error for invalid collection name)
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
--TEST--
Bug #42173 (TIMESTAMP and INTERVAL query and field functions)
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
--TEST--
Bug #42496 (LOB fetch leaks cursors, eventually failing with ORA-1000 maximum open cursors reached)
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+if ($stress_test !== true) die ('skip Slow test not run when $stress_test is FALSE');
+?>
--FILE--
<?php
"INSERT INTO bug42496_tab VALUES('test3', 'test3')"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- @oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
// Run Test
"DROP table bug42496_tab"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- @oci_execute($s);
-}
-
-oci_close($c);
+oci8_test_sql_execute($c, $stmtarray);
?>
--EXPECTF--
--TEST--
Bug #42496 (LOB fetch leaks cursors, eventually failing with ORA-1000 maximum open cursors reached)
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+if ($stress_test !== true) die ('skip Slow test not run when $stress_test is FALSE');
+?>
--FILE--
<?php
"INSERT INTO bug42496_tab VALUES('test3', 'test3')"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- @oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
// Run Test
"DROP table bug42496_tab"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- @oci_execute($s);
-}
-
-oci_close($c);
+oci8_test_sql_execute($c, $stmtarray);
?>
--EXPECTF--
--TEST--
Bug #42841 (REF CURSOR and oci_new_cursor PHP crash)
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--INI--
oci8.statement_cache_size=20
--FILE--
// Initialization
$stmtarray = array(
- "create or replace procedure bug42841_proc(out_1 out sys_refcursor) is
+ "create or replace procedure bug42841_proc(out_1 out sys_refcursor) is
begin
- open out_1 for select 11 from dual union all select 12 from dual union all select 13 from dual;
+ open out_1 for select 11 from dual union all select 12 from dual union all select 13 from dual;
end bug42841_proc;",
- "create or replace package bug43449_pkg is
- type cursortype is ref Cursor;
- function testcursor return cursortype;
- end bug43449_pkg;",
-
- "create or replace package body bug43449_pkg is
- function testcursor return cursortype is
- retCursor cursorType;
- begin
- Open retCursor For 'select * from dual';
- return retCursor;
- end;
- end bug43449_pkg;"
+ "create or replace package bug43449_pkg is
+ type cursortype is ref Cursor;
+ function testcursor return cursortype;
+ end bug43449_pkg;",
+
+ "create or replace package body bug43449_pkg is
+ function testcursor return cursortype is
+ retCursor cursorType;
+ begin
+ Open retCursor For 'select * from dual';
+ return retCursor;
+ end;
+ end bug43449_pkg;"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- @oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
// Main code
function do_bug42841($c)
{
- echo "First attempt\n";
-
- $sql = "BEGIN bug42841_proc(:cursor); END;";
- $stmt = oci_parse($c, $sql);
- $cursor = oci_new_cursor($c);
- oci_bind_by_name($stmt, ":cursor", $cursor, -1, OCI_B_CURSOR);
-
- oci_execute($stmt, OCI_DEFAULT);
- oci_execute($cursor);
-
- while($row = oci_fetch_array($cursor, OCI_ASSOC + OCI_RETURN_LOBS)) {
- $data1[] = $row;
- }
-
- oci_free_statement($stmt);
- oci_free_statement($cursor);
- var_dump($data1);
-
- echo "Second attempt\n";
-
- $sql = "BEGIN bug42841_proc(:cursor); END;";
- $stmt = oci_parse($c, $sql);
- $cursor = oci_new_cursor($c);
- oci_bind_by_name($stmt, ":cursor", $cursor, -1, OCI_B_CURSOR);
-
- oci_execute($stmt, OCI_DEFAULT);
- oci_execute($cursor);
-
- while($row = oci_fetch_array($cursor, OCI_ASSOC + OCI_RETURN_LOBS)) {
- $data2[] = $row;
- }
-
- oci_free_statement($stmt);
- oci_free_statement($cursor);
- var_dump($data2);
+ echo "First attempt\n";
+
+ $sql = "BEGIN bug42841_proc(:cursor); END;";
+ $stmt = oci_parse($c, $sql);
+ $cursor = oci_new_cursor($c);
+ oci_bind_by_name($stmt, ":cursor", $cursor, -1, OCI_B_CURSOR);
+
+ oci_execute($stmt, OCI_DEFAULT);
+ oci_execute($cursor);
+
+ while($row = oci_fetch_array($cursor, OCI_ASSOC + OCI_RETURN_LOBS)) {
+ $data1[] = $row;
+ }
+
+ oci_free_statement($stmt);
+ oci_free_statement($cursor);
+ var_dump($data1);
+
+ echo "Second attempt\n";
+
+ $sql = "BEGIN bug42841_proc(:cursor); END;";
+ $stmt = oci_parse($c, $sql);
+ $cursor = oci_new_cursor($c);
+ oci_bind_by_name($stmt, ":cursor", $cursor, -1, OCI_B_CURSOR);
+
+ oci_execute($stmt, OCI_DEFAULT);
+ oci_execute($cursor);
+
+ while($row = oci_fetch_array($cursor, OCI_ASSOC + OCI_RETURN_LOBS)) {
+ $data2[] = $row;
+ }
+
+ oci_free_statement($stmt);
+ oci_free_statement($cursor);
+ var_dump($data2);
}
function do_bug43449($c)
{
- for ($i = 0; $i < 2; $i++) {
- var_dump(bug43449_getCur($c));
- }
+ for ($i = 0; $i < 2; $i++) {
+ var_dump(bug43449_getCur($c));
+ }
}
function bug43449_getCur($c)
-{
- $cur = oci_new_cursor($c);
- $stmt = oci_parse($c, 'begin :cur := bug43449_pkg.testcursor; end;');
- oci_bind_by_name($stmt, ':cur', $cur, -1, OCI_B_CURSOR);
- oci_execute($stmt, OCI_DEFAULT);
- oci_execute($cur, OCI_DEFAULT);
-
- $ret = array();
-
- while (ocifetchinto($cur, $row, OCI_ASSOC)) {
- $ret[] = $row;
- }
-
- oci_free_statement($cur);
- oci_free_statement($stmt);
- return $ret;
+{
+ $cur = oci_new_cursor($c);
+ $stmt = oci_parse($c, 'begin :cur := bug43449_pkg.testcursor; end;');
+ oci_bind_by_name($stmt, ':cur', $cur, -1, OCI_B_CURSOR);
+ oci_execute($stmt, OCI_DEFAULT);
+ oci_execute($cur, OCI_DEFAULT);
+
+ $ret = array();
+
+ while (ocifetchinto($cur, $row, OCI_ASSOC)) {
+ $ret[] = $row;
+ }
+
+ oci_free_statement($cur);
+ oci_free_statement($stmt);
+ return $ret;
}
echo "Test bug 42841: Procedure with OUT cursor parameter\n";
// Cleanup
$stmtarray = array(
- "drop procedure bug42841_proc",
- "drop package bug43449_pkg"
+ "drop procedure bug42841_proc",
+ "drop package bug43449_pkg"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
echo "Done\n";
--TEST--
Bug #43492 (Nested cursor leaks)
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
"INSERT INTO bug43492_tab VALUES ('J')"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- @oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
/*
"DROP table bug43492_tab"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- @oci_execute($s);
-}
-
-oci_close($c);
+oci8_test_sql_execute($c, $stmtarray);
?>
--EXPECT--
--TEST--
Bug #43492 (Nested cursor leaks after related bug #44206 fixed)
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
"INSERT INTO bug43492_tab VALUES ('J')"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- @oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
function fetch($c, $i) {
$s = ociparse($c, 'select cursor(select * from bug43492_tab) c from bug43492_tab');
"DROP table bug43492_tab"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- @oci_execute($s);
-}
-
-oci_close($c);
+oci8_test_sql_execute($c, $stmtarray);
?>
--EXPECT--
Bug #43497 (OCI8 XML/getClobVal aka temporary LOBs leak UGA memory)
--SKIPIF--
<?php
-if (!extension_loaded('oci8')) die ("skip no oci8 extension");
-ob_start();
-phpinfo(INFO_MODULES);
-$phpinfo = ob_get_clean();
-$ov = preg_match('/Oracle Version => 9/', $phpinfo);
-if ($ov === 1) {
- die ("skip expected output only valid for Oracle clients from 10g onwards");
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+if ($stress_test !== true) die ('skip Slow test not run when $stress_test is FALSE');
+if (preg_match('/^1[01]\./', oci_client_version()) != 1) {
+ die("skip expected output only valid with Oracle 10g or greater version of client");
}
?>
--FILE--
--TEST--
Bug #43497 (OCI8 XML/getClobVal aka temporary LOBs leak UGA memory)
--SKIPIF--
-<?php
-if (!extension_loaded('oci8')) die ("skip no oci8 extension");
-ob_start();
-phpinfo(INFO_MODULES);
-$phpinfo = ob_get_clean();
-$ov = preg_match('/Oracle Version => 9.2/', $phpinfo);
-if ($ov !== 1) {
- die ("skip expected output only valid for Oracle 9.2 clients");
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+if ($stress_test !== true) die ('skip Slow test not run when $stress_test is FALSE');
+if (preg_match('/Unknown/', oci_client_version()) != 1) {
+ die("skip expected output only valid with Oracle 9gR2 clients");
}
?>
--FILE--
--TEST--
-Bug #44008 (Incorrect usage of OCI-Lob->close doesn't crash PHP)
+Bug #44008 (Incorrect usage of OCI-Lob->close crashes PHP)
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
end;"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- @oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
// Run Test
"drop procedure bug44008_proc"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- oci_execute($s);
-}
-
-oci_close($c);
+oci8_test_sql_execute($c, $stmtarray);
echo "Done\n";
Bug #44113 (New collection creation can fail with OCI-22303)
--SKIPIF--
<?php
-if (!extension_loaded('oci8')) die ("skip no oci8 extension");
-require(dirname(__FILE__).'/details.inc');
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
if ($stress_test !== true) die ('skip Slow test not run when $stress_test is FALSE');
?>
--FILE--
"create or replace type bug44113_list_t as table of number"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- @oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
// Run Test
// The test can take some time to complete and can exceed PHP's test
"drop type bug44113_list_t"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- oci_execute($s);
-}
-
-oci_close($c);
+oci8_test_sql_execute($c, $stmtarray);
echo "Done\n";
--TEST--
Bug #44206 (Test if selecting ref cursors leads to ORA-1000 maximum open cursors reached)
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
echo "Test 1\n";
-$stmt = 'select dummy "a", dummy "20" from dual';
+$stmt = 'select dummy "A", dummy "20" from dual';
$s = oci_parse($c, $stmt);
oci_execute($s);
$r = oci_fetch_all($s, $data, 0, -1, OCI_FETCHSTATEMENT_BY_ROW);
var_dump($data);
var_dump($data[0]);
-var_dump($data[0]["a"]);
+var_dump($data[0]["A"]);
var_dump($data[0]["20"]);
oci_free_statement($s);
oci_execute($s);
$r = oci_fetch_all($s, $data, 0, -1, OCI_ASSOC);
var_dump($data);
-var_dump($data["a"]);
+var_dump($data["A"]);
var_dump($data["20"]);
-var_dump($data["a"][0]);
+var_dump($data["A"][0]);
var_dump($data["20"][0]);
oci_free_statement($s);
array(1) {
[0]=>
array(2) {
- ["a"]=>
+ ["A"]=>
string(1) "X"
[20]=>
string(1) "X"
}
}
array(2) {
- ["a"]=>
+ ["A"]=>
string(1) "X"
[20]=>
string(1) "X"
string(1) "X"
Test 2
array(2) {
- ["a"]=>
+ ["A"]=>
array(1) {
[0]=>
string(1) "X"
--TEST--
Bug #46994 (CLOB size does not update when using CLOB IN OUT param in stored procedure)
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
end bug46994_proc2;"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- @oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
// Run Test
"drop procedure bug46994_proc2"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
oci_close($c);
--TEST--
Bug #47189 (Multiple oci_fetch_all calls)
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs: different error handling for this undefined behavior
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
require(dirname(__FILE__).'/connect.inc');
+echo "Test 1\n";
+
$s = oci_parse($c, "select * from dual");
oci_execute($s);
oci_fetch_all($s, $rs, 0, -1, OCI_FETCHSTATEMENT_BY_ROW);
oci_fetch_all($s, $rs1, 0, -1, OCI_FETCHSTATEMENT_BY_ROW);
var_dump($rs1);
+echo "Test 2\n";
+
$s = oci_parse($c, "select * from dual");
oci_execute($s);
oci_fetch_all($s, $rs, 0, 1, OCI_FETCHSTATEMENT_BY_ROW);
===DONE===
<?php exit(0); ?>
--EXPECTF--
+Test 1
array(1) {
[0]=>
array(1) {
}
array(0) {
}
+Test 2
array(1) {
[0]=>
array(1) {
--TEST--
Bug #47281 ($php_errormsg is limited in size of characters)
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--ENV--
NLS_LANG=.AL32UTF8
--FILE--
end;"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- $r = @oci_execute($s);
- if (!$r) {
- $m = oci_error($s);
- if (!in_array($m['code'], array( // ignore expected errors
- 942 // table or view does not exist
- , 2289 // sequence does not exist
- , 4080 // trigger does not exist
- , 38802 // edition does not exist
- ))) {
- echo $stmt . PHP_EOL . $m['message'] . PHP_EOL;
- }
- }
-}
+oci8_test_sql_execute($c, $stmtarray);
// Run Test
// Clean up
$stmtarray = array(
- "drop procedure bug47281_sp"
+ "drop procedure bug47281_sp"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
?>
===DONE===
--- /dev/null
+--TEST--
+Bug #47281 ($php_errormsg is limited in size of characters)
+--SKIPIF--
+<?php
+$target_dbs = array('oracledb' => false, 'timesten' => true); // test runs on these DBs: shorter message length in TimesTen
+require(dirname(__FILE__).'/skipif.inc');
+?>
+--ENV--
+NLS_LANG=.AL32UTF8
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/connect.inc');
+
+// Initialization
+
+$stmtarray = array(
+ "create or replace procedure bug47281_sp as
+ begin
+ raise_application_error(-20000,
+ 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaBcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccDeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeFggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggghhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhIjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjKlllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllM');
+ end;"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+// Run Test
+
+echo "Test 1\n";
+
+$s = oci_parse($c, 'begin bug47281_sp; end;');
+$r = @oci_execute($s);
+
+if (!$r) {
+ $m = oci_error($s);
+ echo $m['message'], "\n";
+}
+
+echo "Test 2\n";
+
+echo $php_errormsg. "\n";
+
+// Clean up
+
+$stmtarray = array(
+ "drop procedure bug47281_sp"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+Test 1
+ORA-57000: TT8507: ORA-20000: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+Test 2
+oci_execute(): ORA-57000: TT8507: ORA-20000: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+===DONE===
--TEST--
Bug #51253 (oci_bind_array_by_name() array references)
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
--- /dev/null
+--TEST--
+Bug #51291 (oci_error() doesn't report last error when called two times)
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/connect.inc');
+
+echo "Test 1 - Parse\n";
+
+$s = @oci_parse($c, "select ' from dual");
+if (!$s) {
+ var_dump(oci_error($c));
+ echo "2nd call\n";
+ var_dump(oci_error($c));
+}
+
+echo "\nTest 2 - Parse\n";
+
+$s = @oci_parse($c, "select ' from dual");
+if (!$s) {
+ var_dump(oci_error(), oci_error($c), oci_error($s));
+ echo "2nd call\n";
+ var_dump(oci_error(), oci_error($c), oci_error($s));
+}
+
+echo "\nTest 3 - Execute\n";
+
+$s = @oci_parse($c, 'select doesnotexist from dual');
+$r = @oci_execute($s, OCI_DEFAULT);
+if (!$r) {
+ var_dump(oci_error($s));
+ echo "2nd call\n";
+ var_dump(oci_error($s));
+}
+
+echo "\nTest 4 - Execute - consecutive oci_error calls of different kinds\n";
+
+$s = @oci_parse($c, 'select doesnotexist from dual');
+$r = @oci_execute($s, OCI_DEFAULT);
+if (!$r) {
+ var_dump(oci_error(), oci_error($c), oci_error($s));
+ echo "2nd call\n";
+ var_dump(oci_error(), oci_error($c), oci_error($s));
+}
+
+
+echo "\nTest 5 - Execute - after oci_rollback\n";
+
+$s = @oci_parse($c, 'select doesnotexist from dual');
+$r = @oci_execute($s, OCI_DEFAULT);
+if (!$r) {
+ var_dump(oci_error(), oci_error($c), oci_error($s));
+ $r = oci_rollback($c);
+ echo "Rollback status is ";
+ if (is_null($r)) echo "null";
+ else if ($r === false) echo "false";
+ else if ($r === true) echo "true";
+ else echo $r;
+ echo "\n";
+ echo "2nd call after oci_rollback\n";
+ var_dump(oci_error(), oci_error($c), oci_error($s));
+}
+
+
+echo "\nTest 6 - Execute - after successful 2nd query with new handle\n";
+
+$s = @oci_parse($c, 'select doesnotexist from dual');
+$r = @oci_execute($s, OCI_DEFAULT);
+if (!$r) {
+ var_dump(oci_error(), oci_error($c), oci_error($s));
+ $s2 = oci_parse($c, 'select 1 from dual');
+ $r = oci_execute($s2, OCI_DEFAULT);
+ echo "Execute status is ";
+ if (is_null($r)) echo "null";
+ else if ($r === false) echo "false";
+ else if ($r === true) echo "true";
+ else echo $r;
+ echo "\n";
+ echo "2nd call after successful execute\n";
+ var_dump(oci_error(), oci_error($c), oci_error($s), oci_error($s2));
+}
+
+
+echo "\nTest 7 - Execute - after successful 2nd query with same handle\n";
+
+$s = @oci_parse($c, 'select doesnotexist from dual');
+$r = @oci_execute($s, OCI_DEFAULT);
+if (!$r) {
+ var_dump(oci_error(), oci_error($c), oci_error($s));
+ $s = oci_parse($c, 'select 1 from dual');
+ $r = oci_execute($s, OCI_DEFAULT);
+ echo "Execute status is ";
+ if (is_null($r)) echo "null";
+ else if ($r === false) echo "false";
+ else if ($r === true) echo "true";
+ else echo $r;
+ echo "\n";
+ echo "2nd call after successful execute\n";
+ var_dump(oci_error(), oci_error($c), oci_error($s));
+}
+
+
+echo "\nTest 8 - Execute - after unsuccessful 2nd query with new handle\n";
+
+$s = @oci_parse($c, 'select doesnotexist from dual');
+$r = @oci_execute($s, OCI_DEFAULT);
+if (!$r) {
+ var_dump(oci_error(), oci_error($c), oci_error($s));
+ $s2 = oci_parse($c, 'select reallynothere from dual');
+ $r = oci_execute($s2, OCI_DEFAULT);
+ echo "Execute status is ";
+ if (is_null($r)) echo "null";
+ else if ($r === false) echo "false";
+ else if ($r === true) echo "true";
+ else echo $r;
+ echo "\n";
+ echo "2nd call after unsuccessful execute\n";
+ var_dump(oci_error(), oci_error($c), oci_error($s), oci_error($s2));
+}
+
+echo "\nTest 9 - Execute - after unsuccessful 2nd query with same handle\n";
+
+$s = @oci_parse($c, 'select doesnotexist from dual');
+$r = @oci_execute($s, OCI_DEFAULT);
+if (!$r) {
+ var_dump(oci_error(), oci_error($c), oci_error($s));
+ $s = oci_parse($c, 'select reallynothere from dual');
+ $r = oci_execute($s, OCI_DEFAULT);
+ echo "Execute status is ";
+ if (is_null($r)) echo "null";
+ else if ($r === false) echo "false";
+ else if ($r === true) echo "true";
+ else echo $r;
+ echo "\n";
+ echo "2nd call after unsuccessful execute\n";
+ var_dump(oci_error(), oci_error($c), oci_error($s));
+}
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+Test 1 - Parse
+array(4) {
+ ["code"]=>
+ int(1756)
+ ["message"]=>
+ string(48) "ORA-01756: %s"
+ ["offset"]=>
+ int(0)
+ ["sqltext"]=>
+ string(0) ""
+}
+2nd call
+array(4) {
+ ["code"]=>
+ int(1756)
+ ["message"]=>
+ string(48) "ORA-01756: %s"
+ ["offset"]=>
+ int(0)
+ ["sqltext"]=>
+ string(0) ""
+}
+
+Test 2 - Parse
+
+Warning: oci_error() expects parameter 1 to be resource, boolean given in %sbug51291_1.php on line %d
+bool(false)
+array(4) {
+ ["code"]=>
+ int(1756)
+ ["message"]=>
+ string(48) "ORA-01756: %s"
+ ["offset"]=>
+ int(0)
+ ["sqltext"]=>
+ string(0) ""
+}
+NULL
+2nd call
+
+Warning: oci_error() expects parameter 1 to be resource, boolean given in %sbug51291_1.php on line %d
+bool(false)
+array(4) {
+ ["code"]=>
+ int(1756)
+ ["message"]=>
+ string(48) "ORA-01756: %s"
+ ["offset"]=>
+ int(0)
+ ["sqltext"]=>
+ string(0) ""
+}
+NULL
+
+Test 3 - Execute
+array(4) {
+ ["code"]=>
+ int(904)
+ ["message"]=>
+ string(%d) "ORA-00904:%sDOESNOTEXIST%s"
+ ["offset"]=>
+ int(%d)
+ ["sqltext"]=>
+ string(29) "select doesnotexist from dual"
+}
+2nd call
+array(4) {
+ ["code"]=>
+ int(904)
+ ["message"]=>
+ string(%d) "ORA-00904:%sDOESNOTEXIST%s"
+ ["offset"]=>
+ int(%d)
+ ["sqltext"]=>
+ string(29) "select doesnotexist from dual"
+}
+
+Test 4 - Execute - consecutive oci_error calls of different kinds
+bool(false)
+bool(false)
+array(4) {
+ ["code"]=>
+ int(904)
+ ["message"]=>
+ string(%d) "ORA-00904:%sDOESNOTEXIST%s"
+ ["offset"]=>
+ int(%d)
+ ["sqltext"]=>
+ string(29) "select doesnotexist from dual"
+}
+2nd call
+bool(false)
+bool(false)
+array(4) {
+ ["code"]=>
+ int(904)
+ ["message"]=>
+ string(%d) "ORA-00904:%sDOESNOTEXIST%s"
+ ["offset"]=>
+ int(%d)
+ ["sqltext"]=>
+ string(29) "select doesnotexist from dual"
+}
+
+Test 5 - Execute - after oci_rollback
+bool(false)
+bool(false)
+array(4) {
+ ["code"]=>
+ int(904)
+ ["message"]=>
+ string(%d) "ORA-00904:%sDOESNOTEXIST%s"
+ ["offset"]=>
+ int(%d)
+ ["sqltext"]=>
+ string(29) "select doesnotexist from dual"
+}
+Rollback status is true
+2nd call after oci_rollback
+bool(false)
+bool(false)
+array(4) {
+ ["code"]=>
+ int(904)
+ ["message"]=>
+ string(%d) "ORA-00904:%sDOESNOTEXIST%s"
+ ["offset"]=>
+ int(%d)
+ ["sqltext"]=>
+ string(29) "select doesnotexist from dual"
+}
+
+Test 6 - Execute - after successful 2nd query with new handle
+bool(false)
+bool(false)
+array(4) {
+ ["code"]=>
+ int(904)
+ ["message"]=>
+ string(%d) "ORA-00904:%sDOESNOTEXIST%s"
+ ["offset"]=>
+ int(%d)
+ ["sqltext"]=>
+ string(29) "select doesnotexist from dual"
+}
+Execute status is true
+2nd call after successful execute
+bool(false)
+bool(false)
+array(4) {
+ ["code"]=>
+ int(904)
+ ["message"]=>
+ string(%d) "ORA-00904:%sDOESNOTEXIST%s"
+ ["offset"]=>
+ int(%d)
+ ["sqltext"]=>
+ string(29) "select doesnotexist from dual"
+}
+bool(false)
+
+Test 7 - Execute - after successful 2nd query with same handle
+bool(false)
+bool(false)
+array(4) {
+ ["code"]=>
+ int(904)
+ ["message"]=>
+ string(%d) "ORA-00904:%sDOESNOTEXIST%s"
+ ["offset"]=>
+ int(%d)
+ ["sqltext"]=>
+ string(29) "select doesnotexist from dual"
+}
+Execute status is true
+2nd call after successful execute
+bool(false)
+bool(false)
+bool(false)
+
+Test 8 - Execute - after unsuccessful 2nd query with new handle
+bool(false)
+bool(false)
+array(4) {
+ ["code"]=>
+ int(904)
+ ["message"]=>
+ string(%d) "ORA-00904:%sDOESNOTEXIST%s"
+ ["offset"]=>
+ int(%d)
+ ["sqltext"]=>
+ string(29) "select doesnotexist from dual"
+}
+
+Warning: oci_execute(): ORA-00904: %sREALLYNOTHERE%s in %sbug51291_1.php on line %d
+Execute status is false
+2nd call after unsuccessful execute
+bool(false)
+bool(false)
+array(4) {
+ ["code"]=>
+ int(904)
+ ["message"]=>
+ string(%d) "ORA-00904:%sDOESNOTEXIST%s"
+ ["offset"]=>
+ int(%d)
+ ["sqltext"]=>
+ string(29) "select doesnotexist from dual"
+}
+array(4) {
+ ["code"]=>
+ int(904)
+ ["message"]=>
+ string(%d) "ORA-00904%sREALLYNOTHERE%s"
+ ["offset"]=>
+ int(%d)
+ ["sqltext"]=>
+ string(30) "select reallynothere from dual"
+}
+
+Test 9 - Execute - after unsuccessful 2nd query with same handle
+bool(false)
+bool(false)
+array(4) {
+ ["code"]=>
+ int(904)
+ ["message"]=>
+ string(%d) "ORA-00904:%sDOESNOTEXIST%s"
+ ["offset"]=>
+ int(%d)
+ ["sqltext"]=>
+ string(29) "select doesnotexist from dual"
+}
+
+Warning: oci_execute(): ORA-00904: %sREALLYNOTHERE%s in %sbug51291_1.php on line %d
+Execute status is false
+2nd call after unsuccessful execute
+bool(false)
+bool(false)
+array(4) {
+ ["code"]=>
+ int(904)
+ ["message"]=>
+ string(%d) "ORA-00904%sREALLYNOTHERE%s"
+ ["offset"]=>
+ int(%d)
+ ["sqltext"]=>
+ string(30) "select reallynothere from dual"
+}
+===DONE===
--- /dev/null
+--TEST--
+Bug #51291 (oci_error() doesn't report last error when called two times)
+--SKIPIF--
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs: different error messages from TimesTen
+require(dirname(__FILE__).'/skipif.inc');
+?>
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/connect.inc');
+
+echo "\nTest 1 - Execute - after successful 2nd query with same statement\n";
+
+$s = oci_parse($c, "declare e exception; begin if :bv = 1 then raise e; end if; end;");
+$bv = 1;
+oci_bind_by_name($s, ":bv", $bv);
+$r = @oci_execute($s, OCI_DEFAULT);
+if (!$r) {
+ var_dump(oci_error(), oci_error($c), oci_error($s));
+ $bv = 0;
+ $r = oci_execute($s, OCI_DEFAULT);
+ echo "Execute status is ";
+ if (is_null($r)) echo "null";
+ else if ($r === false) echo "false";
+ else if ($r === true) echo "true";
+ else echo $r;
+ echo "\n";
+ echo "2nd call after successful execute\n";
+ var_dump(oci_error(), oci_error($c), oci_error($s));
+}
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+Test 1 - Execute - after successful 2nd query with same statement
+bool(false)
+bool(false)
+array(4) {
+ ["code"]=>
+ int(6510)
+ ["message"]=>
+ string(72) "ORA-06510: PL/SQL: %s
+ORA-06512: %s"
+ ["offset"]=>
+ int(0)
+ ["sqltext"]=>
+ string(64) "declare e exception; begin if :bv = 1 then raise e; end if; end;"
+}
+Execute status is true
+2nd call after successful execute
+bool(false)
+bool(false)
+bool(false)
+===DONE===
--TEST--
oci_new_collection()
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
--TEST--
oci_new_collection() + free()
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
--TEST--
oci_new_collection() + free()
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
--TEST--
collection methods
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
--TEST--
collection methods
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
--TEST--
oci_collection_assign()
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
--TEST--
oci_collection_assign()
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
--TEST--
ocinewcollection()
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
--TEST--
ocinewcollection() + free()
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
--TEST--
ocinewcollection() + free()
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
--TEST--
collection methods
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
--TEST--
ocicollassign()
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
--TEST--
collections and wrong dates
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
--TEST--
collections and wrong dates
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
--TEST--
collections and nulls
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
--TEST--
collections and nulls
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
--TEST--
collections and strings
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
--TEST--
collections and strings
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
--TEST--
collections and correct dates
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
--TEST--
collections and correct dates
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
--TEST--
collections and correct dates (2)
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
--TEST--
collections and correct dates (2)
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
--TEST--
collections and strings (2)
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
--TEST--
collections and strings (2)
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
--TEST--
collections and numbers (2)
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
--TEST--
collections and numbers (2)
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
--TEST--
collections and negative/too big element indexes
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
--TEST--
collections and negative/too big element indexes
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
--TEST--
collections and nulls (2)
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
--TEST--
collections and nulls (2)
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
--TEST--
Collection trim tests
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
--TEST--
Test collection Oracle error handling collections and numbers (2)
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
--TEST--
Test OCI_NO_AUTO_COMMIT constant
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
--TEST--
Test oci_commit failure
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
y int constraint commit_002_tab_check_y check ( y > 0 ) deferrable initially deferred)"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- $r = @oci_execute($s);
- if (!$r) {
- $m = oci_error($s);
- if (!in_array($m['code'], array( // ignore expected errors
- 942 // table or view does not exist
- , 2289 // sequence does not exist
- , 4080 // trigger does not exist
- , 38802 // edition does not exist
- ))) {
- echo $stmt . PHP_EOL . $m['message'] . PHP_EOL;
- }
- }
-}
+oci8_test_sql_execute($c, $stmtarray);
// Run Test
"drop table commit_002_tab"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- oci_execute($s);
-}
-
-oci_close($c);
+oci8_test_sql_execute($c, $stmtarray);
?>
===DONE===
--TEST--
ocicommit()/ocirollback()
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
Set and get of connection attributes with all types of connections.
--SKIPIF--
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension");
-require(dirname(__FILE__)."/connect.inc");
+$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");
if ($test_drcp) die("skip output might vary with DRCP");
-$sv = oci_server_version($c);
-$sv = preg_match('/Release 1[012]\./', $sv, $matches);
-if ($sv == 1) {
- ob_start();
- phpinfo(INFO_MODULES);
- $phpinfo = ob_get_clean();
- $iv = preg_match('/Oracle .*Version => 1[012]\./', $phpinfo);
- if ($iv != 1) {
- die ("skip test expected to work only with Oracle 10g or greater client ");
- }
-}
-else {
- die ("skip test expected to work only with Oracle 10g or greater server");
+if (preg_match('/Release 1[01]\./', oci_server_version($c), $matches) !== 1) {
+ 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");
}
?>
--TEST--
Set and get of connection attributes across persistent connections and sysdba connection.
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension");
-require(dirname(__FILE__)."/connect.inc");
+<?php
+$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");
if ($test_drcp) die("skip output might vary with DRCP");
-$sv = oci_server_version($c);
-$sv = preg_match('/Release 1[012]\./', $sv, $matches);
-if ($sv == 1) {
- ob_start();
- phpinfo(INFO_MODULES);
- $phpinfo = ob_get_clean();
- $iv = preg_match('/Oracle .*Version => 1[012]\./', $phpinfo);
- if ($iv != 1) {
- die ("skip test expected to work only with Oracle 10g or greater version of client");
- }
-}
-else {
- die ("skip test expected to work only with Oracle 10g or greater version of server");
+if (preg_match('/Release 1[01]\./', oci_server_version($c), $matches) !== 1) {
+ 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
--TEST--
Set and get of connection attributes with oci_close().
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension");
-require(dirname(__FILE__)."/connect.inc");
+<?php
+$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");
if ($test_drcp) die("skip output might vary with DRCP");
-$sv = oci_server_version($c);
-$sv = preg_match('/Release 1[012]\./', $sv, $matches);
-if ($sv == 1) {
- ob_start();
- phpinfo(INFO_MODULES);
- $phpinfo = ob_get_clean();
- $iv = preg_match('/Oracle .*Version => 1[012]\./', $phpinfo);
- if ($iv != 1) {
- die ("skip test expected to work only with Oracle 10g or greater version of client");
- }
-}
-else {
- die ("skip test expected to work only with Oracle 10g or greater version of server");
+if (preg_match('/Release 1[01]\./', oci_server_version($c), $matches) !== 1) {
+ 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--
--TEST--
Set and get of connection attributes with errors.
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension");
-require(dirname(__FILE__)."/connect.inc");
+<?php
+$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");
if ($test_drcp) die("skip output might vary with DRCP");
if ($stress_test !== true) die ('skip Slow test not run when $stress_test is FALSE');
-$sv = oci_server_version($c);
-$sv = preg_match('/Release 1[012]\./', $sv, $matches);
-if ($sv == 1) {
- ob_start();
- phpinfo(INFO_MODULES);
- $phpinfo = ob_get_clean();
- $iv = preg_match('/Oracle .*Version => 1[012]\./', $phpinfo);
- if ($iv != 1) {
- die ("skip test expected to work only with Oracle 10g or greater version of client");
- }
-}
-else {
- die ("skip test expected to work only with Oracle 10g or greater version of server");
+if (preg_match('/Release (11\.2|12)\./', oci_server_version($c), $matches) !== 1) {
+ // Bug fixed in 11.2 prevents client_info being rest
+ 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
+
+
require(dirname(__FILE__)."/conn_attr.inc");
$user='testuser';
get_attr($c1,'ACTION');
// Testing with different types of values
+// NB. This may diff in 11.1.0.6 due to a bug causing CLIENT_INFO of NULL to be ignored.
echo "\nSetting to different values \n";
$values_array = array(1000,NULL,'this is a very huge string with a length > 64 !!!!!this is a very huge string with a length > 64 !!!!!this is a very huge string with a length > 64 !!!!!this is a very huge string with a length > 64 !!!!!');
--TEST--
Set and get connection attributes with scope end.
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension");
-require(dirname(__FILE__)."/connect.inc");
+<?php
+$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");
if ($test_drcp) die("skip output might vary with DRCP");
-$sv = oci_server_version($c);
-$sv = preg_match('/Release 1[012]\./', $sv, $matches);
-if ($sv == 1) {
- ob_start();
- phpinfo(INFO_MODULES);
- $phpinfo = ob_get_clean();
- $iv = preg_match('/Oracle .*Version => 1[012]\./', $phpinfo);
- if ($iv != 1) {
- die ("skip test expected to work only with Oracle 10g or greater version of client");
- }
-}
-else {
- die ("skip test expected to work only with Oracle 10g or greater version of server");
+if (preg_match('/Release 1[01]\./', oci_server_version($c), $matches) !== 1) {
+ 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--
}
if (!$c) {
- echo "connect.inc: Failed to connect as '$user' to '$dbase'\n";
- $e = oci_error();
- echo $e['message']."\n";
+ $m = oci_error();
+ trigger_error("connect.inc: Failed to connect as '$user' to '$dbase': ". $m['message'], E_USER_ERROR);
}
?>
else
$c1 = oci_new_connect($user,$password);
-foreach ($stmtarray as $stmt) {
- $s1 = oci_parse($c1, $stmt);
- @oci_execute($s1);
-}
+oci8_test_sql_execute($c1, $stmtarray);
// Run Test
"drop table connect_scope1_tab"
);
-foreach ($stmtarray as $stmt) {
- $s1 = oci_parse($c1, $stmt);
- oci_execute($s1);
-}
+oci8_test_sql_execute($c1, $stmtarray);
echo "Done\n";
else
$c1 = oci_new_connect($user,$password);
-foreach ($stmtarray as $stmt) {
- $s1 = oci_parse($c1, $stmt);
- @oci_execute($s1);
-}
+oci8_test_sql_execute($c1, $stmtarray);
// Run Test
"drop table connect_scope2_tab"
);
-foreach ($stmtarray as $stmt) {
- $s1 = oci_parse($c1, $stmt);
- oci_execute($s1);
-}
+oci8_test_sql_execute($c1, $stmtarray);
echo "Done\n";
else
$c1 = oci_new_connect($user,$password);
-foreach ($stmtarray as $stmt) {
- $s1 = oci_parse($c1, $stmt);
- @oci_execute($s1);
-}
+oci8_test_sql_execute($c1, $stmtarray);
// Run Test
"drop table scope_try1_tab"
);
-foreach ($stmtarray as $stmt) {
- $s1 = oci_parse($c1, $stmt);
- oci_execute($s1);
-}
+oci8_test_sql_execute($c1, $stmtarray);
echo "Done\n";
?>
--EXPECTF--
Test 1
-Caught Exception: oci_execute(): ORA-00984: %s
+Caught Exception: oci_execute(): ORA-%r(00984|57000: TT2957)%r: %s
resource(%d) of type (oci8 connection)
array(1) {
["C1"]=>
else
$c1 = oci_new_connect($user,$password);
-foreach ($stmtarray as $stmt) {
- $s1 = oci_parse($c1, $stmt);
- @oci_execute($s1);
-}
+oci8_test_sql_execute($c1, $stmtarray);
// Run Test
"drop table scope_try2_tab"
);
-foreach ($stmtarray as $stmt) {
- $s1 = oci_parse($c1, $stmt);
- oci_execute($s1);
-}
+oci8_test_sql_execute($c1, $stmtarray);
echo "Done\n";
?>
--EXPECTF--
Test 1
-Caught Exception: oci_execute(): ORA-00984: %s
+Caught Exception: oci_execute(): ORA-%r(00984|57000: TT2957)%r: %s
resource(%d) of type (oci8 connection)
array(1) {
["C1"]=>
else
$c1 = oci_new_connect($user,$password);
-foreach ($stmtarray as $stmt) {
- $s1 = oci_parse($c1, $stmt);
- @oci_execute($s1);
-}
+oci8_test_sql_execute($c1, $stmtarray);
// Run Test
"drop table scope_try3_tab"
);
-foreach ($stmtarray as $stmt) {
- $s1 = oci_parse($c1, $stmt);
- oci_execute($s1);
-}
+oci8_test_sql_execute($c1, $stmtarray);
echo "Done\n";
?>
--EXPECTF--
Test 1
-Caught Exception: oci_execute(): ORA-00984: %s
+Caught Exception: oci_execute(): ORA-%r(00984|57000: TT2957)%r: %s
resource(%d) of type (oci8 connection)
array(1) {
["C1"]=>
else
$c1 = oci_new_connect($user,$password);
-foreach ($stmtarray as $stmt) {
- $s1 = oci_parse($c1, $stmt);
- @oci_execute($s1);
-}
+oci8_test_sql_execute($c1, $stmtarray);
// Run Test
"drop table scope_try4_tab"
);
-foreach ($stmtarray as $stmt) {
- $s1 = oci_parse($c1, $stmt);
- oci_execute($s1);
-}
+oci8_test_sql_execute($c1, $stmtarray);
echo "Done\n";
?>
--EXPECTF--
Test 1
-Caught Exception: oci_execute(): ORA-00984: %s
+Caught Exception: oci_execute(): ORA-%r(00984|57000: TT2957)%r: %s
resource(%d) of type (oci8 connection)
array(1) {
["C1"]=>
else
$c1 = oci_new_connect($user,$password);
-foreach ($stmtarray as $stmt) {
- $s1 = oci_parse($c1, $stmt);
- @oci_execute($s1);
-}
+oci8_test_sql_execute($c1, $stmtarray);
// Run Test
"drop table scope_try5_tab"
);
-foreach ($stmtarray as $stmt) {
- $s1 = oci_parse($c1, $stmt);
- oci_execute($s1);
-}
+oci8_test_sql_execute($c1, $stmtarray);
echo "Done\n";
?>
--EXPECTF--
Test 1
-Caught Exception: oci_execute(): ORA-00984: %s
+Caught Exception: oci_execute(): ORA-%r(00984|57000: TT2957)%r: %s
resource(%d) of type (oci8 persistent connection)
array(1) {
["C1"]=>
else
$c1 = oci_new_connect($user,$password);
-foreach ($stmtarray as $stmt) {
- $s1 = oci_parse($c1, $stmt);
- @oci_execute($s1);
-}
+oci8_test_sql_execute($c1, $stmtarray);
// Run Test
"drop table scope_try6_tab"
);
-foreach ($stmtarray as $stmt) {
- $s1 = oci_parse($c1, $stmt);
- oci_execute($s1);
-}
+oci8_test_sql_execute($c1, $stmtarray);
echo "Done\n";
?>
--EXPECTF--
Test 1
-Caught Exception: oci_execute(): ORA-00984: %s
+Caught Exception: oci_execute(): ORA-%r(00984|57000: TT2957)%r: %s
resource(%d) of type (oci8 persistent connection)
array(1) {
["C1"]=>
if ($ov != 1) {
die ("skip Test only valid when OCI8 is built with an ORACLE_HOME");
}
-$iv = preg_match('/Oracle .*Version => (11\.2|12)/', $phpinfo);
-if ($iv != 1) {
- die ("skip tests a feature that works only with Oracle 11gR2 or greater version of client");
+if (preg_match('/^11\.2|12\./', oci_client_version()) != 1) {
+ die("skip test expected to work only with Oracle 11gR2 or greater version of client");
}
?>
--ENV--
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");
+if (preg_match('/^10\.2\./', oci_client_version()) != 1) {
+ die("skip test expected to work only with Oracle 10gR2 client libraries");
}
?>
--ENV--
if ($ov !== 1) {
die ("skip Test only valid when OCI8 is built with an ORACLE_HOME");
}
-$iv = preg_match('/Oracle .*Version => (11\.2|12)/', $phpinfo);
-if ($iv != 1) {
- die ("skip tests a feature that works only with Oracle 11gR2 or greater version of client");
+if (preg_match('/^11\.2|12\./', oci_client_version()) != 1) {
+ die("skip test expected to work only with Oracle 11gR2 or greater version of client");
}
?>
--ENV--
<?php
- if ($c) {
- $ora_sql = "DROP TABLE ".$schema.$table_name;
- $statement = oci_parse($c, $ora_sql);
- @oci_execute($statement);
-
- $ora_sql = "CREATE TABLE ".$schema.$table_name." (id NUMBER, value NUMBER, blob BLOB, clob CLOB, string VARCHAR(10))";
- $statement = oci_parse($c, $ora_sql);
- oci_execute($statement);
- }
+if ($c) {
+
+
+ $stmtarray = array(
+ "DROP TABLE ".$schema.$table_name,
+ "CREATE TABLE ".$schema.$table_name." (id NUMBER, value NUMBER, blob BLOB, clob CLOB, string VARCHAR(10))"
+ );
+
+ oci8_test_sql_execute($c, $stmtarray);
+
+}
?>
--TEST--
bind and fetch cursor from a statement
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
-require dirname(__FILE__)."/connect.inc";
-
-$drop_table = "DROP TABLE ".$schema.$table_name."";
+require(dirname(__FILE__)."/connect.inc");
-if (!($s = oci_parse($c, $drop_table))) {
- die("oci_parse(drop) failed!\n");
-}
+// Initialization
-@oci_execute($s);
-
-$create_table = "CREATE TABLE ".$schema.$table_name." (id NUMBER, value VARCHAR(20))";
-
-if (!($s = oci_parse($c, $create_table))) {
- die("oci_parse(create) failed!\n");
-}
-
-if (!oci_execute($s)) {
- die("oci_execute(create) failed!\n");
-}
-
-$insert_sql = "INSERT INTO ".$schema.$table_name." (id, value) VALUES (1,1)";
-
-if (!($s = oci_parse($c, $insert_sql))) {
- die("oci_parse(insert) failed!\n");
-}
-
-for ($i = 0; $i<3; $i++) {
- if (!oci_execute($s)) {
- die("oci_execute(insert) failed!\n");
- }
-}
-
-if (!oci_commit($c)) {
- die("oci_commit() failed!\n");
-}
+$stmtarray = array(
+ "drop table cursor_bind_tab",
+ "create table cursor_bind_tab (id NUMBER, value VARCHAR(20))",
+ "insert into cursor_bind_tab values (1, '1')",
+ "insert into cursor_bind_tab values (1, '1')",
+ "insert into cursor_bind_tab values (1, '1')"
+);
+oci8_test_sql_execute($c, $stmtarray);
$sql = "
DECLARE
TYPE curtype IS REF CURSOR;
cursor_var curtype;
BEGIN
- OPEN cursor_var FOR SELECT id, value FROM ".$schema.$table_name.";
- :curs := cursor_var;
+ OPEN cursor_var FOR SELECT id, value FROM cursor_bind_tab;
+ :curs := cursor_var;
END;
";
var_dump(oci_fetch_row($cursor));
var_dump(oci_fetch_row($cursor));
-echo "Done\n";
+// Clean up
-$drop_table = "DROP TABLE ".$schema.$table_name."";
-
-if (!($s = oci_parse($c, $drop_table))) {
- die("oci_parse(drop) failed!\n");
-}
+$stmtarray = array(
+ "drop table cursor_bind_tab"
+);
-@oci_execute($s);
+oci8_test_sql_execute($c, $stmtarray);
?>
---EXPECT--
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
array(2) {
[0]=>
string(1) "1"
string(1) "1"
}
bool(false)
-Done
+===DONE===
--TEST--
binding a cursor (with errors)
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
"insert into cursor_bind_err_tab (id, value) values (1,1)",
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- $r = @oci_execute($s);
- if (!$r) {
- $m = oci_error($s);
- if (!in_array($m['code'], array( // ignore expected errors
- 942 // table or view does not exist
- ))) {
- echo $stmt . PHP_EOL . $m['message'] . PHP_EOL;
- }
- }
-}
-
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
// Run Test
"drop table cursor_bind_err_tab"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
echo "Done\n";
--TEST--
fetching cursor from a statement
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
--TEST--
fetching cursor from a statement
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
"insert into cursors_old_tab (id, value) values (1,1)",
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- $r = @oci_execute($s);
- if (!$r) {
- $m = oci_error($s);
- if (!in_array($m['code'], array( // ignore expected errors
- 942 // table or view does not exist
- ))) {
- echo $stmt . PHP_EOL . $m['message'] . PHP_EOL;
- }
- }
-}
-
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
// Run Test
"drop table cursors_old_tab"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
echo "Done\n";
--- /dev/null
+--TEST--
+PL/SQL: dbms_output
+--SKIPIF--
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/connect.inc');
+
+// Initialization
+
+$stmtarray = array(
+ "create or replace procedure dbmsoutput_proc as
+ begin
+ dbms_output.put_line('Hello World!');
+ end;",
+
+ "create or replace type dorow as table of varchar2(4000)",
+
+ "create or replace function mydofetch return dorow pipelined is
+ line varchar2(4000);
+ status integer;
+ begin
+ loop
+ dbms_output.get_line(line, status);
+ exit when status = 1;
+ pipe row (line);
+ end loop;
+ return;
+ end;"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+// Run Test
+
+// Turn DBMS_OUTPUT on
+function setserveroutputon($c)
+{
+ $s = oci_parse($c, "begin dbms_output.enable(null); end;");
+ oci_execute($s);
+}
+
+// Create some output
+function createoutput($c, $prefix)
+{
+ $s = oci_parse($c, "call dbms_output.put_line(:bv1 || ' ' || :bv2 || ' Hello, world! Lots and lots and ... of text')");
+ oci_bind_by_name($s, ":bv1", $i, -1, SQLT_INT);
+ oci_bind_by_name($s, ":bv2", $prefix);
+ for ($i = 0; $i < 100; ++$i) {
+ oci_execute($s);
+ }
+}
+
+// Call dbms_output.get_line()
+// Returns an array of DBMS_OUTPUT lines, or false.
+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;
+}
+
+function getdbmsoutput_do2($c)
+{
+ $orignumlines = $numlines = 100;
+ $s = oci_parse($c, "begin dbms_output.get_lines(:lines, :numlines); end;");
+ $r = oci_bind_by_name($s, ":numlines", $numlines);
+ $res = array();
+ while ($numlines >= $orignumlines) {
+ oci_bind_array_by_name($s, ":lines", $lines, $numlines, 255, SQLT_CHR);
+ oci_execute($s);
+ if ($numlines == 0) {
+ break;
+ }
+ $res = array_merge($res, array_slice($lines, 0, $numlines));
+ unset($lines);
+ }
+ return $res;
+}
+
+function getdbmsoutput_pl($c)
+{
+ $s = oci_parse($c, "select * from table(mydofetch())");
+ oci_execute($s);
+ $res = false;
+ while ($row = oci_fetch_array($s, OCI_NUM)) {
+ $res[] = $row[0];
+ }
+ return $res;
+}
+
+echo "Test 1\n";
+
+setserveroutputon($c); // Turn output buffering on
+
+$s = oci_parse($c, 'call dbmsoutput_proc()');
+oci_execute($s);
+var_dump(getdbmsoutput_do($c));
+
+echo "Test 2\n";
+
+createoutput($c, 'test 2');
+var_dump(getdbmsoutput_do($c));
+
+echo "Test 3\n";
+
+createoutput($c, 'test 3');
+var_dump(getdbmsoutput_do2($c));
+
+echo "Test 4\n";
+
+createoutput($c, 'test 4');
+var_dump(getdbmsoutput_pl($c));
+
+// Clean up
+
+$stmtarray = array(
+ "drop procedure dbmsoutput_proc"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+Test 1
+array(1) {
+ [0]=>
+ string(12) "Hello World!"
+}
+Test 2
+array(100) {
+ [0]=>
+ string(52) "0 test 2 Hello, world! Lots and lots and ... of text"
+ [1]=>
+ string(52) "1 test 2 Hello, world! Lots and lots and ... of text"
+ [2]=>
+ string(52) "2 test 2 Hello, world! Lots and lots and ... of text"
+ [3]=>
+ string(52) "3 test 2 Hello, world! Lots and lots and ... of text"
+ [4]=>
+ string(52) "4 test 2 Hello, world! Lots and lots and ... of text"
+ [5]=>
+ string(52) "5 test 2 Hello, world! Lots and lots and ... of text"
+ [6]=>
+ string(52) "6 test 2 Hello, world! Lots and lots and ... of text"
+ [7]=>
+ string(52) "7 test 2 Hello, world! Lots and lots and ... of text"
+ [8]=>
+ string(52) "8 test 2 Hello, world! Lots and lots and ... of text"
+ [9]=>
+ string(52) "9 test 2 Hello, world! Lots and lots and ... of text"
+ [10]=>
+ string(53) "10 test 2 Hello, world! Lots and lots and ... of text"
+ [11]=>
+ string(53) "11 test 2 Hello, world! Lots and lots and ... of text"
+ [12]=>
+ string(53) "12 test 2 Hello, world! Lots and lots and ... of text"
+ [13]=>
+ string(53) "13 test 2 Hello, world! Lots and lots and ... of text"
+ [14]=>
+ string(53) "14 test 2 Hello, world! Lots and lots and ... of text"
+ [15]=>
+ string(53) "15 test 2 Hello, world! Lots and lots and ... of text"
+ [16]=>
+ string(53) "16 test 2 Hello, world! Lots and lots and ... of text"
+ [17]=>
+ string(53) "17 test 2 Hello, world! Lots and lots and ... of text"
+ [18]=>
+ string(53) "18 test 2 Hello, world! Lots and lots and ... of text"
+ [19]=>
+ string(53) "19 test 2 Hello, world! Lots and lots and ... of text"
+ [20]=>
+ string(53) "20 test 2 Hello, world! Lots and lots and ... of text"
+ [21]=>
+ string(53) "21 test 2 Hello, world! Lots and lots and ... of text"
+ [22]=>
+ string(53) "22 test 2 Hello, world! Lots and lots and ... of text"
+ [23]=>
+ string(53) "23 test 2 Hello, world! Lots and lots and ... of text"
+ [24]=>
+ string(53) "24 test 2 Hello, world! Lots and lots and ... of text"
+ [25]=>
+ string(53) "25 test 2 Hello, world! Lots and lots and ... of text"
+ [26]=>
+ string(53) "26 test 2 Hello, world! Lots and lots and ... of text"
+ [27]=>
+ string(53) "27 test 2 Hello, world! Lots and lots and ... of text"
+ [28]=>
+ string(53) "28 test 2 Hello, world! Lots and lots and ... of text"
+ [29]=>
+ string(53) "29 test 2 Hello, world! Lots and lots and ... of text"
+ [30]=>
+ string(53) "30 test 2 Hello, world! Lots and lots and ... of text"
+ [31]=>
+ string(53) "31 test 2 Hello, world! Lots and lots and ... of text"
+ [32]=>
+ string(53) "32 test 2 Hello, world! Lots and lots and ... of text"
+ [33]=>
+ string(53) "33 test 2 Hello, world! Lots and lots and ... of text"
+ [34]=>
+ string(53) "34 test 2 Hello, world! Lots and lots and ... of text"
+ [35]=>
+ string(53) "35 test 2 Hello, world! Lots and lots and ... of text"
+ [36]=>
+ string(53) "36 test 2 Hello, world! Lots and lots and ... of text"
+ [37]=>
+ string(53) "37 test 2 Hello, world! Lots and lots and ... of text"
+ [38]=>
+ string(53) "38 test 2 Hello, world! Lots and lots and ... of text"
+ [39]=>
+ string(53) "39 test 2 Hello, world! Lots and lots and ... of text"
+ [40]=>
+ string(53) "40 test 2 Hello, world! Lots and lots and ... of text"
+ [41]=>
+ string(53) "41 test 2 Hello, world! Lots and lots and ... of text"
+ [42]=>
+ string(53) "42 test 2 Hello, world! Lots and lots and ... of text"
+ [43]=>
+ string(53) "43 test 2 Hello, world! Lots and lots and ... of text"
+ [44]=>
+ string(53) "44 test 2 Hello, world! Lots and lots and ... of text"
+ [45]=>
+ string(53) "45 test 2 Hello, world! Lots and lots and ... of text"
+ [46]=>
+ string(53) "46 test 2 Hello, world! Lots and lots and ... of text"
+ [47]=>
+ string(53) "47 test 2 Hello, world! Lots and lots and ... of text"
+ [48]=>
+ string(53) "48 test 2 Hello, world! Lots and lots and ... of text"
+ [49]=>
+ string(53) "49 test 2 Hello, world! Lots and lots and ... of text"
+ [50]=>
+ string(53) "50 test 2 Hello, world! Lots and lots and ... of text"
+ [51]=>
+ string(53) "51 test 2 Hello, world! Lots and lots and ... of text"
+ [52]=>
+ string(53) "52 test 2 Hello, world! Lots and lots and ... of text"
+ [53]=>
+ string(53) "53 test 2 Hello, world! Lots and lots and ... of text"
+ [54]=>
+ string(53) "54 test 2 Hello, world! Lots and lots and ... of text"
+ [55]=>
+ string(53) "55 test 2 Hello, world! Lots and lots and ... of text"
+ [56]=>
+ string(53) "56 test 2 Hello, world! Lots and lots and ... of text"
+ [57]=>
+ string(53) "57 test 2 Hello, world! Lots and lots and ... of text"
+ [58]=>
+ string(53) "58 test 2 Hello, world! Lots and lots and ... of text"
+ [59]=>
+ string(53) "59 test 2 Hello, world! Lots and lots and ... of text"
+ [60]=>
+ string(53) "60 test 2 Hello, world! Lots and lots and ... of text"
+ [61]=>
+ string(53) "61 test 2 Hello, world! Lots and lots and ... of text"
+ [62]=>
+ string(53) "62 test 2 Hello, world! Lots and lots and ... of text"
+ [63]=>
+ string(53) "63 test 2 Hello, world! Lots and lots and ... of text"
+ [64]=>
+ string(53) "64 test 2 Hello, world! Lots and lots and ... of text"
+ [65]=>
+ string(53) "65 test 2 Hello, world! Lots and lots and ... of text"
+ [66]=>
+ string(53) "66 test 2 Hello, world! Lots and lots and ... of text"
+ [67]=>
+ string(53) "67 test 2 Hello, world! Lots and lots and ... of text"
+ [68]=>
+ string(53) "68 test 2 Hello, world! Lots and lots and ... of text"
+ [69]=>
+ string(53) "69 test 2 Hello, world! Lots and lots and ... of text"
+ [70]=>
+ string(53) "70 test 2 Hello, world! Lots and lots and ... of text"
+ [71]=>
+ string(53) "71 test 2 Hello, world! Lots and lots and ... of text"
+ [72]=>
+ string(53) "72 test 2 Hello, world! Lots and lots and ... of text"
+ [73]=>
+ string(53) "73 test 2 Hello, world! Lots and lots and ... of text"
+ [74]=>
+ string(53) "74 test 2 Hello, world! Lots and lots and ... of text"
+ [75]=>
+ string(53) "75 test 2 Hello, world! Lots and lots and ... of text"
+ [76]=>
+ string(53) "76 test 2 Hello, world! Lots and lots and ... of text"
+ [77]=>
+ string(53) "77 test 2 Hello, world! Lots and lots and ... of text"
+ [78]=>
+ string(53) "78 test 2 Hello, world! Lots and lots and ... of text"
+ [79]=>
+ string(53) "79 test 2 Hello, world! Lots and lots and ... of text"
+ [80]=>
+ string(53) "80 test 2 Hello, world! Lots and lots and ... of text"
+ [81]=>
+ string(53) "81 test 2 Hello, world! Lots and lots and ... of text"
+ [82]=>
+ string(53) "82 test 2 Hello, world! Lots and lots and ... of text"
+ [83]=>
+ string(53) "83 test 2 Hello, world! Lots and lots and ... of text"
+ [84]=>
+ string(53) "84 test 2 Hello, world! Lots and lots and ... of text"
+ [85]=>
+ string(53) "85 test 2 Hello, world! Lots and lots and ... of text"
+ [86]=>
+ string(53) "86 test 2 Hello, world! Lots and lots and ... of text"
+ [87]=>
+ string(53) "87 test 2 Hello, world! Lots and lots and ... of text"
+ [88]=>
+ string(53) "88 test 2 Hello, world! Lots and lots and ... of text"
+ [89]=>
+ string(53) "89 test 2 Hello, world! Lots and lots and ... of text"
+ [90]=>
+ string(53) "90 test 2 Hello, world! Lots and lots and ... of text"
+ [91]=>
+ string(53) "91 test 2 Hello, world! Lots and lots and ... of text"
+ [92]=>
+ string(53) "92 test 2 Hello, world! Lots and lots and ... of text"
+ [93]=>
+ string(53) "93 test 2 Hello, world! Lots and lots and ... of text"
+ [94]=>
+ string(53) "94 test 2 Hello, world! Lots and lots and ... of text"
+ [95]=>
+ string(53) "95 test 2 Hello, world! Lots and lots and ... of text"
+ [96]=>
+ string(53) "96 test 2 Hello, world! Lots and lots and ... of text"
+ [97]=>
+ string(53) "97 test 2 Hello, world! Lots and lots and ... of text"
+ [98]=>
+ string(53) "98 test 2 Hello, world! Lots and lots and ... of text"
+ [99]=>
+ string(53) "99 test 2 Hello, world! Lots and lots and ... of text"
+}
+Test 3
+array(100) {
+ [0]=>
+ string(52) "0 test 3 Hello, world! Lots and lots and ... of text"
+ [1]=>
+ string(52) "1 test 3 Hello, world! Lots and lots and ... of text"
+ [2]=>
+ string(52) "2 test 3 Hello, world! Lots and lots and ... of text"
+ [3]=>
+ string(52) "3 test 3 Hello, world! Lots and lots and ... of text"
+ [4]=>
+ string(52) "4 test 3 Hello, world! Lots and lots and ... of text"
+ [5]=>
+ string(52) "5 test 3 Hello, world! Lots and lots and ... of text"
+ [6]=>
+ string(52) "6 test 3 Hello, world! Lots and lots and ... of text"
+ [7]=>
+ string(52) "7 test 3 Hello, world! Lots and lots and ... of text"
+ [8]=>
+ string(52) "8 test 3 Hello, world! Lots and lots and ... of text"
+ [9]=>
+ string(52) "9 test 3 Hello, world! Lots and lots and ... of text"
+ [10]=>
+ string(53) "10 test 3 Hello, world! Lots and lots and ... of text"
+ [11]=>
+ string(53) "11 test 3 Hello, world! Lots and lots and ... of text"
+ [12]=>
+ string(53) "12 test 3 Hello, world! Lots and lots and ... of text"
+ [13]=>
+ string(53) "13 test 3 Hello, world! Lots and lots and ... of text"
+ [14]=>
+ string(53) "14 test 3 Hello, world! Lots and lots and ... of text"
+ [15]=>
+ string(53) "15 test 3 Hello, world! Lots and lots and ... of text"
+ [16]=>
+ string(53) "16 test 3 Hello, world! Lots and lots and ... of text"
+ [17]=>
+ string(53) "17 test 3 Hello, world! Lots and lots and ... of text"
+ [18]=>
+ string(53) "18 test 3 Hello, world! Lots and lots and ... of text"
+ [19]=>
+ string(53) "19 test 3 Hello, world! Lots and lots and ... of text"
+ [20]=>
+ string(53) "20 test 3 Hello, world! Lots and lots and ... of text"
+ [21]=>
+ string(53) "21 test 3 Hello, world! Lots and lots and ... of text"
+ [22]=>
+ string(53) "22 test 3 Hello, world! Lots and lots and ... of text"
+ [23]=>
+ string(53) "23 test 3 Hello, world! Lots and lots and ... of text"
+ [24]=>
+ string(53) "24 test 3 Hello, world! Lots and lots and ... of text"
+ [25]=>
+ string(53) "25 test 3 Hello, world! Lots and lots and ... of text"
+ [26]=>
+ string(53) "26 test 3 Hello, world! Lots and lots and ... of text"
+ [27]=>
+ string(53) "27 test 3 Hello, world! Lots and lots and ... of text"
+ [28]=>
+ string(53) "28 test 3 Hello, world! Lots and lots and ... of text"
+ [29]=>
+ string(53) "29 test 3 Hello, world! Lots and lots and ... of text"
+ [30]=>
+ string(53) "30 test 3 Hello, world! Lots and lots and ... of text"
+ [31]=>
+ string(53) "31 test 3 Hello, world! Lots and lots and ... of text"
+ [32]=>
+ string(53) "32 test 3 Hello, world! Lots and lots and ... of text"
+ [33]=>
+ string(53) "33 test 3 Hello, world! Lots and lots and ... of text"
+ [34]=>
+ string(53) "34 test 3 Hello, world! Lots and lots and ... of text"
+ [35]=>
+ string(53) "35 test 3 Hello, world! Lots and lots and ... of text"
+ [36]=>
+ string(53) "36 test 3 Hello, world! Lots and lots and ... of text"
+ [37]=>
+ string(53) "37 test 3 Hello, world! Lots and lots and ... of text"
+ [38]=>
+ string(53) "38 test 3 Hello, world! Lots and lots and ... of text"
+ [39]=>
+ string(53) "39 test 3 Hello, world! Lots and lots and ... of text"
+ [40]=>
+ string(53) "40 test 3 Hello, world! Lots and lots and ... of text"
+ [41]=>
+ string(53) "41 test 3 Hello, world! Lots and lots and ... of text"
+ [42]=>
+ string(53) "42 test 3 Hello, world! Lots and lots and ... of text"
+ [43]=>
+ string(53) "43 test 3 Hello, world! Lots and lots and ... of text"
+ [44]=>
+ string(53) "44 test 3 Hello, world! Lots and lots and ... of text"
+ [45]=>
+ string(53) "45 test 3 Hello, world! Lots and lots and ... of text"
+ [46]=>
+ string(53) "46 test 3 Hello, world! Lots and lots and ... of text"
+ [47]=>
+ string(53) "47 test 3 Hello, world! Lots and lots and ... of text"
+ [48]=>
+ string(53) "48 test 3 Hello, world! Lots and lots and ... of text"
+ [49]=>
+ string(53) "49 test 3 Hello, world! Lots and lots and ... of text"
+ [50]=>
+ string(53) "50 test 3 Hello, world! Lots and lots and ... of text"
+ [51]=>
+ string(53) "51 test 3 Hello, world! Lots and lots and ... of text"
+ [52]=>
+ string(53) "52 test 3 Hello, world! Lots and lots and ... of text"
+ [53]=>
+ string(53) "53 test 3 Hello, world! Lots and lots and ... of text"
+ [54]=>
+ string(53) "54 test 3 Hello, world! Lots and lots and ... of text"
+ [55]=>
+ string(53) "55 test 3 Hello, world! Lots and lots and ... of text"
+ [56]=>
+ string(53) "56 test 3 Hello, world! Lots and lots and ... of text"
+ [57]=>
+ string(53) "57 test 3 Hello, world! Lots and lots and ... of text"
+ [58]=>
+ string(53) "58 test 3 Hello, world! Lots and lots and ... of text"
+ [59]=>
+ string(53) "59 test 3 Hello, world! Lots and lots and ... of text"
+ [60]=>
+ string(53) "60 test 3 Hello, world! Lots and lots and ... of text"
+ [61]=>
+ string(53) "61 test 3 Hello, world! Lots and lots and ... of text"
+ [62]=>
+ string(53) "62 test 3 Hello, world! Lots and lots and ... of text"
+ [63]=>
+ string(53) "63 test 3 Hello, world! Lots and lots and ... of text"
+ [64]=>
+ string(53) "64 test 3 Hello, world! Lots and lots and ... of text"
+ [65]=>
+ string(53) "65 test 3 Hello, world! Lots and lots and ... of text"
+ [66]=>
+ string(53) "66 test 3 Hello, world! Lots and lots and ... of text"
+ [67]=>
+ string(53) "67 test 3 Hello, world! Lots and lots and ... of text"
+ [68]=>
+ string(53) "68 test 3 Hello, world! Lots and lots and ... of text"
+ [69]=>
+ string(53) "69 test 3 Hello, world! Lots and lots and ... of text"
+ [70]=>
+ string(53) "70 test 3 Hello, world! Lots and lots and ... of text"
+ [71]=>
+ string(53) "71 test 3 Hello, world! Lots and lots and ... of text"
+ [72]=>
+ string(53) "72 test 3 Hello, world! Lots and lots and ... of text"
+ [73]=>
+ string(53) "73 test 3 Hello, world! Lots and lots and ... of text"
+ [74]=>
+ string(53) "74 test 3 Hello, world! Lots and lots and ... of text"
+ [75]=>
+ string(53) "75 test 3 Hello, world! Lots and lots and ... of text"
+ [76]=>
+ string(53) "76 test 3 Hello, world! Lots and lots and ... of text"
+ [77]=>
+ string(53) "77 test 3 Hello, world! Lots and lots and ... of text"
+ [78]=>
+ string(53) "78 test 3 Hello, world! Lots and lots and ... of text"
+ [79]=>
+ string(53) "79 test 3 Hello, world! Lots and lots and ... of text"
+ [80]=>
+ string(53) "80 test 3 Hello, world! Lots and lots and ... of text"
+ [81]=>
+ string(53) "81 test 3 Hello, world! Lots and lots and ... of text"
+ [82]=>
+ string(53) "82 test 3 Hello, world! Lots and lots and ... of text"
+ [83]=>
+ string(53) "83 test 3 Hello, world! Lots and lots and ... of text"
+ [84]=>
+ string(53) "84 test 3 Hello, world! Lots and lots and ... of text"
+ [85]=>
+ string(53) "85 test 3 Hello, world! Lots and lots and ... of text"
+ [86]=>
+ string(53) "86 test 3 Hello, world! Lots and lots and ... of text"
+ [87]=>
+ string(53) "87 test 3 Hello, world! Lots and lots and ... of text"
+ [88]=>
+ string(53) "88 test 3 Hello, world! Lots and lots and ... of text"
+ [89]=>
+ string(53) "89 test 3 Hello, world! Lots and lots and ... of text"
+ [90]=>
+ string(53) "90 test 3 Hello, world! Lots and lots and ... of text"
+ [91]=>
+ string(53) "91 test 3 Hello, world! Lots and lots and ... of text"
+ [92]=>
+ string(53) "92 test 3 Hello, world! Lots and lots and ... of text"
+ [93]=>
+ string(53) "93 test 3 Hello, world! Lots and lots and ... of text"
+ [94]=>
+ string(53) "94 test 3 Hello, world! Lots and lots and ... of text"
+ [95]=>
+ string(53) "95 test 3 Hello, world! Lots and lots and ... of text"
+ [96]=>
+ string(53) "96 test 3 Hello, world! Lots and lots and ... of text"
+ [97]=>
+ string(53) "97 test 3 Hello, world! Lots and lots and ... of text"
+ [98]=>
+ string(53) "98 test 3 Hello, world! Lots and lots and ... of text"
+ [99]=>
+ string(53) "99 test 3 Hello, world! Lots and lots and ... of text"
+}
+Test 4
+array(100) {
+ [0]=>
+ string(52) "0 test 4 Hello, world! Lots and lots and ... of text"
+ [1]=>
+ string(52) "1 test 4 Hello, world! Lots and lots and ... of text"
+ [2]=>
+ string(52) "2 test 4 Hello, world! Lots and lots and ... of text"
+ [3]=>
+ string(52) "3 test 4 Hello, world! Lots and lots and ... of text"
+ [4]=>
+ string(52) "4 test 4 Hello, world! Lots and lots and ... of text"
+ [5]=>
+ string(52) "5 test 4 Hello, world! Lots and lots and ... of text"
+ [6]=>
+ string(52) "6 test 4 Hello, world! Lots and lots and ... of text"
+ [7]=>
+ string(52) "7 test 4 Hello, world! Lots and lots and ... of text"
+ [8]=>
+ string(52) "8 test 4 Hello, world! Lots and lots and ... of text"
+ [9]=>
+ string(52) "9 test 4 Hello, world! Lots and lots and ... of text"
+ [10]=>
+ string(53) "10 test 4 Hello, world! Lots and lots and ... of text"
+ [11]=>
+ string(53) "11 test 4 Hello, world! Lots and lots and ... of text"
+ [12]=>
+ string(53) "12 test 4 Hello, world! Lots and lots and ... of text"
+ [13]=>
+ string(53) "13 test 4 Hello, world! Lots and lots and ... of text"
+ [14]=>
+ string(53) "14 test 4 Hello, world! Lots and lots and ... of text"
+ [15]=>
+ string(53) "15 test 4 Hello, world! Lots and lots and ... of text"
+ [16]=>
+ string(53) "16 test 4 Hello, world! Lots and lots and ... of text"
+ [17]=>
+ string(53) "17 test 4 Hello, world! Lots and lots and ... of text"
+ [18]=>
+ string(53) "18 test 4 Hello, world! Lots and lots and ... of text"
+ [19]=>
+ string(53) "19 test 4 Hello, world! Lots and lots and ... of text"
+ [20]=>
+ string(53) "20 test 4 Hello, world! Lots and lots and ... of text"
+ [21]=>
+ string(53) "21 test 4 Hello, world! Lots and lots and ... of text"
+ [22]=>
+ string(53) "22 test 4 Hello, world! Lots and lots and ... of text"
+ [23]=>
+ string(53) "23 test 4 Hello, world! Lots and lots and ... of text"
+ [24]=>
+ string(53) "24 test 4 Hello, world! Lots and lots and ... of text"
+ [25]=>
+ string(53) "25 test 4 Hello, world! Lots and lots and ... of text"
+ [26]=>
+ string(53) "26 test 4 Hello, world! Lots and lots and ... of text"
+ [27]=>
+ string(53) "27 test 4 Hello, world! Lots and lots and ... of text"
+ [28]=>
+ string(53) "28 test 4 Hello, world! Lots and lots and ... of text"
+ [29]=>
+ string(53) "29 test 4 Hello, world! Lots and lots and ... of text"
+ [30]=>
+ string(53) "30 test 4 Hello, world! Lots and lots and ... of text"
+ [31]=>
+ string(53) "31 test 4 Hello, world! Lots and lots and ... of text"
+ [32]=>
+ string(53) "32 test 4 Hello, world! Lots and lots and ... of text"
+ [33]=>
+ string(53) "33 test 4 Hello, world! Lots and lots and ... of text"
+ [34]=>
+ string(53) "34 test 4 Hello, world! Lots and lots and ... of text"
+ [35]=>
+ string(53) "35 test 4 Hello, world! Lots and lots and ... of text"
+ [36]=>
+ string(53) "36 test 4 Hello, world! Lots and lots and ... of text"
+ [37]=>
+ string(53) "37 test 4 Hello, world! Lots and lots and ... of text"
+ [38]=>
+ string(53) "38 test 4 Hello, world! Lots and lots and ... of text"
+ [39]=>
+ string(53) "39 test 4 Hello, world! Lots and lots and ... of text"
+ [40]=>
+ string(53) "40 test 4 Hello, world! Lots and lots and ... of text"
+ [41]=>
+ string(53) "41 test 4 Hello, world! Lots and lots and ... of text"
+ [42]=>
+ string(53) "42 test 4 Hello, world! Lots and lots and ... of text"
+ [43]=>
+ string(53) "43 test 4 Hello, world! Lots and lots and ... of text"
+ [44]=>
+ string(53) "44 test 4 Hello, world! Lots and lots and ... of text"
+ [45]=>
+ string(53) "45 test 4 Hello, world! Lots and lots and ... of text"
+ [46]=>
+ string(53) "46 test 4 Hello, world! Lots and lots and ... of text"
+ [47]=>
+ string(53) "47 test 4 Hello, world! Lots and lots and ... of text"
+ [48]=>
+ string(53) "48 test 4 Hello, world! Lots and lots and ... of text"
+ [49]=>
+ string(53) "49 test 4 Hello, world! Lots and lots and ... of text"
+ [50]=>
+ string(53) "50 test 4 Hello, world! Lots and lots and ... of text"
+ [51]=>
+ string(53) "51 test 4 Hello, world! Lots and lots and ... of text"
+ [52]=>
+ string(53) "52 test 4 Hello, world! Lots and lots and ... of text"
+ [53]=>
+ string(53) "53 test 4 Hello, world! Lots and lots and ... of text"
+ [54]=>
+ string(53) "54 test 4 Hello, world! Lots and lots and ... of text"
+ [55]=>
+ string(53) "55 test 4 Hello, world! Lots and lots and ... of text"
+ [56]=>
+ string(53) "56 test 4 Hello, world! Lots and lots and ... of text"
+ [57]=>
+ string(53) "57 test 4 Hello, world! Lots and lots and ... of text"
+ [58]=>
+ string(53) "58 test 4 Hello, world! Lots and lots and ... of text"
+ [59]=>
+ string(53) "59 test 4 Hello, world! Lots and lots and ... of text"
+ [60]=>
+ string(53) "60 test 4 Hello, world! Lots and lots and ... of text"
+ [61]=>
+ string(53) "61 test 4 Hello, world! Lots and lots and ... of text"
+ [62]=>
+ string(53) "62 test 4 Hello, world! Lots and lots and ... of text"
+ [63]=>
+ string(53) "63 test 4 Hello, world! Lots and lots and ... of text"
+ [64]=>
+ string(53) "64 test 4 Hello, world! Lots and lots and ... of text"
+ [65]=>
+ string(53) "65 test 4 Hello, world! Lots and lots and ... of text"
+ [66]=>
+ string(53) "66 test 4 Hello, world! Lots and lots and ... of text"
+ [67]=>
+ string(53) "67 test 4 Hello, world! Lots and lots and ... of text"
+ [68]=>
+ string(53) "68 test 4 Hello, world! Lots and lots and ... of text"
+ [69]=>
+ string(53) "69 test 4 Hello, world! Lots and lots and ... of text"
+ [70]=>
+ string(53) "70 test 4 Hello, world! Lots and lots and ... of text"
+ [71]=>
+ string(53) "71 test 4 Hello, world! Lots and lots and ... of text"
+ [72]=>
+ string(53) "72 test 4 Hello, world! Lots and lots and ... of text"
+ [73]=>
+ string(53) "73 test 4 Hello, world! Lots and lots and ... of text"
+ [74]=>
+ string(53) "74 test 4 Hello, world! Lots and lots and ... of text"
+ [75]=>
+ string(53) "75 test 4 Hello, world! Lots and lots and ... of text"
+ [76]=>
+ string(53) "76 test 4 Hello, world! Lots and lots and ... of text"
+ [77]=>
+ string(53) "77 test 4 Hello, world! Lots and lots and ... of text"
+ [78]=>
+ string(53) "78 test 4 Hello, world! Lots and lots and ... of text"
+ [79]=>
+ string(53) "79 test 4 Hello, world! Lots and lots and ... of text"
+ [80]=>
+ string(53) "80 test 4 Hello, world! Lots and lots and ... of text"
+ [81]=>
+ string(53) "81 test 4 Hello, world! Lots and lots and ... of text"
+ [82]=>
+ string(53) "82 test 4 Hello, world! Lots and lots and ... of text"
+ [83]=>
+ string(53) "83 test 4 Hello, world! Lots and lots and ... of text"
+ [84]=>
+ string(53) "84 test 4 Hello, world! Lots and lots and ... of text"
+ [85]=>
+ string(53) "85 test 4 Hello, world! Lots and lots and ... of text"
+ [86]=>
+ string(53) "86 test 4 Hello, world! Lots and lots and ... of text"
+ [87]=>
+ string(53) "87 test 4 Hello, world! Lots and lots and ... of text"
+ [88]=>
+ string(53) "88 test 4 Hello, world! Lots and lots and ... of text"
+ [89]=>
+ string(53) "89 test 4 Hello, world! Lots and lots and ... of text"
+ [90]=>
+ string(53) "90 test 4 Hello, world! Lots and lots and ... of text"
+ [91]=>
+ string(53) "91 test 4 Hello, world! Lots and lots and ... of text"
+ [92]=>
+ string(53) "92 test 4 Hello, world! Lots and lots and ... of text"
+ [93]=>
+ string(53) "93 test 4 Hello, world! Lots and lots and ... of text"
+ [94]=>
+ string(53) "94 test 4 Hello, world! Lots and lots and ... of text"
+ [95]=>
+ string(53) "95 test 4 Hello, world! Lots and lots and ... of text"
+ [96]=>
+ string(53) "96 test 4 Hello, world! Lots and lots and ... of text"
+ [97]=>
+ string(53) "97 test 4 Hello, world! Lots and lots and ... of text"
+ [98]=>
+ string(53) "98 test 4 Hello, world! Lots and lots and ... of text"
+ [99]=>
+ string(53) "99 test 4 Hello, world! Lots and lots and ... of text"
+}
+===DONE===
"insert into default_prefetch_tab (id, value) values (1,1)",
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- $r = @oci_execute($s);
- if (!$r) {
- $m = oci_error($s);
- if (!in_array($m['code'], array( // ignore expected errors
- 942 // table or view does not exist
- ))) {
- echo $stmt . PHP_EOL . $m['message'] . PHP_EOL;
- }
- }
-}
-
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
// Run Test
"drop table default_prefetch_tab"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- oci_execute($s);
-}
-
+oci8_test_sql_execute($c, $stmtarray);
echo "Done\n";
?>
--- /dev/null
+--TEST--
+oci8.default_prefetch ini option
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--INI--
+oci8.default_prefetch=20
+--FILE--
+<?php
+
+require(dirname(__FILE__)."/connect.inc");
+
+// Initialize
+
+$stmtarray = array(
+ "drop table default_prefetch_tab",
+ "create table default_prefetch_tab (id number, value number)",
+ "insert into default_prefetch_tab (id, value) values (1,1)",
+ "insert into default_prefetch_tab (id, value) values (1,1)",
+ "insert into default_prefetch_tab (id, value) values (1,1)",
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+// Run Test
+
+$select_sql = "select * from default_prefetch_tab";
+
+if (!($s = oci_parse($c, $select_sql))) {
+ die("oci_parse(select) failed!\n");
+}
+
+if (!oci_execute($s)) {
+ die("oci_execute(select) failed!\n");
+}
+
+var_dump(oci_fetch($s));
+
+var_dump(oci_num_rows($s));
+
+// Cleanup
+
+$stmtarray = array(
+ "drop table default_prefetch_tab"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+echo "Done\n";
+?>
+--EXPECT--
+bool(true)
+int(1)
+Done
"insert into default_prefetch1_tab (id, value) values (1,1)",
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- $r = @oci_execute($s);
- if (!$r) {
- $m = oci_error($s);
- if (!in_array($m['code'], array( // ignore expected errors
- 942 // table or view does not exist
- ))) {
- echo $stmt . PHP_EOL . $m['message'] . PHP_EOL;
- }
- }
-}
-
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
// Run Test
"drop table default_prefetch1_tab"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
echo "Done\n";
?>
"insert into default_prefetch2_tab (id, value) values (1,1)",
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- $r = @oci_execute($s);
- if (!$r) {
- $m = oci_error($s);
- if (!in_array($m['code'], array( // ignore expected errors
- 942 // table or view does not exist
- ))) {
- echo $stmt . PHP_EOL . $m['message'] . PHP_EOL;
- }
- }
-}
-
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
// Run Test
"drop table default_prefetch2_tab"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
echo "Done\n";
?>
"insert into define_tab (string) values ('some')",
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- $r = @oci_execute($s);
- if (!$r) {
- $m = oci_error($s);
- if (!in_array($m['code'], array( // ignore expected errors
- 942 // table or view does not exist
- ))) {
- echo $stmt . PHP_EOL . $m['message'] . PHP_EOL;
- }
- }
-}
+oci8_test_sql_execute($c, $stmtarray);
// Run test
"drop table define_tab"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
echo "Done\n";
--- /dev/null
+--TEST--
+oci_define_by_name()
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+require(dirname(__FILE__)."/connect.inc");
+
+// Initialize
+
+$stmtarray = array(
+ "drop table define0_tab",
+ "create table define0_tab (string varchar(10))",
+ "insert into define0_tab (string) values ('some')",
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+// Run test
+
+$stmt = oci_parse($c, "select string from define0_tab");
+
+/* the define MUST be done BEFORE ociexecute! */
+
+echo "Test 1\n";
+
+$string = '';
+oci_define_by_name($stmt, "STRING", $string, 20);
+oci_execute($stmt);
+while (oci_fetch($stmt)) {
+ var_dump($string);
+}
+
+echo "Test 2\n";
+
+$string = '';
+$s2 = oci_parse($c, 'select string from define0_tab');
+oci_define_by_name($s2, 'STRING', $string);
+oci_execute($s2);
+while (oci_fetch($s2)) {
+ var_dump($string);
+}
+
+// Cleanup
+
+$stmtarray = array(
+ "drop table define0_tab"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+Test 1
+string(%d) "some"
+Test 2
+string(%d) "some"
+===DONE===
"insert into define1_tab (string) values ('some')",
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- $r = @oci_execute($s);
- if (!$r) {
- $m = oci_error($s);
- if (!in_array($m['code'], array( // ignore expected errors
- 942 // table or view does not exist
- ))) {
- echo $stmt . PHP_EOL . $m['message'] . PHP_EOL;
- }
- }
-}
+oci8_test_sql_execute($c, $stmtarray);
// Run test
"drop table define1_tab"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
echo "Done\n";
--TEST--
Test oci_define_by_name types
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
"create table phptestrawtable( id number(10), fileimage raw(1000))"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- @oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
$stmt = oci_parse ($c, "insert into phptestrawtable (id, fileimage) values (:id, :fileimage)");
$i=1;
echo "file md5:" . md5($fi) . "\n";
}
-$stmt = oci_parse($c, "drop table phptestrawtable");
-oci_execute($stmt);
+// Cleanup
+
+$stmtarray = array(
+ "drop table phptestrawtable"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
echo "Done\n";
?>
--TEST--
Test oci_define_by_name() LOB descriptor
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
"create table phpdefblobtable (id number(10), fileimage blob)"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- @oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
// Load data
$stmt = oci_parse ($c, "insert into phpdefblobtable (id, fileimage) values (:id, empty_blob()) returning fileimage into :fileimage");
echo "file md5:" . md5($fid->load()) . "\n";
}
-$stmt = oci_parse($c, "drop table phpdefblobtable");
-oci_execute($stmt);
+$stmtarray = array(
+ "drop table phpdefblobtable"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
echo "Done\n";
"insert into define4_tab (value, string) values (1234, 'some')",
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- $r = @oci_execute($s);
- if (!$r) {
- $m = oci_error($s);
- if (!in_array($m['code'], array( // ignore expected errors
- 942 // table or view does not exist
- ))) {
- echo $stmt . PHP_EOL . $m['message'] . PHP_EOL;
- }
- }
-}
+oci8_test_sql_execute($c, $stmtarray);
// Run test
"drop table define4_tab"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
echo "Done\n";
"insert into define5_tab (id, string) values (2, 'thing')",
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- $r = @oci_execute($s);
- if (!$r) {
- $m = oci_error($s);
- if (!in_array($m['code'], array( // ignore expected errors
- 942 // table or view does not exist
- ))) {
- echo $stmt . PHP_EOL . $m['message'] . PHP_EOL;
- }
- }
-}
+oci8_test_sql_execute($c, $stmtarray);
// Run test
"drop table define5_tab"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
echo "Done\n";
--- /dev/null
+--TEST--
+oci_define_by_name tests with REF CURSORs
+--SKIPIF--
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/connect.inc');
+
+// Initialization
+
+$stmtarray = array(
+ "drop table define6_tab",
+ "create table define6_tab (id number)",
+ "insert into define6_tab values (1)"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+// Run Test
+
+$sql =
+"DECLARE
+ TYPE curtype IS REF CURSOR;
+ cursor_var curtype;
+BEGIN
+ OPEN cursor_var FOR SELECT id FROM define6_tab;
+ :curs := cursor_var;
+END;";
+
+echo "Test 1 - define last\n";
+
+$s1 = oci_parse($c, $sql);
+$cursor1 = oci_new_cursor($c);
+oci_bind_by_name($s1, ":curs", $cursor1, -1, OCI_B_CURSOR);
+oci_execute($s1);
+oci_execute($cursor1);
+oci_define_by_name($cursor1, 'ID', $id1);
+while (oci_fetch_row($cursor1)) {
+ var_dump($id1);
+}
+
+
+echo "Test 2 - define last with preset var\n";
+
+$s2 = oci_parse($c, $sql);
+$cursor2 = oci_new_cursor($c);
+oci_bind_by_name($s2, ":curs", $cursor2, -1, OCI_B_CURSOR);
+oci_execute($s2);
+oci_execute($cursor2);
+$id2 = '';
+oci_define_by_name($cursor2, 'ID', $id2);
+while (oci_fetch_row($cursor2)) {
+ var_dump($id2);
+}
+
+
+echo "Test 3 - define before cursor execute\n";
+
+$s3 = oci_parse($c, $sql);
+$cursor3 = oci_new_cursor($c);
+oci_bind_by_name($s3, ":curs", $cursor3, -1, OCI_B_CURSOR);
+oci_execute($s3);
+oci_define_by_name($cursor3, 'ID', $id3);
+oci_execute($cursor3);
+while (oci_fetch_row($cursor3)) {
+ var_dump($id3);
+}
+
+
+echo "Test 4 - define before top level execute\n";
+
+$s4 = oci_parse($c, $sql);
+$cursor4 = oci_new_cursor($c);
+oci_bind_by_name($s4, ":curs", $cursor4, -1, OCI_B_CURSOR);
+oci_define_by_name($cursor4, 'ID', $id4);
+oci_execute($s4);
+oci_execute($cursor4);
+while (oci_fetch_row($cursor4)) {
+ var_dump($id4);
+}
+
+
+echo "Test 5 - define before bind\n";
+
+$s5 = oci_parse($c, $sql);
+$cursor5 = oci_new_cursor($c);
+oci_define_by_name($cursor5, 'ID', $id5);
+oci_bind_by_name($s5, ":curs", $cursor5, -1, OCI_B_CURSOR);
+oci_execute($s5);
+oci_execute($cursor5);
+while (oci_fetch_row($cursor5)) {
+ var_dump($id5);
+}
+
+
+echo "Test 6 - fetch on wrong handle\n";
+
+$s6 = oci_parse($c, $sql);
+$cursor6 = oci_new_cursor($c);
+oci_define_by_name($cursor6, 'ID', $id6);
+oci_bind_by_name($s6, ":curs", $cursor6, -1, OCI_B_CURSOR);
+oci_execute($s6);
+oci_execute($cursor6);
+while (oci_fetch_row($s6)) {
+ var_dump($id6);
+}
+
+
+// Clean up
+
+$stmtarray = array(
+ "drop table define6_tab"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+Test 1 - define last
+NULL
+Test 2 - define last with preset var
+string(0) ""
+Test 3 - define before cursor execute
+string(1) "1"
+Test 4 - define before top level execute
+string(1) "1"
+Test 5 - define before bind
+string(1) "1"
+Test 6 - fetch on wrong handle
+
+Warning: oci_fetch_row(): ORA-24374: %s in %sdefine6.php on line %d
+===DONE===
"insert into define_old_tab (string) values ('some')",
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- $r = @oci_execute($s);
- if (!$r) {
- $m = oci_error($s);
- if (!in_array($m['code'], array( // ignore expected errors
- 942 // table or view does not exist
- ))) {
- echo $stmt . PHP_EOL . $m['message'] . PHP_EOL;
- }
- }
-}
+oci8_test_sql_execute($c, $stmtarray);
// Run test
"drop table define_old_tab"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- oci_execute($s);
-}
-
+oci8_test_sql_execute($c, $stmtarray);
echo "Done\n";
--TEST--
commit connection after destroying the descriptor
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
/*
* Please change $user, $password and $dbase to match your configuration.
*
- * Set $oracle_on_localhost to TRUE if the Oracle Database is
- * installed on your localhost.
- *
* Set $test_drcp to TRUE if you want to run the Oracle Database
* Resident Connection Pooling (DRCP) tests. For these tests to run
* successfully, you need a server and client which is Oracle 11g or
* string like hostname:port/service_name:POOLED
*
* Set $stress_test to TRUE if you want to run some longer/slower/more
- * memory intensive tests.
+ * memory intensive tests. External configuration such as increasing
+ * the timeout of run-tests.php may also be needed.
*/
if (file_exists(dirname(__FILE__)."/details_local.inc")) {
- include(dirname(__FILE__)."/details_local.inc"); // this file is not part of the source distribution; make it your own local variant of details.inc
+ include(dirname(__FILE__)."/details_local.inc"); // this file is not part of the source distribution; make it your own local variant of details.inc
} else {
- if (false !== getenv('PHP_OCI8_TEST_DB')) {
- $user = getenv('PHP_OCI8_TEST_USER'); // Database username for tests
- $password = getenv('PHP_OCI8_TEST_PASS'); // Password for $user
- $dbase = getenv('PHP_OCI8_TEST_DB'); // Database connection string
- $test_drcp = getenv('PHP_OCI8_TEST_DRCP');
- if (false !== $test_drcp && 0 == strcasecmp($test_drcp,'TRUE')) {
- $test_drcp = TRUE;
- } else {
- $test_drcp = FALSE;
- }
- $oracle_on_localhost = getenv('PHP_OCI8_TEST_DB_ON_LOCALHOST');
- if (false !== $oracle_on_localhost && 0 == strcasecmp($oracle_on_localhost,'TRUE')) {
- $oracle_on_localhost = TRUE;
- } else {
- $oracle_on_localhost = FALSE;
- }
- $stress_test = getenv('PHP_OCI8_STRESS_TEST');
- if (false !== $stress_test && 0 == strcasecmp($stress_test,'TRUE')) {
- $stress_test = TRUE;
- } else {
- $stress_test = FALSE;
- }
- } else {
- $user = "system";
- $password = "oracle";
- $dbase = "localhost/XE";
- $oracle_on_localhost = TRUE;
- $test_drcp = FALSE;
- $stress_test = FALSE;
- }
-
- /*
- * Common object names for scripts to use
- */
-
- $table_name = "tb".substr(str_replace(Array(".", "-"), "_", php_uname("n")), 0, 5);
- $type_name = strtoupper("tp".substr(str_replace(Array(".", "-"), "_", php_uname("n")), 0, 5));
- $schema = '';
+ if (false !== getenv('PHP_OCI8_TEST_DB')) {
+ $user = getenv('PHP_OCI8_TEST_USER'); // Database username for tests
+ $password = getenv('PHP_OCI8_TEST_PASS'); // Password for $user
+ $dbase = getenv('PHP_OCI8_TEST_DB'); // Database connection string
+ $test_drcp = getenv('PHP_OCI8_TEST_DRCP');
+ $stress_test = getenv('PHP_OCI8_STRESS_TEST');
+ if (false !== $test_drcp && 0 == strcasecmp($test_drcp,'TRUE')) {
+ $test_drcp = TRUE;
+ } else {
+ $test_drcp = FALSE;
+ }
+ if (false !== $stress_test && 0 == strcasecmp($stress_test,'TRUE')) {
+ $stress_test = TRUE;
+ } else {
+ $stress_test = FALSE;
+ }
+ } else {
+ $user = "system";
+ $password = "oracle";
+ $dbase = "localhost/XE";
+ $test_drcp = FALSE;
+ $stress_test = FALSE;
+ }
+
+ /*
+ * Common object names for scripts to use
+ */
+
+ $table_name = "tb".substr(str_replace(Array(".", "-"), "_", php_uname("n")), 0, 5);
+ $type_name = strtoupper("tp".substr(str_replace(Array(".", "-"), "_", php_uname("n")), 0, 5));
+ $schema = '';
+}
+
+
+/*
+ * Used for creating/dropping schema objects used by a test
+ */
+
+function oci8_test_sql_execute($c, $stmtarray)
+{
+ foreach ($stmtarray as $stmt) {
+ $s = oci_parse($c, $stmt);
+ if (!$s) {
+ $m = oci_error($c);
+ echo $stmt . PHP_EOL . $m['message'] . PHP_EOL;
+ }
+ else {
+ $r = @oci_execute($s);
+ if (!$r) {
+ $m = oci_error($s);
+ if (!in_array($m['code'], array( // ignore expected errors
+ 942 // table or view does not exist
+ , 1918 // user does not exist
+ , 2024 // database link not found
+ , 2289 // sequence does not exist
+ , 4080 // trigger does not exist
+ , 38802 // edition does not exist
+ ))) {
+ echo $stmt . PHP_EOL . $m['message'] . PHP_EOL;
+ }
+ }
+ }
+ }
}
?>
--TEST--
DRCP: oci_connect()
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs (Calling PL/SQL from SQL is not supported in TimesTen)
+require(dirname(__FILE__).'/skipif.inc');
+?>
--INI--
oci8.connection_class=test
oci8.old_oci_close_semantics=0
// To verify this, we change the value of a PL/SQL package variable in one
// session and query for this through another connection
+echo "Test 1a\n";
var_dump($conn1 = oci_connect($user,$password,$dbase));
// Create the package
drcp_create_package($conn1);
-
+
+echo "Test 1b\n";
// OCI_CONNECT
echo " This is with OCI_CONNECT.....\n";
drcp_select_packagevar($conn1); // Returns 0
oci_close($conn1);
echo " Connection conn1 closed....\n";
+echo "Test 2\n";
// Second connection should return 0 for the package variable.
var_dump($conn2 = oci_connect($user,$password,$dbase));
echo " Select with connection 2 \n";
drcp_select_packagevar($conn2); // Returns 0
drcp_set_packagevar($conn2,100);
+echo "Test 3\n";
// Third connection. There is no oci_close() for conn2 hence this should
// return the value set by conn2.
var_dump($conn3 = oci_connect($user,$password,$dbase));
oci_close($conn2);
oci_close($conn3);
+echo "Test 4\n";
// OCI_PCONNECT
-echo "\n This is with oci_pconnect().....\n";
+echo " This is with oci_pconnect().....\n";
var_dump($pconn1 = oci_pconnect($user,$password,$dbase));
drcp_set_packagevar($pconn1,1000);
oci_close($pconn1);
// Second connection with oci_pconnect should return the same session hence the
// value returned is what is set by pconn1
+echo "Test 5\n";
var_dump($pconn2 = oci_pconnect($user,$password,$dbase));
echo " Select with persistent connection 2 \n";
drcp_select_packagevar($pconn2); // Returns 1000
?>
--EXPECTF--
+Test 1a
resource(%d) of type (oci8 connection)
+Test 1b
This is with OCI_CONNECT.....
The value of the package variable is 0
Package variable value set to 1000
Connection conn1 closed....
+Test 2
resource(%d) of type (oci8 connection)
Select with connection 2
The value of the package variable is 0
Package variable value set to 100
+Test 3
resource(%d) of type (oci8 connection)
Select with connection 3
The value of the package variable is 100
-
+Test 4
This is with oci_pconnect().....
resource(%d) of type (oci8 persistent connection)
Package variable value set to 1000
Connection pconn1 closed....
+Test 5
resource(%d) of type (oci8 persistent connection)
Select with persistent connection 2
The value of the package variable is 1000
$dept_values = array("ACCOUNTS","HR","HR","ADMIN","ACCOUNTS","HR",
"ACCOUNTS","HR","ACCOUNTS");
for($i=0; $i<8; $i++) {
- $insert = "INSERT INTO DRCPTEST VALUES('".$id_values[$i]."','". $name_values[$i]."','".$dept_values[$i]."')";
+ $insert = "INSERT INTO DRCPTEST VALUES(".$id_values[$i].",'". $name_values[$i]."','".$dept_values[$i]."')";
$s = oci_parse($conn, $insert);
oci_execute($s);
}
if (!extension_loaded('oci8')) die("skip no oci8 extension");
if (strcasecmp($user, "system") && strcasecmp($user, "sys")) die("skip needs to be run as a DBA user");
require(dirname(__FILE__)."/details.inc");
-if (empty($oracle_on_localhost)) die("skip this test is unlikely to work with remote Oracle - unless an Oracle password file has been created");
+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 remote Oracle - unless an Oracle password file has been created");
+}
?>
--INI--
oci8.privileged_connect=1
?>
--EXPECTF--
-Warning: oci_connect(): ORA-01031: insufficient privileges in %s on line %d
+Warning: oci_connect(): ORA-01031: %s in %s on line %d
bool(false)
-Warning: oci_connect(): ORA-01031: insufficient privileges in %s on line %d
+Warning: oci_connect(): ORA-01031: %s in %s on line %d
bool(false)
-Warning: oci_new_connect(): ORA-01031: insufficient privileges in %s on line %d
+Warning: oci_new_connect(): ORA-01031: %s in %s on line %d
bool(false)
-Warning: oci_new_connect(): ORA-01031: insufficient privileges in %s on line %d
+Warning: oci_new_connect(): ORA-01031: %s in %s on line %d
bool(false)
-Warning: oci_pconnect(): ORA-01031: insufficient privileges in %s on line %d
+Warning: oci_pconnect(): ORA-01031: %s in %s on line %d
bool(false)
-Warning: oci_pconnect(): ORA-01031: insufficient privileges in %s on line %d
+Warning: oci_pconnect(): ORA-01031: %s in %s on line %d
bool(false)
Done
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");
-$sv = oci_server_version($c);
-$sv = preg_match('/Release (11.2|12)/', $sv, $matches);
-
-if ($sv == 1) {
- ob_start();
- phpinfo(INFO_MODULES);
- $phpinfo = ob_get_clean();
- $iv = preg_match('/Oracle .*Version => (11.2|12)/', $phpinfo);
- if ($iv != 1) {
- die ("skip test expected to work only with Oracle 11g or greater version of client");
- }
-}
-else {
- die ("skip test expected to work only with Oracle 11g or greater version of server");
+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");
}
?>
--- /dev/null
+--TEST--
+SELECT tests with duplicate column anmes
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/connect.inc');
+
+// Initialization
+
+$stmtarray = array(
+ "drop table dupcolnames_tab1",
+ "drop table dupcolnames_tab2",
+
+ "create table dupcolnames_tab1 (c1 number, dupnamecol varchar2(20))",
+ "create table dupcolnames_tab2 (c2 number, dupnamecol varchar2(20))",
+
+ "insert into dupcolnames_tab1 (c1, dupnamecol) values (1, 'chris')",
+ "insert into dupcolnames_tab2 (c2, dupnamecol) values (2, 'jones')",
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+// Run Test
+
+echo "Test 1 - OCI_ASSOC\n";
+$s = oci_parse($c, "select * from dupcolnames_tab1, dupcolnames_tab2");
+oci_execute($s);
+while (($r = oci_fetch_array($s, OCI_ASSOC)) != false) {
+ var_dump($r);
+}
+
+
+echo "\nTest 2 - OCI_NUM\n";
+$s = oci_parse($c, "select * from dupcolnames_tab1, dupcolnames_tab2");
+oci_execute($s);
+while (($r = oci_fetch_array($s, OCI_NUM)) != false) {
+ var_dump($r);
+}
+
+
+echo "\nTest 3 - OCI_ASSOC+OCI_NUM\n";
+$s = oci_parse($c, "select * from dupcolnames_tab1, dupcolnames_tab2");
+oci_execute($s);
+while (($r = oci_fetch_array($s, OCI_ASSOC+OCI_NUM)) != false) {
+ var_dump($r);
+}
+
+// Clean up
+
+$stmtarray = array(
+ "drop table dupcolnames_tab1",
+ "drop table dupcolnames_tab2",
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+Test 1 - OCI_ASSOC
+array(3) {
+ ["C1"]=>
+ string(1) "1"
+ ["DUPNAMECOL"]=>
+ string(5) "jones"
+ ["C2"]=>
+ string(1) "2"
+}
+
+Test 2 - OCI_NUM
+array(4) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(5) "chris"
+ [2]=>
+ string(1) "2"
+ [3]=>
+ string(5) "jones"
+}
+
+Test 3 - OCI_ASSOC+OCI_NUM
+array(7) {
+ [0]=>
+ string(1) "1"
+ ["C1"]=>
+ string(1) "1"
+ [1]=>
+ string(5) "chris"
+ ["DUPNAMECOL"]=>
+ string(5) "jones"
+ [2]=>
+ string(1) "2"
+ ["C2"]=>
+ string(1) "2"
+ [3]=>
+ string(5) "jones"
+}
+===DONE===
<?php
if (!extension_loaded('oci8')) die("skip no oci8 extension");
require(dirname(__FILE__)."/connect.inc");
-if (strcasecmp($user, "system") && strcasecmp($user, "sys"))
+if (strcasecmp($user, "system") && strcasecmp($user, "sys")) {
die("skip needs to be run as a DBA user");
-if ($test_drcp)
+}
+if ($test_drcp) {
die("skip as Output might vary with DRCP");
-
-$sv = oci_server_version($c);
-$sv = preg_match('/Release (11\.2|12)/', $sv, $matches);
-if ($sv == 1) {
- ob_start();
- phpinfo(INFO_MODULES);
- $phpinfo = ob_get_clean();
- $iv = preg_match('/Oracle .*Version => (11\.2|12)/', $phpinfo);
- if ($iv != 1) {
- die ("skip tests a feature that works only with Oracle 11gR2 or greater version of client");
- }
}
-else {
- die ("skip tests a feature that works only with Oracle 11gR2 or greater version of server");
+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) {
+ die("skip test expected to work only with Oracle 11gR2 or greater version of client");
}
-
?>
--FILE--
<?php
"create or replace editioning view view_ed as select name,age,job from edit_tab",
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($conn, $stmt);
- @oci_execute($s);
-}
+oci8_test_sql_execute($conn, $stmtarray);
// Check the current edition of the DB and the contents of view_ed.
get_edit_attr($conn);
if ($test_drcp)
die("skip as Output might vary with DRCP");
-$sv = oci_server_version($c);
-$sv = preg_match('/Release (11\.2|12)/', $sv, $matches);
-if ($sv == 1) {
- ob_start();
- phpinfo(INFO_MODULES);
- $phpinfo = ob_get_clean();
- $iv = preg_match('/Oracle .*Version => (11\.2|12)/', $phpinfo);
- if ($iv != 1) {
- die ("skip tests a feature that works only with Oracle 11gR2 or greater version of client");
- }
-}
-else {
- die ("skip tests a feature that works only with Oracle 11gR2 or greater version of server");
+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) {
+ die("skip test expected to work only with Oracle 11gR2 or greater version of client");
}
?>
--TEST--
-oci_error()
+oci_error() error message for parsing error
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs: different error messages from TimesTen
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
require dirname(__FILE__)."/connect.inc";
if (!empty($dbase)) {
- var_dump(oci_connect($user, $password, $dbase));
+ var_dump(oci_connect($user, $password, $dbase));
}
else {
- var_dump(oci_connect($user, $password));
+ var_dump(oci_connect($user, $password));
}
var_dump($s = oci_parse($c, "WRONG SYNTAX"));
resource(%s) of type (oci8 connection)
resource(%s) of type (oci8 statement)
-Warning: oci_execute(): ORA-00900: invalid SQL statement in %s on line %d
+Warning: oci_execute(): ORA-00900: %s in %s on line %d
bool(false)
array(4) {
["code"]=>
int(900)
["message"]=>
- string(32) "ORA-00900: invalid SQL statement"
+ string(%d) "ORA-00900: %s"
["offset"]=>
int(0)
["sqltext"]=>
?>
--EXPECTF--
-Warning: oci_connect(): ORA-12154: TNS:could not resolve %s in %s on line %d
+Warning: oci_connect(): ORA-12154: %s in %s on line %d
bool(false)
array(4) {
["code"]=>
int(12154)
["message"]=>
- string(%d) "ORA-12154: TNS:could not resolve %s"
+ string(%d) "ORA-12154: %s"
["offset"]=>
int(0)
["sqltext"]=>
--TEST--
Exercise error code for SUCCESS_WITH_INFO
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+if ($stress_test !== true) die ('skip Slow test not run when $stress_test is FALSE');
+?>
--FILE--
<?php
-require dirname(__FILE__).'/connect.inc';
+require(dirname(__FILE__).'/connect.inc');
ini_set('error_reporting', E_ALL);
?>
--EXPECTF--
-ORA-24344: success with compilation error
+ORA-24344: %s
Done
Warning: oci_bind_by_name(): Invalid variable used for bind in %s on line %d
-Warning: oci_execute(): ORA-01008: %s on line %d
+Warning: oci_execute(): ORA-%r(01008|57000)%r: %s on line %d
bool(false)
Done
--TEST--
ocierror()
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs: different error messages from TimesTen
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
require dirname(__FILE__)."/connect.inc";
if (!empty($dbase)) {
- var_dump(ocilogon($user, $password, $dbase));
+ var_dump(ocilogon($user, $password, $dbase));
}
else {
- var_dump(ocilogon($user, $password));
+ var_dump(ocilogon($user, $password));
}
var_dump($s = ociparse($c, "WRONG SYNTAX"));
resource(%s) of type (oci8 connection)
resource(%s) of type (oci8 statement)
-Warning: ociexecute(): ORA-00900: invalid SQL statement in %s on line %d
+Warning: ociexecute(): ORA-00900: %s in %s on line %d
bool(false)
array(4) {
["code"]=>
int(900)
["message"]=>
- string(32) "ORA-00900: invalid SQL statement"
+ string(%d) "ORA-00900: %s"
["offset"]=>
int(0)
["sqltext"]=>
["code"]=>
int(1756)
["message"]=>
- string(48) "ORA-01756: quoted string not properly terminated"
+ string(48) "ORA-01756: %s"
["offset"]=>
int(0)
["sqltext"]=>
["code"]=>
int(1756)
["message"]=>
- string(48) "ORA-01756: quoted string not properly terminated"
+ string(48) "ORA-01756: %s"
["offset"]=>
int(0)
["sqltext"]=>
["code"]=>
int(1756)
["message"]=>
- string(48) "ORA-01756: quoted string not properly terminated"
+ string(48) "ORA-01756: %s"
["offset"]=>
int(0)
["sqltext"]=>
string(0) ""
}
No connection: error: bool(false)
-Normal connection (take #2): Parse error: ORA-01756: quoted string not properly terminated
-New connection (take #2): Parse error: ORA-01756: quoted string not properly terminated
-Persistent connection (take #2): Parse error: ORA-01756: quoted string not properly terminated
+Normal connection (take #2): Parse error: ORA-01756: %s
+New connection (take #2): Parse error: ORA-01756: %s
+Persistent connection (take #2): Parse error: ORA-01756: %s
Normal connection: New Collection error: OCI-22303: type ""."ABC" not found
-New connection (take #3): Parse error: ORA-01756: quoted string not properly terminated
-Persistent connection (take #3): Parse error: ORA-01756: quoted string not properly terminated
+New connection (take #3): Parse error: ORA-01756: %s
+Persistent connection (take #3): Parse error: ORA-01756: %s
Done
echo "Done\n";
?>
--EXPECTF--
-Warning: oci_execute(): ORA-00942: table or view does not exist in %s on line %d
+Warning: oci_execute(): ORA-00942: %s in %s on line %d
bool(false)
-Warning: oci_fetch_array(): ORA-24374: define not done before fetch or execute and fetch in %s on line %d
+Warning: oci_fetch_array(): ORA-24374: %s in %s on line %d
bool(false)
Done
"insert into fetch_tab (id, value) values (1,1)",
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- $r = @oci_execute($s);
- if (!$r) {
- $m = oci_error($s);
- if (!in_array($m['code'], array( // ignore expected errors
- 942 // table or view does not exist
- ))) {
- echo $stmt . PHP_EOL . $m['message'] . PHP_EOL;
- }
- }
-}
-
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
// Run Test
"drop table fetch_tab"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- oci_execute($s);
-}
-
+oci8_test_sql_execute($c, $stmtarray);
echo "Done\n";
?>
"insert into fetch_all_tab (id, value) values (1,1)"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- $r = @oci_execute($s);
- if (!$r) {
- $m = oci_error($s);
- if (!in_array($m['code'], array( // ignore expected errors
- 942 // table or view does not exist
- ))) {
- echo $stmt . PHP_EOL . $m['message'] . PHP_EOL;
- }
- }
-}
+oci8_test_sql_execute($c, $stmtarray);
if (!($s = oci_parse($c, "select * from fetch_all_tab"))) {
die("oci_parse(select) failed!\n");
"drop table fetch_all_tab"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
echo "Done\n";
?>
--- /dev/null
+--TEST--
+oci_fetch_all()
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+require(dirname(__FILE__)."/connect.inc");
+
+// Initialize
+
+$stmtarray = array(
+ "drop table fetch_all_tab",
+ "create table fetch_all_tab (id number, value number)",
+ "insert into fetch_all_tab (id, value) values (1,1)",
+ "insert into fetch_all_tab (id, value) values (1,1)",
+ "insert into fetch_all_tab (id, value) values (1,1)"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+if (!($s = oci_parse($c, "select * from fetch_all_tab"))) {
+ die("oci_parse(select) failed!\n");
+}
+
+/* oci_fetch_all */
+if (!oci_execute($s)) {
+ die("oci_execute(select) failed!\n");
+}
+var_dump(oci_fetch_all($s, $all));
+var_dump($all);
+
+/* ocifetchstatement */
+if (!oci_execute($s)) {
+ die("oci_execute(select) failed!\n");
+}
+
+var_dump(ocifetchstatement($s, $all));
+var_dump($all);
+
+// Cleanup
+
+$stmtarray = array(
+ "drop table fetch_all_tab"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+echo "Done\n";
+?>
+--EXPECTF--
+int(3)
+array(2) {
+ [%u|b%"ID"]=>
+ array(3) {
+ [0]=>
+ %unicode|string%(1) "1"
+ [1]=>
+ %unicode|string%(1) "1"
+ [2]=>
+ %unicode|string%(1) "1"
+ }
+ [%u|b%"VALUE"]=>
+ array(3) {
+ [0]=>
+ %unicode|string%(1) "1"
+ [1]=>
+ %unicode|string%(1) "1"
+ [2]=>
+ %unicode|string%(1) "1"
+ }
+}
+int(3)
+array(2) {
+ [%u|b%"ID"]=>
+ array(3) {
+ [0]=>
+ %unicode|string%(1) "1"
+ [1]=>
+ %unicode|string%(1) "1"
+ [2]=>
+ %unicode|string%(1) "1"
+ }
+ [%u|b%"VALUE"]=>
+ array(3) {
+ [0]=>
+ %unicode|string%(1) "1"
+ [1]=>
+ %unicode|string%(1) "1"
+ [2]=>
+ %unicode|string%(1) "1"
+ }
+}
+Done
--TEST--
oci_fetch_all() - 2
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
"create table fetch_all3_tab (id number, value number)",
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- $r = @oci_execute($s);
- if (!$r) {
- $m = oci_error($s);
- if (!in_array($m['code'], array( // ignore expected errors
- 942 // table or view does not exist
- ))) {
- echo $stmt . PHP_EOL . $m['message'] . PHP_EOL;
- }
- }
-}
-
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
$insert_sql = "insert into fetch_all3_tab (id, value) values (:idbv,:vbv)";
$s = oci_parse($c, $insert_sql);
-oci_bind_by_name($s, ":idbv", $idbv, SQLT_INT);
-oci_bind_by_name($s, ":vbv", $vbv, SQLT_INT);
+oci_bind_by_name($s, ":idbv", $idbv, -1, SQLT_INT);
+oci_bind_by_name($s, ":vbv", $vbv, -1, SQLT_INT);
for ($i = 1; $i <= 4; $i++) {
$idbv = $i;
"drop table fetch_all3_tab"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
echo "Done\n";
?>
"insert into fetch_all4_tab values (1, 'abc')"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- $r = @oci_execute($s);
- if (!$r) {
- $m = oci_error($s);
- if (!in_array($m['code'], array( // ignore expected errors
- 942 // table or view does not exist
- , 2289 // sequence does not exist
- , 4080 // trigger does not exist
- , 38802 // edition does not exist
- ))) {
- echo $stmt . PHP_EOL . $m['message'] . PHP_EOL;
- }
- }
-}
+oci8_test_sql_execute($c, $stmtarray);
// Run Test
"drop table fetch_all4_tab"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- oci_execute($s);
-}
-
-oci_close($c);
+oci8_test_sql_execute($c, $stmtarray);
?>
===DONE===
"insert into fetch_all5_tab values (3, 'ghi')"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- $r = @oci_execute($s);
- if (!$r) {
- $m = oci_error($s);
- if (!in_array($m['code'], array( // ignore expected errors
- 942 // table or view does not exist
- , 2289 // sequence does not exist
- , 4080 // trigger does not exist
- , 38802 // edition does not exist
- ))) {
- echo $stmt . PHP_EOL . $m['message'] . PHP_EOL;
- }
- }
-}
+oci8_test_sql_execute($c, $stmtarray);
// Run Test
"drop table fetch_all5_tab"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
oci_close($c);
--TEST--
oci_fetch_array()
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
die("oci_commit() failed!\n");
}
+echo "Test 1\n";
+
$select_sql = "SELECT * FROM ".$schema."".$table_name."";
if (!($s = oci_parse($c, $select_sql))) {
var_dump($row);
}
+echo "Test 2\n";
+
if (!oci_execute($s)) {
die("oci_execute(select) failed!\n");
}
var_dump($row);
}
+echo "Test 3\n";
+
if (!oci_execute($s)) {
die("oci_execute(select) failed!\n");
}
var_dump($row);
}
+echo "Test 4\n";
+
if (!oci_execute($s)) {
die("oci_execute(select) failed!\n");
}
var_dump($row);
}
+echo "Test 5\n";
+
if (!oci_execute($s)) {
die("oci_execute(select) failed!\n");
}
var_dump($row);
}
+echo "Test 6\n";
+
if (!oci_execute($s)) {
die("oci_execute(select) failed!\n");
}
var_dump($row);
}
+echo "Test 7\n";
+
+if (!oci_execute($s)) {
+ die("oci_execute(select) failed!\n");
+}
+while ($row = oci_fetch_array($s, OCI_NUM+OCI_RETURN_NULLS)) {
+ var_dump($row);
+}
+
require dirname(__FILE__).'/drop_table.inc';
echo "Done\n";
?>
--EXPECT--
+Test 1
array(10) {
[0]=>
string(1) "1"
["STRING"]=>
NULL
}
+Test 2
array(2) {
[0]=>
string(1) "1"
[1]=>
string(1) "1"
}
+Test 3
array(2) {
["ID"]=>
string(1) "1"
["VALUE"]=>
string(1) "1"
}
+Test 4
array(4) {
[0]=>
string(1) "1"
["VALUE"]=>
string(1) "1"
}
+Test 5
array(4) {
[0]=>
string(1) "1"
["VALUE"]=>
string(1) "1"
}
+Test 6
array(10) {
[0]=>
string(1) "1"
["STRING"]=>
NULL
}
+Test 7
+array(5) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(1) "1"
+ [2]=>
+ NULL
+ [3]=>
+ NULL
+ [4]=>
+ NULL
+}
+array(5) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(1) "1"
+ [2]=>
+ NULL
+ [3]=>
+ NULL
+ [4]=>
+ NULL
+}
+array(5) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(1) "1"
+ [2]=>
+ NULL
+ [3]=>
+ NULL
+ [4]=>
+ NULL
+}
Done
+
--TEST--
oci_fetch_assoc()
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
--FILE--
<?php
require dirname(__FILE__)."/connect.inc";
-require dirname(__FILE__).'/create_table.inc';
-$insert_sql = "INSERT INTO ".$schema."".$table_name." (id, value) VALUES (1,1)";
+$stmtarray = array(
+ "drop table fetch_assoc_tab",
+ "create table fetch_assoc_tab (id number, value number, dummy varchar2(20))",
+ "insert into fetch_assoc_tab values (1,1,null)",
+ "insert into fetch_assoc_tab values (1,1,null)",
+ "insert into fetch_assoc_tab values (1,1,null)"
+);
-if (!($s = oci_parse($c, $insert_sql))) {
- die("oci_parse(insert) failed!\n");
-}
-
-for ($i = 0; $i<3; $i++) {
- if (!oci_execute($s)) {
- die("oci_execute(insert) failed!\n");
- }
-}
+oci8_test_sql_execute($c, $stmtarray);
-if (!oci_commit($c)) {
- die("oci_commit() failed!\n");
-}
-
-$select_sql = "SELECT * FROM ".$schema."".$table_name."";
+$select_sql = "select * from fetch_assoc_tab";
if (!($s = oci_parse($c, $select_sql))) {
die("oci_parse(select) failed!\n");
var_dump($row);
}
-require dirname(__FILE__).'/drop_table.inc';
+// Clean up
+
+$stmtarray = array(
+ "drop table fetch_assoc_tab"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
echo "Done\n";
?>
--EXPECT--
-array(5) {
+array(3) {
["ID"]=>
string(1) "1"
["VALUE"]=>
string(1) "1"
- ["BLOB"]=>
- NULL
- ["CLOB"]=>
- NULL
- ["STRING"]=>
+ ["DUMMY"]=>
NULL
}
-array(5) {
+array(3) {
["ID"]=>
string(1) "1"
["VALUE"]=>
string(1) "1"
- ["BLOB"]=>
- NULL
- ["CLOB"]=>
- NULL
- ["STRING"]=>
+ ["DUMMY"]=>
NULL
}
-array(5) {
+array(3) {
["ID"]=>
string(1) "1"
["VALUE"]=>
string(1) "1"
- ["BLOB"]=>
- NULL
- ["CLOB"]=>
- NULL
- ["STRING"]=>
+ ["DUMMY"]=>
NULL
}
Done
"insert into fetch_into_tab (id, value) values (1,1)",
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- $r = @oci_execute($s);
- if (!$r) {
- $m = oci_error($s);
- if (!in_array($m['code'], array( // ignore expected errors
- 942 // table or view does not exist
- ))) {
- echo $stmt . PHP_EOL . $m['message'] . PHP_EOL;
- }
- }
-}
-
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
// Run Test
"drop table fetch_into_tab"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- oci_execute($s);
-}
-
+oci8_test_sql_execute($c, $stmtarray);
+
echo "Done\n";
?>
--EXPECTF--
--TEST--
various ocifetchinto() tests
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
--TEST--
ocifetchinto() & wrong number of params
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
--TEST--
oci_fetch_object()
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
// Initialization
$stmtarray = array(
- "drop table fetch_object_tab",
- "create table fetch_object_tab (\"caseSensitive\" number, secondcol varchar2(20), anothercol char(15))",
- "insert into fetch_object_tab values (123, '1st row col2 string', '1 more text')",
- "insert into fetch_object_tab values (456, '2nd row col2 string', '2 more text')",
- "insert into fetch_object_tab values (789, '3rd row col2 string', '3 more text')",
+ "drop table fetch_object_tab",
+ "create table fetch_object_tab (\"caseSensitive\" number, secondcol varchar2(20), anothercol char(15))",
+ "insert into fetch_object_tab values (123, '1st row col2 string', '1 more text')",
+ "insert into fetch_object_tab values (456, '2nd row col2 string', '2 more text')",
+ "insert into fetch_object_tab values (789, '3rd row col2 string', '3 more text')",
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- $r = @oci_execute($s);
- if (!$r) {
- $m = oci_error($s);
- if (!in_array($m['code'], array( // ignore expected errors
- 942 // table or view does not exist
- , 2289 // sequence does not exist
- , 4080 // trigger does not exist
- , 38802 // edition does not exist
- ))) {
- echo $stmt . PHP_EOL . $m['message'] . PHP_EOL;
- }
- }
-}
+oci8_test_sql_execute($c, $stmtarray);
// Run Test
echo "Test 1\n";
if (!($s = oci_parse($c, 'select * from fetch_object_tab'))) {
- die("oci_parse(select) failed!\n");
+ die("oci_parse(select) failed!\n");
}
if (!oci_execute($s)) {
- die("oci_execute(select) failed!\n");
+ die("oci_execute(select) failed!\n");
}
while ($row = oci_fetch_object($s)) {
- var_dump($row);
+ var_dump($row);
}
echo "Test 2\n";
if (!($s = oci_parse($c, 'select * from fetch_object_tab'))) {
- die("oci_parse(select) failed!\n");
+ die("oci_parse(select) failed!\n");
}
if (!oci_execute($s)) {
- die("oci_execute(select) failed!\n");
+ die("oci_execute(select) failed!\n");
}
while ($row = oci_fetch_object($s)) {
echo "Test 3\n";
if (!($s = oci_parse($c, 'select * from fetch_object_tab where rownum < 2 order by "caseSensitive"'))) {
- die("oci_parse(select) failed!\n");
+ die("oci_parse(select) failed!\n");
}
if (!oci_execute($s)) {
- die("oci_execute(select) failed!\n");
+ die("oci_execute(select) failed!\n");
}
$row = oci_fetch_object($s);
// Clean up
$stmtarray = array(
- "drop table fetch_object_tab"
+ "drop table fetch_object_tab"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
?>
===DONE===
--- /dev/null
+--TEST--
+oci_fetch_object()
+--SKIPIF--
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/connect.inc');
+
+// Initialization
+
+$stmtarray = array(
+ "drop table fetch_object_tab",
+ "create table fetch_object_tab (\"caseSensitive\" number, secondcol varchar2(20), anothercol char(15))",
+ "insert into fetch_object_tab values (123, '1st row col2 string', '1 more text')",
+ "insert into fetch_object_tab values (456, '2nd row col2 string', '2 more text')",
+ "insert into fetch_object_tab values (789, '3rd row col2 string', '3 more text')",
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+// Run Test
+
+echo "Test 1\n";
+
+if (!($s = oci_parse($c, 'select * from fetch_object_tab'))) {
+ die("oci_parse(select) failed!\n");
+}
+
+if (!oci_execute($s)) {
+ die("oci_execute(select) failed!\n");
+}
+
+while ($row = oci_fetch_object($s)) {
+ var_dump($row);
+}
+
+echo "Test 2\n";
+
+if (!($s = oci_parse($c, 'select * from fetch_object_tab'))) {
+ die("oci_parse(select) failed!\n");
+}
+
+if (!oci_execute($s)) {
+ die("oci_execute(select) failed!\n");
+}
+
+while ($row = oci_fetch_object($s)) {
+ echo $row->caseSensitive . "\n";
+ echo $row->SECONDCOL . "\n";
+ echo $row->ANOTHERCOL . "\n";
+}
+
+echo "Test 3\n";
+
+if (!($s = oci_parse($c, 'select * from fetch_object_tab where rownum < 2 order by "caseSensitive"'))) {
+ die("oci_parse(select) failed!\n");
+}
+
+if (!oci_execute($s)) {
+ die("oci_execute(select) failed!\n");
+}
+
+$row = oci_fetch_object($s);
+echo $row->caseSensitive . "\n";
+echo $row->CASESENSITIVE . "\n";
+
+// Clean up
+
+$stmtarray = array(
+ "drop table fetch_object_tab"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+Test 1
+object(stdClass)#%d (3) {
+ ["caseSensitive"]=>
+ string(3) "123"
+ ["SECONDCOL"]=>
+ string(19) "1st row col2 string"
+ ["ANOTHERCOL"]=>
+ string(15) "1 more text "
+}
+object(stdClass)#%d (3) {
+ ["caseSensitive"]=>
+ string(3) "456"
+ ["SECONDCOL"]=>
+ string(19) "2nd row col2 string"
+ ["ANOTHERCOL"]=>
+ string(15) "2 more text "
+}
+object(stdClass)#%d (3) {
+ ["caseSensitive"]=>
+ string(3) "789"
+ ["SECONDCOL"]=>
+ string(19) "3rd row col2 string"
+ ["ANOTHERCOL"]=>
+ string(15) "3 more text "
+}
+Test 2
+123
+1st row col2 string
+1 more text
+456
+2nd row col2 string
+2 more text
+789
+3rd row col2 string
+3 more text
+Test 3
+123
+
+Notice: Undefined property: stdClass::$CASESENSITIVE in %sfetch_object_1.php on line %d
+
+===DONE===
--TEST--
oci_fetch_object() with CLOB and NULL
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
// Initialization
$stmtarray = array(
- "drop table fetch_object_2_tab",
- "create table fetch_object_2_tab (col1 number, col2 CLOB, col3 varchar2(15))",
- "insert into fetch_object_2_tab values (123, '1st row col2 string', '1 more text')",
- "insert into fetch_object_2_tab values (456, '2nd row col2 string', NULL)",
- "insert into fetch_object_2_tab values (789, '3rd row col2 string', '3 more text')",
+ "drop table fetch_object_2_tab",
+ "create table fetch_object_2_tab (col1 number, col2 CLOB, col3 varchar2(15))",
+ "insert into fetch_object_2_tab values (123, '1st row col2 string', '1 more text')",
+ "insert into fetch_object_2_tab values (456, '2nd row col2 string', NULL)",
+ "insert into fetch_object_2_tab values (789, '3rd row col2 string', '3 more text')",
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- $r = @oci_execute($s);
- if (!$r) {
- $m = oci_error($s);
- if (!in_array($m['code'], array( // ignore expected errors
- 942 // table or view does not exist
- , 2289 // sequence does not exist
- , 4080 // trigger does not exist
- , 38802 // edition does not exist
- ))) {
- echo $stmt . PHP_EOL . $m['message'] . PHP_EOL;
- }
- }
-}
+oci8_test_sql_execute($c, $stmtarray);
// Run Test
echo "Test 1\n";
if (!($s = oci_parse($c, 'select * from fetch_object_2_tab order by 1'))) {
- die("oci_parse(select) failed!\n");
+ die("oci_parse(select) failed!\n");
}
if (!oci_execute($s)) {
- die("oci_execute(select) failed!\n");
+ die("oci_execute(select) failed!\n");
}
while ($row = oci_fetch_object($s)) {
- var_dump($row);
+ var_dump($row);
}
echo "Test 2\n";
if (!($s = oci_parse($c, 'select * from fetch_object_2_tab order by 1'))) {
- die("oci_parse(select) failed!\n");
+ die("oci_parse(select) failed!\n");
}
if (!oci_execute($s)) {
- die("oci_execute(select) failed!\n");
+ die("oci_execute(select) failed!\n");
}
while ($row = oci_fetch_object($s)) {
// Clean up
$stmtarray = array(
- "drop table fetch_object_2_tab"
+ "drop table fetch_object_2_tab"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
?>
===DONE===
--EXPECTF--
Test 1
object(stdClass)#%d (3) {
- [%u|b%"COL1"]=>
- %unicode|string%(3) "123"
- [%u|b%"COL2"]=>
+ ["COL1"]=>
+ string(3) "123"
+ ["COL2"]=>
object(OCI-Lob)#%d (1) {
- [%u|b%"descriptor"]=>
+ ["descriptor"]=>
resource(%d) of type (oci8 descriptor)
}
- [%u|b%"COL3"]=>
- %unicode|string%(11) "1 more text"
+ ["COL3"]=>
+ string(11) "1 more text"
}
object(stdClass)#%d (3) {
- [%u|b%"COL1"]=>
- %unicode|string%(3) "456"
- [%u|b%"COL2"]=>
+ ["COL1"]=>
+ string(3) "456"
+ ["COL2"]=>
object(OCI-Lob)#%d (1) {
- [%u|b%"descriptor"]=>
+ ["descriptor"]=>
resource(%d) of type (oci8 descriptor)
}
- [%u|b%"COL3"]=>
+ ["COL3"]=>
NULL
}
object(stdClass)#%d (3) {
- [%u|b%"COL1"]=>
- %unicode|string%(3) "789"
- [%u|b%"COL2"]=>
+ ["COL1"]=>
+ string(3) "789"
+ ["COL2"]=>
object(OCI-Lob)#%d (1) {
- [%u|b%"descriptor"]=>
+ ["descriptor"]=>
resource(%d) of type (oci8 descriptor)
}
- [%u|b%"COL3"]=>
- %unicode|string%(11) "3 more text"
+ ["COL3"]=>
+ string(11) "3 more text"
}
Test 2
123
"insert into fetch_row_tab (id, value) values (1,1)",
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- $r = @oci_execute($s);
- if (!$r) {
- $m = oci_error($s);
- if (!in_array($m['code'], array( // ignore expected errors
- 942 // table or view does not exist
- ))) {
- echo $stmt . PHP_EOL . $m['message'] . PHP_EOL;
- }
- }
-}
-
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
// Run Test
"drop table fetch_row_tab"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
echo "Done\n";
--TEST--
oci_field_*() family
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
--- /dev/null
+--TEST--
+oci_field_*() family
+--SKIPIF--
+<?php
+$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';
+
+$insert_sql = "INSERT INTO ".$schema."".$table_name." (id, value) VALUES (1,1)";
+
+if (!($s = oci_parse($c, $insert_sql))) {
+ die("oci_parse(insert) failed!\n");
+}
+
+for ($i = 0; $i<3; $i++) {
+ if (!oci_execute($s)) {
+ die("oci_execute(insert) failed!\n");
+ }
+}
+
+if (!oci_commit($c)) {
+ die("oci_commit() failed!\n");
+}
+
+$select_sql = "SELECT * FROM ".$schema."".$table_name."";
+
+if (!($s = oci_parse($c, $select_sql))) {
+ die("oci_parse(select) failed!\n");
+}
+
+if (!oci_execute($s)) {
+ die("oci_execute(select) failed!\n");
+}
+
+$row = oci_fetch_array($s, OCI_NUM + OCI_RETURN_NULLS + OCI_RETURN_LOBS);
+var_dump($row);
+
+foreach ($row as $num => $field) {
+ $num++;
+ var_dump(oci_field_is_null($s, $num));
+ var_dump(oci_field_name($s, $num));
+ var_dump(oci_field_type($s, $num));
+ var_dump(oci_field_type_raw($s, $num));
+ var_dump(oci_field_scale($s, $num));
+ var_dump(oci_field_precision($s, $num));
+ var_dump(oci_field_size($s, $num));
+}
+
+
+require dirname(__FILE__).'/drop_table.inc';
+
+echo "Done\n";
+
+?>
+--EXPECT--
+array(5) {
+ [0]=>
+ string(1) "1"
+ [1]=>
+ string(1) "1"
+ [2]=>
+ NULL
+ [3]=>
+ NULL
+ [4]=>
+ NULL
+}
+bool(false)
+string(2) "ID"
+string(6) "NUMBER"
+int(2)
+int(-127)
+int(0)
+int(22)
+bool(false)
+string(5) "VALUE"
+string(6) "NUMBER"
+int(2)
+int(-127)
+int(0)
+int(22)
+bool(true)
+string(4) "BLOB"
+string(4) "BLOB"
+int(113)
+int(0)
+int(0)
+int(4000)
+bool(true)
+string(4) "CLOB"
+string(4) "CLOB"
+int(112)
+int(0)
+int(0)
+int(4000)
+bool(true)
+string(6) "STRING"
+string(8) "VARCHAR2"
+int(1)
+int(0)
+int(0)
+int(10)
+Done
--TEST--
-oci_field_*() family
+oci_field_*() family: error cases
--SKIPIF--
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
--FILE--
"create table field_funcs1_tab (id number, value number)",
"insert into field_funcs1_tab (id, value) values (1,1)",
"insert into field_funcs1_tab (id, value) values (1,1)",
- "insert into field_funcs1_tab (id, value) values (1,1)",
+ "insert into field_funcs1_tab (id, value) values (1,1)"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- $r = @oci_execute($s);
- if (!$r) {
- $m = oci_error($s);
- if (!in_array($m['code'], array( // ignore expected errors
- 942 // table or view does not exist
- ))) {
- echo $stmt . PHP_EOL . $m['message'] . PHP_EOL;
- }
- }
-}
-
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
// Run Test
if (!($s = oci_parse($c, "select * from field_funcs1_tab"))) {
- die("oci_parse(select) failed!\n");
+ die("oci_parse(select) failed!\n");
}
if (!oci_execute($s)) {
- die("oci_execute(select) failed!\n");
+ die("oci_execute(select) failed!\n");
}
$row = oci_fetch_array($s, OCI_NUM + OCI_RETURN_NULLS + OCI_RETURN_LOBS);
var_dump($row);
+echo "Test 1\n";
var_dump(oci_field_is_null($s, -1));
var_dump(oci_field_name($s, -1));
var_dump(oci_field_type($s, -1));
var_dump(oci_field_precision($s, -1));
var_dump(oci_field_size($s, -1));
+echo "Test 2\n";
var_dump(oci_field_is_null($s, "none"));
var_dump(oci_field_name($s, "none"));
var_dump(oci_field_type($s, "none"));
var_dump(oci_field_precision($s, "none"));
var_dump(oci_field_size($s, "none"));
+echo "Test 3\n";
var_dump(oci_field_is_null($c, -1));
var_dump(oci_field_name($c, -1));
var_dump(oci_field_type($c, -1));
var_dump(oci_field_precision($c, -1));
var_dump(oci_field_size($c, -1));
+echo "Test 4\n";
var_dump(oci_field_is_null($s, array()));
var_dump(oci_field_name($s, array()));
var_dump(oci_field_type($s, array()));
"drop table field_funcs1_tab"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
echo "Done\n";
[1]=>
%unicode|string%(1) "1"
}
+Test 1
Warning: oci_field_is_null(): Invalid column index "-1" in %s on line %d
bool(false)
Warning: oci_field_size(): Invalid column index "-1" in %s on line %d
bool(false)
+Test 2
Warning: oci_field_is_null(): Invalid column name "none" in %s on line %d
bool(false)
Warning: oci_field_size(): Invalid column name "none" in %s on line %d
bool(false)
+Test 3
Warning: oci_field_is_null(): supplied resource is not a valid oci8 statement resource in %s on line %d
bool(false)
Warning: oci_field_size(): supplied resource is not a valid oci8 statement resource in %s on line %d
bool(false)
+Test 4
Warning: oci_field_is_null(): Invalid column index "0" in %s on line %d
bool(false)
--- /dev/null
+--TEST--
+oci_field_*() family: basic column types
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+require(dirname(__FILE__)."/connect.inc");
+
+// Initialization
+$stmtarray = array(
+ "drop table field_funcs3_tab",
+ "create table field_funcs3_tab(c1_c char(2), c2_v varchar2(2), c3_n number, c4_d date)",
+ "insert into field_funcs3_tab values ('c1', 'c2', 3, '01-Jan-2010')"
+);
+
+$v = oci_server_version($c);
+if (strpos($v, 'Oracle TimesTen') === false) {
+ oci8_test_sql_execute($c, array("alter session set nls_date_format = 'DD-MON-YYYY'"));
+}
+oci8_test_sql_execute($c, $stmtarray);
+
+// Run Test
+
+$select_sql = "select * from field_funcs3_tab";
+
+if (!($s = oci_parse($c, $select_sql))) {
+ die("oci_parse(select) failed!\n");
+}
+
+if (!oci_execute($s)) {
+ die("oci_execute(select) failed!\n");
+}
+
+$row = oci_fetch_array($s, OCI_NUM + OCI_RETURN_NULLS + OCI_RETURN_LOBS);
+var_dump($row);
+
+foreach ($row as $num => $field) {
+ $num++;
+ var_dump(oci_field_is_null($s, $num));
+ var_dump(oci_field_name($s, $num));
+ var_dump(oci_field_type($s, $num));
+ var_dump(oci_field_type_raw($s, $num));
+ var_dump(oci_field_scale($s, $num));
+ var_dump(oci_field_precision($s, $num));
+ var_dump(oci_field_size($s, $num));
+}
+
+// Clean up
+
+$stmtarray = array(
+ "drop table field_funcs3_tab"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+array(4) {
+ [0]=>
+ string(2) "c1"
+ [1]=>
+ string(2) "c2"
+ [2]=>
+ string(1) "3"
+ [3]=>
+ string(1%r[19]%r) "%r(01-JAN-2010|0001-01-20 10:00:00)%r"
+}
+bool(false)
+string(4) "C1_C"
+string(4) "CHAR"
+int(96)
+int(0)
+int(0)
+int(2)
+bool(false)
+string(4) "C2_V"
+string(8) "VARCHAR2"
+int(1)
+int(0)
+int(0)
+int(2)
+bool(false)
+string(4) "C3_N"
+string(6) "NUMBER"
+int(2)
+int(-127)
+int(0)
+int(22)
+bool(false)
+string(4) "C4_D"
+string(4) "DATE"
+int(12)
+int(0)
+int(0)
+int(7)
+===DONE===
--TEST--
ocicolumn*() family
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
--TEST--
oci_lob_write() and friends (with errors)
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$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." (blob)
- VALUES (empty_blob())
- RETURNING
- blob
- INTO :v_blob ";
-
-$statement = oci_parse($c,$ora_sql);
+
+require(dirname(__FILE__).'/connect.inc');
+
+// Initialization
+
+$stmtarray = array(
+ "drop table lob_002_tab",
+ "create table lob_002_tab (id number, b1 BLOB)",
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+$statement = oci_parse($c, "insert into lob_002_tab (id, b1) values (1, empty_blob()) returning b1 INTO :v_blob ");
$blob = oci_new_descriptor($c,OCI_D_LOB);
oci_bind_by_name($statement,":v_blob", $blob,-1,OCI_B_BLOB);
oci_execute($statement, OCI_DEFAULT);
oci_commit($c);
-$select_sql = "SELECT blob FROM ".$schema.$table_name."";
+$select_sql = "select b1 from lob_002_tab where id = 1";
$s = oci_parse($c, $select_sql);
oci_execute($s);
var_dump(strlen($row[0]));
+// Cleanup
-require dirname(__FILE__).'/drop_table.inc';
+$stmtarray = array(
+ "drop table lob_002_tab"
+);
-echo "Done\n";
+oci8_test_sql_execute($c, $stmtarray);
?>
+===DONE===
+<?php exit(0); ?>
--EXPECTF--
object(OCI-Lob)#%d (1) {
["descriptor"]=>
NULL
bool(false)
int(40004)
-Done
+===DONE===
--TEST--
oci_lob_seek()/rewind()/append()
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
--TEST--
oci_lob_is_equal()
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
--TEST--
oci_lob_write()/size()/load()
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
--TEST--
oci_lob_write()/read()/eof()
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
--TEST--
oci_lob_import()/read()
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
--TEST--
oci_lob_save()
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
--TEST--
oci_lob_copy()
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
--TEST--
oci_lob_export()
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
--TEST--
lob buffering
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
--TEST--
oci_lob_free()/close()
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
--TEST--
various tests with wrong param count
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
Warning: oci_bind_by_name() expects at least 3 parameters, 1 given in %s on line %d
-Warning: oci_execute(): ORA-00932: inconsistent datatypes: expected NUMBER got BLOB in %s on line %d
+Warning: oci_execute(): ORA-00932: %s NUMBER %s BLOB in %s on line %d
object(OCI-Lob)#%d (1) {
["descriptor"]=>
resource(%d) of type (oci8 descriptor)
--TEST--
returning multiple lobs
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
--TEST--
returning multiple lobs (using persistent connection)
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
--TEST--
fetching the same lob several times
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$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__).'/connect.inc');
+
+// Initialization
+
+$stmtarray = array(
+ "drop table lob_018_tab",
+ "create table lob_018_tab (mykey number, lob_1 clob)",
+);
-$drop = "DROP table lob_test";
-$statement = oci_parse($c, $drop);
-@oci_execute($statement);
+oci8_test_sql_execute($c, $stmtarray);
-$create = "CREATE table lob_test(mykey NUMBER, lob_1 CLOB)";
-$statement = oci_parse($c, $create);
-oci_execute($statement);
+echo "Test 1\n";
-$init = "INSERT INTO lob_test (mykey, lob_1) VALUES(1, EMPTY_CLOB()) RETURNING lob_1 INTO :mylob";
+$init = "insert into lob_018_tab (mykey, lob_1) values(1, empty_clob()) returning lob_1 into :mylob";
$statement = oci_parse($c, $init);
$clob = oci_new_descriptor($c, OCI_D_LOB);
oci_bind_by_name($statement, ":mylob", $clob, -1, OCI_B_CLOB);
oci_commit($c);
-$init = "INSERT INTO lob_test (mykey, lob_1) VALUES(2, EMPTY_CLOB()) RETURNING lob_1 INTO :mylob";
+$init = "insert into lob_018_tab (mykey, lob_1) values(2, empty_clob()) returning lob_1 into :mylob";
$statement = oci_parse($c, $init);
$clob = oci_new_descriptor($c, OCI_D_LOB);
oci_bind_by_name($statement, ":mylob", $clob, -1, OCI_B_CLOB);
oci_commit($c);
-$query = 'SELECT * FROM lob_test ORDER BY mykey ASC';
+$query = 'select * from lob_018_tab order by mykey asc';
+$statement = oci_parse ($c, $query);
+oci_execute($statement, OCI_DEFAULT);
+
+while ($row = oci_fetch_array($statement, OCI_ASSOC)) {
+ $result = $row['LOB_1']->load();
+ var_dump($result);
+}
+
+echo "Test 2\n";
+
+$query = 'select * from lob_018_tab order by mykey desc';
$statement = oci_parse ($c, $query);
oci_execute($statement, OCI_DEFAULT);
var_dump($result);
}
-$query = 'SELECT * FROM lob_test ORDER BY mykey DESC';
+echo "Test 3 - bind with SQLT_CLOB (an alias for OCI_B_CLOB)\n";
+
+$init = "insert into lob_018_tab (mykey, lob_1) values(3, empty_clob()) returning lob_1 into :mylob";
+$statement = oci_parse($c, $init);
+$clob = oci_new_descriptor($c, OCI_D_LOB);
+oci_bind_by_name($statement, ":mylob", $clob, -1, SQLT_CLOB);
+oci_execute($statement, OCI_DEFAULT);
+$clob->save("more stuff");
+
+oci_commit($c);
+
+$query = 'select * from lob_018_tab where mykey = 3';
$statement = oci_parse ($c, $query);
oci_execute($statement, OCI_DEFAULT);
var_dump($result);
}
-$drop = "DROP table lob_test";
-$statement = oci_parse($c, $drop);
-@oci_execute($statement);
+// Cleanup
+
+$stmtarray = array(
+ "drop table lob_018_tab"
+);
-echo "Done\n";
+oci8_test_sql_execute($c, $stmtarray);
?>
+===DONE===
+<?php exit(0); ?>
--EXPECTF--
+Test 1
string(4) "data"
string(9) "long data"
+Test 2
string(9) "long data"
string(4) "data"
-Done
+Test 3 - bind with SQLT_CLOB (an alias for OCI_B_CLOB)
+string(10) "more stuff"
+===DONE===
--TEST--
oci_lob_free()/close()
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
--TEST--
fetching the same lob several times
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
--TEST--
oci_lob_import()/read()
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
--TEST--
oci_lob_load()
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
--TEST--
oci_lob_read() tests
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
--TEST--
oci_lob_seek()/rewind()/append()
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
--TEST--
oci_lob_truncate()
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
--TEST--
Test descriptor types for oci_new_descriptor()
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
--TEST--
reading/writing BFILE LOBs
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension");
-include "details.inc";
-if (empty($oracle_on_localhost)) die("skip this test won't work with remote Oracle");
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+ob_start();
+phpinfo(INFO_MODULES);
+$phpinfo = ob_get_clean();
+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 won't work with remote Oracle");
+}
?>
--FILE--
<?php
-require dirname(__FILE__).'/connect.inc';
+require(dirname(__FILE__).'/connect.inc');
$realdirname = dirname(__FILE__);
$realfilename1 = "oci8bfiletest1.txt";
--TEST--
Test piecewise fetch of CLOBs equal to, and larger than PHP_OCI_LOB_BUFFER_SIZE
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
--TEST--
Test LOB->read(), LOB->seek() and LOB->tell() with nul bytes in data
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
--TEST--
oci_lob_write() and friends
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
--TEST--
various oci_lob_write() error messages
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
--TEST--
lob buffering - 2
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
--TEST--
oci_lob_copy() - 2
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
--TEST--
Exercise cleanup code when LOB buffering is on
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
--TEST--
Fetching two different lobs and using them after fetch
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
--TEST--
Array fetch CLOB and BLOB
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
--TEST--
Test CLOB->write() for multiple inserts
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
--TEST--
Bug #37706 (Test LOB locator reuse. Extends simple test of lob_037.phpt)
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
--TEST--
Check LOBS are valid after statement free
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
"INSERT INTO lob_041_tab VALUES('test data')"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- @oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
echo "Test 1 - explicit statement close\n";
"DROP table lob_041_tab"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- @oci_execute($s);
-}
-
-oci_close($c);
+oci8_test_sql_execute($c, $stmtarray);
?>
--TEST--
Check various LOB error messages
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
--TEST--
Bug #49560 (LOB resource destructor and refcount test)
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension");
-require(dirname(__FILE__).'/details.inc');
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
if ($stress_test !== true) die ('skip Slow test not run when $stress_test is FALSE');
?>
--FILE--
end;",
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- $r = @oci_execute($s);
- if (!$r) {
- $m = oci_error($s);
- if (!in_array($m['code'], array( // ignore expected errors
- 942 // table or view does not exist
- , 2289 // sequence does not exist
- , 4080 // trigger does not exist
- , 38802 // edition does not exist
- ))) {
- echo $stmt . PHP_EOL . $m['message'] . PHP_EOL;
- }
- }
-}
+oci8_test_sql_execute($c, $stmtarray);
// Run Test
"drop table lob_043_tab"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
oci_close($c);
--- /dev/null
+--TEST--
+oci_lob_truncate() with default parameter value
+--SKIPIF--
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/connect.inc');
+
+// Initialization
+
+$stmtarray = array(
+ "drop table lob_044_tab",
+ "create table lob_044_tab (blob BLOB)",
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+
+// Run Test
+
+echo "Test 1 - truncate on insert\n";
+
+$s = oci_parse($c, "INSERT INTO lob_044_tab (blob) VALUES (empty_blob()) RETURNING blob INTO :v_blob ");
+$blob = oci_new_descriptor($c, OCI_D_LOB);
+oci_bind_by_name($s,":v_blob", $blob, -1, OCI_B_BLOB);
+oci_execute($s, OCI_DEFAULT);
+
+var_dump($blob->write("this is a biiiig faaat test string. why are you reading it, I wonder? =)"));
+var_dump($blob->seek(0));
+var_dump($blob->read(10000));
+var_dump($blob->truncate());
+var_dump($blob->seek(0));
+var_dump($blob->read(10000));
+
+oci_commit($c);
+
+
+// Read it back
+
+echo "\nTest 2 - read it back\n";
+
+$s = oci_parse($c, "SELECT blob FROM lob_044_tab FOR UPDATE");
+oci_execute($s, OCI_DEFAULT);
+$row = oci_fetch_array($s);
+var_dump($row[0]->read(10000));
+
+// Clean up
+
+$stmtarray = array(
+ "drop table lob_044_tab"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+Test 1 - truncate on insert
+int(72)
+bool(true)
+string(72) "this is a biiiig faaat test string. why are you reading it, I wonder? =)"
+bool(true)
+bool(true)
+string(0) ""
+
+Test 2 - read it back
+string(0) ""
+===DONE===
--TEST--
LOB method aliases
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
--TEST--
Test null data for CLOBs
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
--TEST--
temporary lobs
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
--TEST--
closing temporary lobs
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
--TEST--
Null bytes in SQL statements
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--INI--
display_errors = On
error_reporting = E_WARNING
oci_fetch_all($s, $res);
var_dump($res);
-echo "Test 2: Invalid use of a null byte\n";
-
-$s = oci_parse($c, "select * from du\0al");
-oci_execute($s);
-
echo "Test 3: Using a null byte in a bind variable name\n";
$s = oci_parse($c, "select * from dual where :bv = 1");
oci_bind_by_name($s, ":bv\0:bv", $bv);
oci_execute($s);
-echo "Test 4: Using a null byte in a bind variable value causing WHERE clause to fail\n";
-
-$s = oci_parse($c, "select * from dual where :bv = 'abc'");
-$bv = 'abc\0abc';
-oci_bind_by_name($s, ":bv", $bv);
-oci_execute($s);
-oci_fetch_all($s, $res);
-var_dump($res);
?>
===DONE===
string(1) "X"
}
}
-Test 2: Invalid use of a null byte
-
-Warning: oci_execute(): ORA-00942: %s in %snull_byte_2.php on line %d
Test 3: Using a null byte in a bind variable name
Warning: oci_bind_by_name(): ORA-01036: %s in %snull_byte_2.php on line %d
Warning: oci_execute(): ORA-01008: %s in %snull_byte_2.php on line %d
-Test 4: Using a null byte in a bind variable value causing WHERE clause to fail
-array(1) {
- ["DUMMY"]=>
- array(0) {
- }
-}
===DONE===
--- /dev/null
+--TEST--
+Null bytes in SQL statements
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+--INI--
+display_errors = On
+error_reporting = E_WARNING
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/connect.inc');
+
+// Run Test
+
+echo "Test 1: Invalid use of a null byte\n";
+
+$s = oci_parse($c, "select * from du\0al");
+oci_execute($s);
+
+echo "Test 2: Using a null byte in a bind variable value causing WHERE clause to fail\n";
+
+$s = oci_parse($c, "select * from dual where :bv = 'abc'");
+$bv = 'abc\0abc';
+oci_bind_by_name($s, ":bv", $bv);
+oci_execute($s);
+oci_fetch_all($s, $res);
+var_dump($res);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+Test 1: Invalid use of a null byte
+
+Warning: oci_execute(): ORA-00942: %s in %snull_byte_3.php on line %d
+Test 2: Using a null byte in a bind variable value causing WHERE clause to fail
+array(1) {
+ ["DUMMY"]=>
+ array(0) {
+ }
+}
+===DONE===
"create table num_tab (id number, value number)",
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- $r = @oci_execute($s);
- if (!$r) {
- $m = oci_error($s);
- if (!in_array($m['code'], array( // ignore expected errors
- 942 // table or view does not exist
- ))) {
- echo $stmt . PHP_EOL . $m['message'] . PHP_EOL;
- }
- }
-}
-
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
// Run Test
"drop table num_tab"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
echo "Done\n";
--TEST--
oci_execute() segfault after repeated bind of LOB descriptor
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
--FILE--
<?php
-require(dirname(__FILE__)."/details.inc");
+require(dirname(__FILE__)."/connect.inc");
+
+$stmtarray = array(
+ "drop user testuser cascade",
+ "create user testuser identified by testuserpwd",
+ "grant connect, create session to testuser"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
-// Create a user we can stuff around with and not affect subsequent tests
-$c0 = oci_connect($user, $password, $dbase);
-$stmts = array(
- "drop user testuser",
- "begin
- execute immediate 'create user testuser identified by testuserpwd';
- execute immediate 'grant connect, create session to testuser';
- end;");
-foreach ($stmts as $sql) {
- $s = oci_parse($c0, $sql);
- @oci_execute($s);
-}
// Connect and change the password
$c1 = oci_connect("testuser", "testuserpwd", $dbase);
var_dump($c2);
}
-// Clean up
-oci_close($c1);
-oci_close($c2);
-oci_close($c3);
+echo "Done\n";
+
+?>
+--CLEAN--
+<?php
-// Clean up
-$s = oci_parse($c0, "drop user cascade testuser");
-@oci_execute($s);
+require(dirname(__FILE__)."/connect.inc");
-echo "Done\n";
+$stmtarray = array(
+ "drop user testuser cascade"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
?>
--EXPECTF--
--FILE--
<?php
-require(dirname(__FILE__)."/details.inc");
+require(dirname(__FILE__)."/connect.inc");
-// Create a user we can stuff around with and not affect subsequent tests
-$c0 = oci_connect($user, $password, $dbase);
-$stmts = array(
- "drop user testuser",
- "begin
- execute immediate 'create user testuser identified by testuserpwd';
- execute immediate 'grant connect, create session to testuser';
- end;");
-foreach ($stmts as $sql) {
- $s = oci_parse($c0, $sql);
- @oci_execute($s);
-}
+$stmtarray = array(
+ "drop user testuser cascade",
+ "create user testuser identified by testuserpwd",
+ "grant connect, create session to testuser"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
// Connect (persistent) and change the password
$c1 = oci_pconnect("testuser", "testuserpwd", $dbase);
var_dump($c2);
}
-// Clean up
-oci_close($c1);
-oci_close($c2);
-oci_close($c3);
+echo "Done\n";
-// Clean up
-$s = oci_parse($c0, "drop user cascade testuser");
-@oci_execute($s);
+?>
+--CLEAN--
+<?php
-echo "Done\n";
+require(dirname(__FILE__)."/connect.inc");
+
+$stmtarray = array(
+ "drop user testuser cascade"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
?>
--EXPECTF--
oci_password_change()
--SKIPIF--
<?php
-if (!extension_loaded('oci8')) die("skip no oci8 extension");
-require(dirname(__FILE__)."/connect.inc");
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on thes
+require(dirname(__FILE__).'/skipif.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)
-$sv = oci_server_version($c);
-$sv = preg_match('/Release (11|12)\./', $sv, $matches);
-if ($sv === 1) {
- ob_start();
- phpinfo(INFO_MODULES);
- $phpinfo = ob_get_clean();
- $iv = preg_match('/Oracle .*Version => 10/', $phpinfo);
- if ($iv === 1) {
- die ("skip test known to fail using Oracle 10.2.0.4 client libs connecting to Oracle 11 (6277160)");
- }
+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)");
}
?>
--FILE--
ocipasswordchange()
--SKIPIF--
<?php
-if (!extension_loaded('oci8')) die("skip no oci8 extension");
-require(dirname(__FILE__)."/connect.inc");
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on thes
+require(dirname(__FILE__).'/skipif.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)
-$sv = oci_server_version($c);
-$sv = preg_match('/Release (11|12)\./', $sv, $matches);
-if ($sv === 1) {
- ob_start();
- phpinfo(INFO_MODULES);
- $phpinfo = ob_get_clean();
- $iv = preg_match('/Oracle .*Version => 10/', $phpinfo);
- if ($iv === 1) {
- die ("skip test known to fail using Oracle 10.2.0.4 client libs connecting to Oracle 11 (6277160)");
- }
+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)");
}
+
+
?>
--FILE--
<?php
--TEST--
PECL Bug #10194 (segfault in Instant Client when memory_limit is reached inside the callback)
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--INI--
memory_limit=10M
--FILE--
--TEST--
PECL Bug #10194 (segfault in Instant Client when memory_limit is reached inside the callback)
--SKIPIF--
-<?php
-if (!extension_loaded('oci8')) die("skip no oci8 extension");
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platforms only");
-?>
+?>
--INI--
memory_limit=3M
--FILE--
<?php
// This test is dependent on the behavior of the memory manager
-
-require dirname(__FILE__).'/connect.inc';
-require dirname(__FILE__).'/create_table.inc';
+
+require(dirname(__FILE__).'/connect.inc');
+require(dirname(__FILE__).'/create_table.inc');
-$ora_sql = "INSERT INTO ".$schema.$table_name." (blob)
- VALUES (empty_blob())";
+$ora_sql = "INSERT INTO ".$schema.$table_name." (blob) VALUES (empty_blob())";
$statement = oci_parse($c,$ora_sql);
oci_execute($statement);
$string = str_repeat("test", 32768*4*4);
for ($i = 0; $i < 8; $i++) {
- $row['BLOB']->write($string);
+ $row['BLOB']->write($string);
}
oci_commit($c);
echo "Done\n";
?>
---EXPECTF--
+--EXPECTF--
Before load()
Fatal error: Allowed memory size of %d bytes exhausted%s(tried to allocate %d bytes) in %s on line %d
PECL Bug #10194 (segfault in Instant Client when memory_limit is reached inside the callback)
--SKIPIF--
<?php
-if (!extension_loaded('oci8')) die("skip no oci8 extension");
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on thes
+require(dirname(__FILE__).'/skipif.inc');
if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platforms only");
?>
--INI--
--TEST--
-PECL Bug #16035 (Crash with Oracle 10.2 connecting with a character set but ORACLE_HOME isn't set)
+PECL Bug #16035 (Crash with Oracle 10.2 connecting with a character set but ORACLE_HOME is not set)
--SKIPIF--
<?php
if (!extension_loaded('oci8')) die ("skip no oci8 extension");
<?php exit(0); ?>
--EXPECTF--
Warning: oci_connect(): 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: oci_connect(): Error while trying to retrieve text for error ORA-01804
+ in %specl_bug16035.php on line %d
===DONE===
--TEST--
PECL Bug #16842 (NO_DATA_FOUND exception is a warning)
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--INI--
error_reporting = E_WARNING
--FILE--
Warning: oci_execute(): OCI_NO_DATA in %s on line 11
bool(false)
array(4) {
- [%u|b%"code"]=>
+ ["code"]=>
int(1403)
- [%u|b%"message"]=>
- %unicode|string%(45) "ORA-01403: %s
+ ["message"]=>
+ string(%d) "ORA-01403: %s
ORA-06512: at line 1"
- [%u|b%"offset"]=>
+ ["offset"]=>
int(0)
- [%u|b%"sqltext"]=>
- %unicode|string%(31) "begin raise NO_DATA_FOUND; end;"
+ ["sqltext"]=>
+ string(31) "begin raise NO_DATA_FOUND; end;"
}
Test 2
Raises ZERO_DIVIDE
ORA-06512: at line 1 in %s on line 19
bool(false)
array(4) {
- [%u|b%"code"]=>
+ ["code"]=>
int(1476)
- [%u|b%"message"]=>
- %unicode|string%(56) "ORA-01476: %s
+ ["message"]=>
+ string(%d) "ORA-01476: %s
ORA-06512: at line 1"
- [%u|b%"offset"]=>
+ ["offset"]=>
int(0)
- [%u|b%"sqltext"]=>
- %unicode|string%(29) "begin raise ZERO_DIVIDE; end;"
+ ["sqltext"]=>
+ string(29) "begin raise ZERO_DIVIDE; end;"
}
===DONE===
--TEST--
PECL Bug #8816 (issue in php_oci_statement_fetch with more than one piecewise column)
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
"insert into prefetch_tab (id, value) values (1,1)",
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- $r = @oci_execute($s);
- if (!$r) {
- $m = oci_error($s);
- if (!in_array($m['code'], array( // ignore expected errors
- 942 // table or view does not exist
- ))) {
- echo $stmt . PHP_EOL . $m['message'] . PHP_EOL;
- }
- }
-}
-
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
// Run Test
"drop table prefetch_tab"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
echo "Done\n";
?>
"insert into prefetch_old_tab (id, value) values (1,1)",
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- $r = @oci_execute($s);
- if (!$r) {
- $m = oci_error($s);
- if (!in_array($m['code'], array( // ignore expected errors
- 942 // table or view does not exist
- ))) {
- echo $stmt . PHP_EOL . $m['message'] . PHP_EOL;
- }
- }
-}
-
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
// Run Test
"drop table prefetch_old_tab"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
echo "Done\n";
?>
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension");
if (!extension_loaded('oci8')) die("skip no oci8 extension");
require(dirname(__FILE__)."/connect.inc");
-ob_start();
-phpinfo(INFO_MODULES);
-$phpinfo = ob_get_clean();
-$iv = preg_match('/Oracle .*Version => (11\.2|12\.)/', $phpinfo);
-if ($iv == 1) {
- $sv = oci_server_version($c);
- $sv = preg_match('/Release 1[012]\./', $sv, $matches);
- if ($sv != 1) {
- die ("skip expected output only valid when using Oracle 10g or greater server");
- }
-}
-else {
- die ("skip expected output only valid when using Oracle 11.2 or greater client");
+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) {
+ die("skip test expected to work only with Oracle 11gR2 or greater version of client");
}
?>
--FILE--
end refcurpkg;"
);
-foreach($stmtarray as $stmt) {
- $s = oci_parse($c,$stmt);
- $r = @oci_execute($s);
- if (!$r) {
- $msg = oci_error($s);
- if ($msg['code'] != 942) {
- echo $msg['message'],"\n";
- }
- }
-}
+oci8_test_sql_execute($c, $stmtarray);
// Insert 500 rows into the table.
$insert_sql = "INSERT INTO refcurtest (c1, c2) VALUES (:c1,:c2)";
oci_execute($s1);
oci_set_prefetch($cur1,$value);
oci_execute($cur1);
- echo "Fetch Row from PHP\n";
+ echo "Fetch Row from PHP\n";
var_dump(oci_fetch_row($cur1));
}
if (!oci_bind_by_name($s2,":curs1",$cur1,-1,SQLT_RSET)) {
die("oci_bind_by_name(sql2) failed!\n");
}
- if (!oci_bind_by_name($s2,":c1",$c1,SQLT_INT)) {
+ if (!oci_bind_by_name($s2,":c1",$c1,-1,SQLT_INT)) {
die("oci_bind_by_name(sql2) failed!\n");
}
- if (!oci_bind_by_name($s2,":c2",$c2,SQLT_AFC)) {
+ if (!oci_bind_by_name($s2,":c2",$c2,20,SQLT_CHR)) {
die("oci_bind_by_name(sql2) failed!\n");
}
oci_execute($s2);
- echo "Fetch Row from PL/SQL\n";
+ echo "Fetch Row from PL/SQL\n";
var_dump($c1);
var_dump($c2);
}
"drop table refcurtest"
);
-foreach($stmtarray as $stmt) {
- $s = oci_parse($c,$stmt);
- $r = @oci_execute($s);
- if (!$r) {
- $msg = oci_error($s);
- echo $msg['message'],"\n";
- }
-}
-oci_close($c);
+oci8_test_sql_execute($c, $stmtarray);
+
echo "Done\n";
?>
--EXPECTF--
-----------------------------------------------
Test with Prefetch value set to 0
-----------------------------------------------
-Fetch Row from PHP
+Fetch Row from PHP
array(2) {
[0]=>
- %unicode|string%(%d) "0"
+ string(%d) "0"
[1]=>
- %unicode|string%(%d) "test0"
+ string(%d) "test0"
}
-Fetch Row from PL/SQL
-%unicode|string%(%d) "1"
-%unicode|string%(%d) "test1"
+Fetch Row from PL/SQL
+int(1)
+string(%d) "test1"
-----------------------------------------------
Test with Prefetch value set to 1
-----------------------------------------------
-Fetch Row from PHP
+Fetch Row from PHP
array(2) {
[0]=>
- %unicode|string%(%d) "0"
+ string(%d) "0"
[1]=>
- %unicode|string%(%d) "test0"
+ string(%d) "test0"
}
-Fetch Row from PL/SQL
-%unicode|string%(%d) "2"
-%unicode|string%(%d) "test2"
+Fetch Row from PL/SQL
+int(2)
+string(%d) "test2"
-----------------------------------------------
Test with Prefetch value set to 501
-----------------------------------------------
-Fetch Row from PHP
+Fetch Row from PHP
array(2) {
[0]=>
- %unicode|string%(%d) "0"
+ string(%d) "0"
[1]=>
- %unicode|string%(%d) "test0"
+ string(%d) "test0"
}
Warning: oci_execute(): ORA-01002: %s
-ORA-06512: at "SYSTEM.REFCURPKG", line %d
+ORA-06512: at "%s.REFCURPKG", line %d
ORA-06512: at line %d in %s on line %d
-Fetch Row from PL/SQL
-NULL
+Fetch Row from PL/SQL
+int(0)
NULL
-----------------------------------------------
Test with Prefetch value set to 499
-----------------------------------------------
-Fetch Row from PHP
+Fetch Row from PHP
array(2) {
[0]=>
- %unicode|string%(%d) "0"
+ string(%d) "0"
[1]=>
- %unicode|string%(%d) "test0"
+ string(%d) "test0"
}
-Fetch Row from PL/SQL
-%unicode|string%(%d) "500"
-%unicode|string%(%d) "test500"
+Fetch Row from PL/SQL
+int(500)
+string(%d) "test500"
-----------------------------------------------
Test with Prefetch value set to 250
-----------------------------------------------
-Fetch Row from PHP
+Fetch Row from PHP
array(2) {
[0]=>
- %unicode|string%(%d) "0"
+ string(%d) "0"
[1]=>
- %unicode|string%(%d) "test0"
+ string(%d) "test0"
}
-Fetch Row from PL/SQL
-%unicode|string%(%d) "251"
-%unicode|string%(%d) "test251"
+Fetch Row from PL/SQL
+int(251)
+string(%d) "test251"
-----------------------------------------------
Test with Prefetch value set to 12345
-----------------------------------------------
-Fetch Row from PHP
+Fetch Row from PHP
array(2) {
[0]=>
- %unicode|string%(%d) "0"
+ string(%d) "0"
[1]=>
- %unicode|string%(%d) "test0"
+ string(%d) "test0"
}
Warning: oci_execute(): ORA-01002: %s
-ORA-06512: at "SYSTEM.REFCURPKG", line %d
+ORA-06512: at "%s.REFCURPKG", line %d
ORA-06512: at line %d in %s on line %d
-Fetch Row from PL/SQL
-NULL
+Fetch Row from PL/SQL
+int(0)
NULL
-----------------------------------------------
Test with Prefetch value set to -12345
-----------------------------------------------
Warning: oci_set_prefetch(): Number of rows to be prefetched has to be greater than or equal to 0 in %s on line %d
-Fetch Row from PHP
+Fetch Row from PHP
array(2) {
[0]=>
- %unicode|string%(%d) "0"
+ string(%d) "0"
[1]=>
- %unicode|string%(%d) "test0"
+ string(%d) "test0"
}
-Fetch Row from PL/SQL
-%unicode|string%(%d) "101"
-%unicode|string%(%d) "test101"
+Fetch Row from PL/SQL
+int(101)
+string(%d) "test101"
-----------------------------------------------
Test with Prefetch value set to -1
-----------------------------------------------
Warning: oci_set_prefetch(): Number of rows to be prefetched has to be greater than or equal to 0 in %s on line %d
-Fetch Row from PHP
+Fetch Row from PHP
array(2) {
[0]=>
- %unicode|string%(%d) "0"
+ string(%d) "0"
[1]=>
- %unicode|string%(%d) "test0"
+ string(%d) "test0"
}
-Fetch Row from PL/SQL
-%unicode|string%(%d) "101"
-%unicode|string%(%d) "test101"
+Fetch Row from PL/SQL
+int(101)
+string(%d) "test101"
Done
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension");
if (!extension_loaded('oci8')) die("skip no oci8 extension");
require(dirname(__FILE__)."/connect.inc");
-ob_start();
-phpinfo(INFO_MODULES);
-$phpinfo = ob_get_clean();
-$iv = preg_match('/Oracle .*Version => (11\.2|12\.)/', $phpinfo);
-if ($iv == 1) {
- $sv = oci_server_version($c);
- $sv = preg_match('/Release 1[012]\./', $sv, $matches);
- if ($sv != 1) {
- die ("skip expected output only valid when using Oracle 10g or greater server");
- }
-}
-else {
- die ("skip expected output only valid when using Oracle 11.1 or greater client");
+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) {
+ die("skip test expected to work only with Oracle 11gR2 or greater version of client");
}
?>
--FILE--
end refcurpkg;"
);
-foreach($stmtarray as $stmt) {
- $s = oci_parse($c,$stmt);
- $r = @oci_execute($s);
- if (!$r) {
- $msg = oci_error($s);
- if ($msg['code'] != 942) {
- echo $msg['message'],"\n";
- }
- }
-}
+oci8_test_sql_execute($c, $stmtarray);
// Insert 500 rows into the table.
$insert_sql = "INSERT INTO refcurtest (c1, c2) VALUES (:c1,:c2)";
$sql2 = "begin refcurpkg.fetch_ref_cur(:curs1,:c1,:c2); end;";
$s2 = oci_parse($c,$sql2);
-if (!oci_bind_by_name($s2,":curs1",$cur1,-1,SQLT_RSET)) {
+if (!oci_bind_by_name($s2, ":curs1", $cur1, -1, SQLT_RSET)) {
die("oci_bind_by_name(sql2) failed!\n");
}
-if (!oci_bind_by_name($s2,":c1",$c1,SQLT_INT)) {
+if (!oci_bind_by_name($s2, ":c1", $c1, -1, SQLT_INT)) {
die("oci_bind_by_name(sql2) failed!\n");
}
-if (!oci_bind_by_name($s2,":c2",$c2,SQLT_AFC)) {
+if (!oci_bind_by_name($s2, ":c2", $c2, 20, SQLT_CHR)) {
die("oci_bind_by_name(sql2) failed!\n");
}
die("oci_bind_by_name(sql1) failed!\n");
}
-echo "Fetch Row from PHP\n";
+echo "Fetch Row from PHP\n";
oci_execute($s1);
oci_execute($cur1);
var_dump(oci_fetch_row($cur1));
die("oci_bind_by_name(sql2) failed!\n");
}
oci_execute($s2);
-echo "Fetch Row from PL/SQL\n";
-var_dump($c1);
-var_dump($c2);
-
-echo "------Test 3 - Set Prefetch after PL/SQL fetch ----------\n";
-$cur1 = oci_new_cursor($c);
-// Fetch from PL/SQL
-if (!oci_bind_by_name($s2,":curs1",$cur1,-1,SQLT_RSET)) {
- die("oci_bind_by_name(sql2) failed!\n");
-}
-oci_execute($s2);
-echo "Fetch Row from PL/SQL\n";
-var_dump($c1);
-var_dump($c2);
-
-// Fetch from PHP
-echo "Fetch Row from PHP\n";
-if (!oci_bind_by_name($s1,":cur1",$cur1,-1,SQLT_RSET)) {
- die("oci_bind_by_name(sql1) failed!\n");
-}
-oci_set_prefetch($cur1,5);
-oci_execute($s1);
-oci_execute($cur1);
-var_dump(oci_fetch_row($cur1));
-
-echo "------Test 4- Overwrite prefetch-----------\n";
-// Fetch from PHP
-$cur1 = oci_new_cursor($c);
-if (!oci_bind_by_name($s1,":cur1",$cur1,-1,SQLT_RSET)) {
- die("oci_bind_by_name(sql1) failed!\n");
-}
-echo "Fetch Row from PHP\n";
-oci_execute($s1);
-oci_execute($cur1);
-var_dump(oci_fetch_row($cur1));
-oci_set_prefetch($cur1,5);
-oci_set_prefetch($cur1,0);
-oci_set_prefetch($cur1,100);
-
-// Fetch from PL/SQL
-if (!oci_bind_by_name($s2,":curs1",$cur1,-1,SQLT_RSET)) {
- die("oci_bind_by_name(sql2) failed!\n");
-}
-oci_execute($s2);
-echo "Fetch Row from PL/SQL\n";
+echo "Fetch Row from PL/SQL\n";
var_dump($c1);
var_dump($c2);
-
function print_roundtrips($c) {
$sql_stmt = "select value from v\$mystat a,v\$statname c where
a.statistic#=c.statistic# and c.name='SQL*Net roundtrips to/from client'";
"drop table refcurtest"
);
-foreach($stmtarray as $stmt) {
- $s = oci_parse($c,$stmt);
- $r = @oci_execute($s);
- if (!$r) {
- $msg = oci_error($s);
- echo $msg['message'],"\n";
- }
-}
+oci8_test_sql_execute($c, $stmtarray);
-oci_close($c);
echo "Done\n";
?>
--EXPECTF--
------Test 1- Check Roundtrips with prefetch 0 and 5 -----------
array(2) {
[0]=>
- %unicode|string%(%d) "0"
+ string(1) "0"
[1]=>
- %unicode|string%(%d) "test0"
+ string(5) "test0"
}
array(2) {
[0]=>
- %unicode|string%(%d) "1"
+ string(1) "1"
[1]=>
- %unicode|string%(%d) "test1"
+ string(5) "test1"
}
array(2) {
[0]=>
- %unicode|string%(%d) "2"
+ string(1) "2"
[1]=>
- %unicode|string%(%d) "test2"
+ string(5) "test2"
}
array(2) {
[0]=>
- %unicode|string%(%d) "3"
+ string(1) "3"
[1]=>
- %unicode|string%(%d) "test3"
+ string(5) "test3"
}
array(2) {
[0]=>
- %unicode|string%(%d) "4"
+ string(1) "4"
[1]=>
- %unicode|string%(%d) "test4"
+ string(5) "test4"
}
Number of roundtrips made with prefetch count 0 for 5 rows is 6
array(2) {
[0]=>
- %unicode|string%(%d) "5"
+ string(1) "5"
[1]=>
- %unicode|string%(%d) "test5"
+ string(5) "test5"
}
array(2) {
[0]=>
- %unicode|string%(%d) "6"
+ string(1) "6"
[1]=>
- %unicode|string%(%d) "test6"
+ string(5) "test6"
}
array(2) {
[0]=>
- %unicode|string%(%d) "7"
+ string(1) "7"
[1]=>
- %unicode|string%(%d) "test7"
+ string(5) "test7"
}
array(2) {
[0]=>
- %unicode|string%(%d) "8"
+ string(1) "8"
[1]=>
- %unicode|string%(%d) "test8"
+ string(5) "test8"
}
array(2) {
[0]=>
- %unicode|string%(%d) "9"
+ string(1) "9"
[1]=>
- %unicode|string%(%d) "test9"
+ string(5) "test9"
}
Number of roundtrips made with prefetch count 5 for 5 rows is 2
------Test 2 - Set Prefetch before PL/SQL fetch ----------
-Fetch Row from PHP
-array(2) {
- [0]=>
- %unicode|string%(%d) "0"
- [1]=>
- %unicode|string%(%d) "test0"
-}
-Fetch Row from PL/SQL
-%unicode|string%(%d) "101"
-%unicode|string%(%d) "test101"
-------Test 3 - Set Prefetch after PL/SQL fetch ----------
-
-Warning: oci_execute(): ORA-01001: %s
-ORA-06512: at "%s.REFCURPKG", line %d
-ORA-06512: at line %d in %s on line %d
-Fetch Row from PL/SQL
-%unicode|string%(%d) "101"
-%unicode|string%(%d) "test101"
-Fetch Row from PHP
-array(2) {
- [0]=>
- %unicode|string%(%d) "0"
- [1]=>
- %unicode|string%(%d) "test0"
-}
-------Test 4- Overwrite prefetch-----------
-Fetch Row from PHP
+Fetch Row from PHP
array(2) {
[0]=>
- %unicode|string%(%d) "0"
+ string(1) "0"
[1]=>
- %unicode|string%(%d) "test0"
+ string(5) "test0"
}
-Fetch Row from PL/SQL
-%unicode|string%(%d) "101"
-%unicode|string%(%d) "test101"
+Fetch Row from PL/SQL
+int(101)
+string(%d) "test101"
Done
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension");
if (!extension_loaded('oci8')) die("skip no oci8 extension");
require(dirname(__FILE__)."/connect.inc");
-ob_start();
-phpinfo(INFO_MODULES);
-$phpinfo = ob_get_clean();
-$iv = preg_match('/Oracle .*Version => (11\.2|12\.)/', $phpinfo);
-if ($iv == 1) {
- $sv = oci_server_version($c);
- $sv = preg_match('/Release (11\.2|12\.)/', $sv, $matches);
- if ($sv != 1) {
- die ("skip expected output only valid when using Oracle 11.2 or greater server");
- }
-}
-else {
- die ("skip expected output only valid when using Oracle 11.2 or greater client");
+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 11gR2 or greater version of client");
}
?>
"create table nescurtest(c1 varchar2(10))"
);
-foreach($stmtarray as $stmt) {
- $s = oci_parse($c,$stmt);
- $r = @oci_execute($s);
- if (!$r) {
- $msg = oci_error($s);
- if ($msg['code'] !=942) {
- echo $msg['message'],"\n";
- }
- }
-}
+oci8_test_sql_execute($c, $stmtarray);
+
// Insert 500 rows into the table.
$insert_sql = "INSERT INTO nescurtest (c1) VALUES (:c1)";
if (!($s = oci_parse($c, $insert_sql))) {
"drop table nescurtest"
);
-foreach($stmtarray as $stmt) {
- $s = oci_parse($c,$stmt);
- $r = @oci_execute($s);
- if (!$r) {
- $msg = oci_error($s);
- echo $msg['message'],"\n";
- }
-}
-oci_close($c);
+oci8_test_sql_execute($c, $stmtarray);
+
echo "Done\n";
?>
--EXPECTF--
--- /dev/null
+--TEST--
+Prefetch with REF cursor. Test No 4
+--SKIPIF--
+<?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) {
+ die("skip test expected to work only with Oracle 11gR2 or greater version of client");
+}
+?>
+--FILE--
+<?php
+require dirname(__FILE__)."/connect.inc";
+
+// Creates the necessary package and tables.
+$stmtarray = array(
+ "DROP TABLE refcurtest",
+
+ "CREATE TABLE refcurtest (c1 NUMBER, c2 VARCHAR(20))",
+
+ "CREATE or REPLACE PACKAGE refcurpkg is
+ type refcursortype is ref cursor;
+ procedure open_ref_cur(cur1 out refcursortype);
+ procedure fetch_ref_cur(cur1 in refcursortype, c1 out number, c2 out varchar2);
+ end refcurpkg;",
+
+ "CREATE or REPLACE PACKAGE body refcurpkg is
+ procedure open_ref_cur(cur1 out refcursortype) is
+ begin
+ open cur1 for select * from refcurtest order by c1;
+ end open_ref_cur;
+ procedure fetch_ref_cur(cur1 in refcursortype, c1 out number, c2 out varchar2) is
+ begin
+ fetch cur1 into c1,c2;
+ end fetch_ref_cur;
+ end refcurpkg;"
+ );
+
+oci8_test_sql_execute($c, $stmtarray);
+
+// Insert 500 rows into the table.
+$insert_sql = "INSERT INTO refcurtest (c1, c2) VALUES (:c1,:c2)";
+if (!($s = oci_parse($c, $insert_sql))) {
+ die("oci_parse(insert) failed!\n");
+}
+
+for ($i = 0; $i <= 500; $i++) {
+ $val2 = 'test'.$i;
+ oci_bind_by_name($s,':c1',$i);
+ oci_bind_by_name($s,':c2',$val2);
+ if (!oci_execute($s)) {
+ die("oci_execute(insert) failed!\n");
+ }
+}
+
+// Steps to Fetch from PHP . For every sub-test,the cursor is bound and then executed.
+
+$sql1 = "begin refcurpkg.open_ref_cur(:cur1); end;";
+$s1 = oci_parse($c,$sql1);
+$cur1 = oci_new_cursor($c);
+if (!oci_bind_by_name($s1,":cur1",$cur1,-1,SQLT_RSET)) {
+ die("oci_bind_by_name(sql1) failed!\n");
+}
+
+
+// Steps to Fetch from PL/SQL . For every sub-test,the cursor is bound and then executed.
+
+$sql2 = "begin refcurpkg.fetch_ref_cur(:curs1,:c1,:c2); end;";
+$s2 = oci_parse($c,$sql2);
+if (!oci_bind_by_name($s2, ":curs1", $cur1, -1, SQLT_RSET)) {
+ die("oci_bind_by_name(sql2) failed!\n");
+}
+if (!oci_bind_by_name($s2, ":c1", $c1, -1, SQLT_INT)) {
+ die("oci_bind_by_name(sql2) failed!\n");
+}
+if (!oci_bind_by_name($s2, ":c2", $c2, 20, SQLT_CHR)) {
+ die("oci_bind_by_name(sql2) failed!\n");
+}
+
+
+echo "------Test 1 - Set Prefetch after PL/SQL fetch ----------\n";
+$cur1 = oci_new_cursor($c);
+// Fetch from PL/SQL
+if (!oci_bind_by_name($s2,":curs1",$cur1,-1,SQLT_RSET)) {
+ die("oci_bind_by_name(sql2) failed!\n");
+}
+oci_execute($s2);
+echo "Fetch Row from PL/SQL\n";
+var_dump($c1);
+var_dump($c2);
+
+// Fetch from PHP
+echo "Fetch Row from PHP\n";
+if (!oci_bind_by_name($s1,":cur1",$cur1,-1,SQLT_RSET)) {
+ die("oci_bind_by_name(sql1) failed!\n");
+}
+oci_set_prefetch($cur1,5);
+oci_execute($s1);
+oci_execute($cur1);
+var_dump(oci_fetch_row($cur1));
+
+echo "------Test 2- Overwrite prefetch-----------\n";
+// Fetch from PHP
+$cur1 = oci_new_cursor($c);
+if (!oci_bind_by_name($s1,":cur1",$cur1,-1,SQLT_RSET)) {
+ die("oci_bind_by_name(sql1) failed!\n");
+}
+echo "Fetch Row from PHP\n";
+oci_execute($s1);
+oci_execute($cur1);
+var_dump(oci_fetch_row($cur1));
+oci_set_prefetch($cur1,5);
+oci_set_prefetch($cur1,0);
+oci_set_prefetch($cur1,100);
+
+// Fetch from PL/SQL
+if (!oci_bind_by_name($s2,":curs1",$cur1,-1,SQLT_RSET)) {
+ die("oci_bind_by_name(sql2) failed!\n");
+}
+oci_execute($s2);
+echo "Fetch Row from PL/SQL\n";
+var_dump($c1);
+var_dump($c2);
+
+
+function print_roundtrips($c) {
+ $sql_stmt = "select value from v\$mystat a,v\$statname c where
+ a.statistic#=c.statistic# and c.name='SQL*Net roundtrips to/from client'";
+ $s = oci_parse($c,$sql_stmt);
+ oci_define_by_name($s,"VALUE",$value);
+ oci_execute($s);
+ oci_fetch($s);
+ return $value;
+}
+
+// Clean up here
+
+$stmtarray = array(
+ "drop package refcurpkg",
+ "drop table refcurtest"
+);
+
+oci8_test_sql_execute($c, $stmtarray);
+
+echo "Done\n";
+?>
+--EXPECTF--
+------Test 1 - Set Prefetch after PL/SQL fetch ----------
+
+Warning: oci_execute(): ORA-01001: %s
+ORA-06512: at "SYSTEM.REFCURPKG", line %d
+ORA-06512: at line %d in %s on line %d
+Fetch Row from PL/SQL
+int(0)
+NULL
+Fetch Row from PHP
+array(2) {
+ [0]=>
+ string(1) "0"
+ [1]=>
+ string(5) "test0"
+}
+------Test 2- Overwrite prefetch-----------
+Fetch Row from PHP
+array(2) {
+ [0]=>
+ string(1) "0"
+ [1]=>
+ string(5) "test0"
+}
+Fetch Row from PL/SQL
+int(101)
+string(%d) "test101"
+Done
echo "Done\n";
?>
---EXPECT--
+--EXPECTF--
array(2) {
[0]=>
NULL
- ["NULL"]=>
+ ["%r(NULL|EXP)%r"]=>
NULL
}
Done
?>
--EXPECTF--
resource(%d) of type (oci8 connection)
-string(%d) "%s"
-string(%d) "%s"
+string(%d) "Oracle %s"
+string(%d) "Oracle %s"
Done
if (!extension_loaded('oci8')) die("skip oci8 extension is not available\n");
-/*
- * Remove or comment this line to run tests
- *
- * */
-die("skip change default login/password\n");
+// Check the test file is valid for this DB type
+require(dirname(__FILE__).'/connect.inc');
+$v = oci_server_version($c);
+if (strpos($v, 'Oracle Database') !== false)
+ $dbtype = 'oracledb';
+else if (strpos($v, 'Oracle TimesTen') !== false)
+ $dbtype = 'timesten';
+else {
+ die("skip Unknown database type $v\n");
+}
+if (!array_key_exists($dbtype, $target_dbs) || $target_dbs[$dbtype] !== true)
+ die("skip Test not valid for $v\n");
+
?>
--TEST--
statement cache
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => true); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
+// Note: with TimesTen, the column will be called "EXP"
+
require dirname(__FILE__)."/connect.inc";
$pc = oci_pconnect($user, $password, $dbase);
array(2) {
[0]=>
string(1) "4"
- ["1+3"]=>
+ ["%r(1\+3|EXP)%r"]=>
string(1) "4"
}
array(2) {
[0]=>
string(1) "4"
- ["1+3"]=>
+ ["%r(1\+3|EXP)%r"]=>
string(1) "4"
}
Done
--TEST--
Basic XMLType test
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
-<?php if (!extension_loaded("simplexml")) die("skip no simplexml extension"); ?>
+<?php
+if (!extension_loaded("simplexml")) die("skip no simplexml extension");
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
--FILE--
<?php
// Initialization
-$stmts = array(
+$stmtarray = array(
"drop table xtt",
"create table xtt
(xt_id number, xt_spec xmltype)
</Xt>'))"
);
-foreach ($stmts as $q) {
- $s = oci_parse($c, $q);
- $r = @oci_execute($s);
- if (!$r) {
- $m = oci_error($s);
- if ($m['code'] != 942) { // table or view doesn't exist
- echo $m['message'], "\n";
- }
- }
-}
+oci8_test_sql_execute($c, $stmtarray);
function do_query($c)
{
// Cleanup
-$stmts = array(
+$stmtarray = array(
"drop table xtt",
);
-foreach ($stmts as $q) {
- $s = oci_parse($c, $q);
- @oci_execute($s);
-}
+oci8_test_sql_execute($c, $stmtarray);
echo "Done\n";
--TEST--
Basic XMLType test #2
--SKIPIF--
-<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+<?php
+$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
+require(dirname(__FILE__).'/skipif.inc');
+?>
--FILE--
<?php
"create table xmltype_02_tab (warehouse_id number, warehouse_spec xmltype)",
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- $r = @oci_execute($s);
- if (!$r) {
- $m = oci_error($s);
- if (!in_array($m['code'], array( // ignore expected errors
- 942 // table or view does not exist
- , 2289 // sequence does not exist
- , 4080 // trigger does not exist
- ))) {
- echo $stmt . PHP_EOL . $m['message'] . PHP_EOL;
- }
- }
-}
+oci8_test_sql_execute($c, $stmtarray);
// Run Test
// Clean up
-//require(dirname(__FILE__).'/drop_table.inc');
-
$stmtarray = array(
"drop table xmltype_02_tab"
);
-foreach ($stmtarray as $stmt) {
- $s = oci_parse($c, $stmt);
- oci_execute($s);
-}
-
-oci_close($c);
+oci8_test_sql_execute($c, $stmtarray);
?>
===DONE===
array(1) {
[0]=>
object(OCI-Lob)#%d (1) {
- [%u|b%"descriptor"]=>
+ ["descriptor"]=>
resource(%d) of type (oci8 descriptor)
}
}
Test 2 Manipulate the data using SimpleXML
object(SimpleXMLElement)#%d (10) {
- [%u|b%"WarehouseId"]=>
- %unicode|string%(1) "1"
- [%u|b%"WarehouseName"]=>
- %unicode|string%(16) "Southlake, Texas"
- [%u|b%"Building"]=>
- %unicode|string%(5) "Owned"
- [%u|b%"Area"]=>
- %unicode|string%(5) "25000"
- [%u|b%"Docks"]=>
- %unicode|string%(1) "2"
- [%u|b%"DockType"]=>
- %unicode|string%(9) "Rear load"
- [%u|b%"WaterAccess"]=>
- %unicode|string%(4) "true"
- [%u|b%"RailAccess"]=>
- %unicode|string%(1) "N"
- [%u|b%"Parking"]=>
- %unicode|string%(6) "Street"
- [%u|b%"VClearance"]=>
- %unicode|string%(2) "10"
+ ["WarehouseId"]=>
+ string(1) "1"
+ ["WarehouseName"]=>
+ string(16) "Southlake, Texas"
+ ["Building"]=>
+ string(5) "Owned"
+ ["Area"]=>
+ string(5) "25000"
+ ["Docks"]=>
+ string(1) "2"
+ ["DockType"]=>
+ string(9) "Rear load"
+ ["WaterAccess"]=>
+ string(4) "true"
+ ["RailAccess"]=>
+ string(1) "N"
+ ["Parking"]=>
+ string(6) "Street"
+ ["VClearance"]=>
+ string(2) "10"
}
object(SimpleXMLElement)#%d (10) {
- [%u|b%"WarehouseId"]=>
- %unicode|string%(1) "1"
- [%u|b%"WarehouseName"]=>
- %unicode|string%(16) "Southlake, Texas"
- [%u|b%"Building"]=>
- %unicode|string%(5) "Owned"
- [%u|b%"Area"]=>
- %unicode|string%(5) "25000"
- [%u|b%"Docks"]=>
- %unicode|string%(1) "1"
- [%u|b%"DockType"]=>
- %unicode|string%(9) "Rear load"
- [%u|b%"WaterAccess"]=>
- %unicode|string%(4) "true"
- [%u|b%"RailAccess"]=>
- %unicode|string%(1) "N"
- [%u|b%"Parking"]=>
- %unicode|string%(6) "Street"
- [%u|b%"VClearance"]=>
- %unicode|string%(2) "10"
+ ["WarehouseId"]=>
+ string(1) "1"
+ ["WarehouseName"]=>
+ string(16) "Southlake, Texas"
+ ["Building"]=>
+ string(5) "Owned"
+ ["Area"]=>
+ string(5) "25000"
+ ["Docks"]=>
+ string(1) "1"
+ ["DockType"]=>
+ string(9) "Rear load"
+ ["WaterAccess"]=>
+ string(4) "true"
+ ["RailAccess"]=>
+ string(1) "N"
+ ["Parking"]=>
+ string(6) "Street"
+ ["VClearance"]=>
+ string(2) "10"
}
Test 3: Update changes using a temporary CLOB
-%unicode|string%(331) "<?xml version="1.0"?>
+string(331) "<?xml version="1.0"?>
<Warehouse>
<WarehouseId>1</WarehouseId>
<WarehouseName>Southlake, Texas</WarehouseName>