Add new OCI8 tests. Refactor skipifs. Sync 5.3/5.4/trunk branches

This commit is contained in:
Christopher Jones 2011-06-10 19:16:35 +00:00
parent 199510ef07
commit a643bda32d
266 changed files with 5938 additions and 2105 deletions

View File

@ -61,7 +61,7 @@ echo "Done\n";
--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) ""

View File

@ -61,7 +61,7 @@ echo "Done\n";
--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"

View File

@ -1,7 +1,10 @@
--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

View File

@ -1,7 +1,10 @@
--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

View File

@ -1,7 +1,10 @@
--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

View File

@ -1,7 +1,10 @@
--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

View File

@ -61,7 +61,7 @@ echo "Done\n";
--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)

View File

@ -1,7 +1,10 @@
--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
@ -60,9 +63,9 @@ echo "Done\n";
?>
--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"

View File

@ -7,7 +7,7 @@ oci_bind_array_by_name() and invalid values 8
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);

View File

@ -61,7 +61,7 @@ echo "Done\n";
--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

View File

@ -7,7 +7,7 @@ oci_bind_array_by_name(), SQLT_CHR, default max_length and empty array
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();

View File

@ -1,7 +1,10 @@
--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

View File

@ -1,7 +1,10 @@
--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

View File

@ -1,7 +1,10 @@
--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

View File

@ -1,7 +1,10 @@
--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

View File

@ -1,7 +1,10 @@
--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

View File

@ -1,7 +1,10 @@
--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

View File

@ -1,7 +1,10 @@
--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

View File

@ -1,7 +1,10 @@
--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

View File

@ -1,7 +1,10 @@
--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

View File

@ -1,7 +1,10 @@
--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

View File

@ -1,7 +1,10 @@
--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

View File

@ -1,7 +1,10 @@
--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

View File

@ -4,18 +4,10 @@ SELECT oci_bind_by_name with SQLT_AFC aka CHAR
<?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--
@ -33,10 +25,7 @@ $stmtarray = array(
"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
@ -206,12 +195,7 @@ $stmtarray = array(
"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";

View File

@ -27,10 +27,7 @@ $stmtarray = array(
"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
@ -200,12 +197,7 @@ $stmtarray = array(
"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";

View File

@ -4,18 +4,10 @@ SELECT oci_bind_by_name with SQLT_AFC aka CHAR and dates
<?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--
@ -32,10 +24,7 @@ $stmtarray = array(
"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
@ -95,12 +84,7 @@ $stmtarray = array(
"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";

View File

@ -24,10 +24,7 @@ $stmtarray = array(
"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
@ -87,12 +84,7 @@ $stmtarray = array(
"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";

View File

@ -4,18 +4,10 @@ PL/SQL oci_bind_by_name with SQLT_AFC aka CHAR to CHAR parameter
<?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--
@ -28,11 +20,8 @@ require(dirname(__FILE__).'/connect.inc');
$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
@ -243,18 +232,11 @@ function do_e($s)
// 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";

View File

@ -21,10 +21,7 @@ $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
@ -235,18 +232,11 @@ function do_e($s)
// 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";

View File

@ -4,18 +4,10 @@ PL/SQL oci_bind_by_name with SQLT_AFC aka CHAR to VARCHAR2 parameter
<?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--
@ -31,10 +23,7 @@ $stmtarray = array(
"create or replace function bind_char_3_fn(p1 varchar2) return varchar2 as begin return p1; end;",
);
foreach ($stmtarray as $stmt) {
$s = oci_parse($c, $stmt);
@oci_execute($s);
}
oci8_test_sql_execute($c, $stmtarray);
// Run Test
@ -245,18 +234,11 @@ function do_e($s)
// 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";

View File

@ -23,10 +23,7 @@ $stmtarray = array(
"create or replace function bind_char_3_fn(p1 varchar2) return varchar2 as begin return p1; end;",
);
foreach ($stmtarray as $stmt) {
$s = oci_parse($c, $stmt);
@oci_execute($s);
}
oci8_test_sql_execute($c, $stmtarray);
// Run Test
@ -237,18 +234,11 @@ function do_e($s)
// 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";

View File

@ -1,7 +1,10 @@
--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
@ -13,16 +16,37 @@ $stmt = oci_parse($c, "drop table phptestlng");
$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");
$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 where id = 2");
oci_execute($stmt);
$row = oci_fetch_row($stmt);
@ -36,6 +60,10 @@ echo "Done\n";
?>
--EXPECT--
Test 1
string(32) "5c7c34abf7ea51936785062dbfcaeddc"
int(394)
Test 2 - test multi chunk fetch
string(32) "ee2e98b977341cfb8e037066e5fcb909"
int(236400)
Done

View File

@ -1,7 +1,10 @@
--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

View File

@ -0,0 +1,369 @@
--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===

View File

@ -0,0 +1,169 @@
--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===

View File

@ -0,0 +1,220 @@
--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===

View File

@ -0,0 +1,78 @@
--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===

View File

@ -1,7 +1,10 @@
--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

View File

@ -17,17 +17,14 @@ function do_query($c)
}
}
$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);
@ -54,12 +51,11 @@ 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";

View File

@ -0,0 +1,208 @@
--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===

View File

@ -0,0 +1,228 @@
--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===

View File

@ -0,0 +1,50 @@
--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===

View File

@ -0,0 +1,227 @@
--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===

View File

@ -0,0 +1,278 @@
--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===

View File

@ -0,0 +1,58 @@
--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===

View File

@ -0,0 +1,39 @@
--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===

View File

@ -0,0 +1,45 @@
--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===

View File

@ -14,27 +14,11 @@ $stmtarray = array(
"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);
@ -51,10 +35,7 @@ $stmtarray = array(
"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";
?>

View File

@ -4,35 +4,25 @@ Bug #27303 (OCIBindByName binds numeric PHP values as characters)
<?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);
@ -52,14 +42,12 @@ for ($i = 1; $i < MYLIMIT; $i++) {
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";
?>

View File

@ -13,18 +13,16 @@ if ($sv !== 1) {
--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);
@ -44,14 +42,12 @@ for ($i = 1; $i < MYLIMIT; $i++) {
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";
?>

View File

@ -4,18 +4,10 @@ Bug #27303 (OCIBindByName binds numeric PHP values as characters)
<?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--
@ -23,16 +15,14 @@ if ($sv !== 1) {
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);
@ -54,14 +44,12 @@ for ($i = 1; $i < MYLIMIT; $i++) {
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";
?>

View File

@ -15,16 +15,14 @@ if ($sv !== 1) {
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);
@ -46,14 +44,12 @@ for ($i = 1; $i < MYLIMIT; $i++) {
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";
?>

View File

@ -4,18 +4,10 @@ Bug #27303 (OCIBindByName binds numeric PHP values as characters)
<?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--

View File

@ -1,7 +1,10 @@
--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
@ -13,18 +16,7 @@ $stmtarray = array(
"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
@ -49,10 +41,7 @@ $stmtarray = array(
"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";
?>

View File

@ -1,7 +1,10 @@
--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

View File

@ -1,7 +1,10 @@
--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

View File

@ -20,9 +20,9 @@ if(oci_execute($stmt, OCI_COMMIT_ON_SUCCESS)){
echo "Done\n";
?>
--EXPECT--
--EXPECTF--
bool(false)
bool(false)
string(5) "'ABC'"
string(%r[53]%r) "%r('ABC'|EXP)%r"
string(4) "CHAR"
Done

View File

@ -1,7 +1,12 @@
--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
@ -14,21 +19,7 @@ $stmtarray = array(
"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
@ -48,18 +39,11 @@ $row = oci_fetch_array($s);
// 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===
@ -72,5 +56,5 @@ COL2
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===

View File

@ -1,7 +1,10 @@
--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
@ -14,10 +17,7 @@ $stmtarray = array(
"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
@ -54,10 +54,7 @@ $stmtarray = array(
"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";

View File

@ -1,7 +1,10 @@
--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

View File

@ -1,7 +1,10 @@
--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

View File

@ -1,7 +1,10 @@
--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

View File

@ -1,7 +1,10 @@
--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

View File

@ -2,8 +2,8 @@
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");
?>
@ -50,12 +50,9 @@ $stmtarray = array(
"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
@ -79,14 +76,9 @@ $c = oci_new_connect($user, $password, $dbase);
$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";

View File

@ -1,7 +1,10 @@
--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

View File

@ -1,7 +1,10 @@
--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

View File

@ -1,7 +1,11 @@
--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
@ -17,10 +21,7 @@ $stmtarray = array(
"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
@ -48,12 +49,7 @@ $stmtarray = array(
"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--

View File

@ -1,7 +1,11 @@
--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
@ -17,10 +21,7 @@ $stmtarray = array(
"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
@ -46,12 +47,7 @@ $stmtarray = array(
"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--

View File

@ -1,7 +1,10 @@
--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--
@ -15,97 +18,94 @@ $c = oci_connect($user, $password, $dbase);
// 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";
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);
$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";
@ -119,14 +119,11 @@ do_bug43449($c);
// 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";

View File

@ -1,7 +1,10 @@
--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
@ -22,10 +25,7 @@ $stmtarray = array(
"INSERT INTO bug43492_tab VALUES ('J')"
);
foreach ($stmtarray as $stmt) {
$s = oci_parse($c, $stmt);
@oci_execute($s);
}
oci8_test_sql_execute($c, $stmtarray);
/*
@ -66,12 +66,7 @@ $stmtarray = array(
"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--

View File

@ -1,7 +1,10 @@
--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
@ -26,10 +29,7 @@ $stmtarray = array(
"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');
@ -57,12 +57,7 @@ $stmtarray = array(
"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--

View File

@ -2,13 +2,11 @@
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--

View File

@ -1,14 +1,12 @@
--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--

View File

@ -1,7 +1,10 @@
--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
@ -15,10 +18,7 @@ $stmtarray = array(
end;"
);
foreach ($stmtarray as $stmt) {
$s = oci_parse($c, $stmt);
@oci_execute($s);
}
oci8_test_sql_execute($c, $stmtarray);
// Run Test
@ -39,12 +39,7 @@ $stmtarray = array(
"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";

View File

@ -2,8 +2,8 @@
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--
@ -17,10 +17,7 @@ $stmtarray = array(
"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
@ -41,12 +38,7 @@ $stmtarray = array(
"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";

View File

@ -1,7 +1,10 @@
--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

View File

@ -11,14 +11,14 @@ require(dirname(__FILE__).'/connect.inc');
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);
@ -28,9 +28,9 @@ $s = oci_parse($c, $stmt);
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);
@ -44,14 +44,14 @@ Test 1
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"
@ -60,7 +60,7 @@ string(1) "X"
string(1) "X"
Test 2
array(2) {
["a"]=>
["A"]=>
array(1) {
[0]=>
string(1) "X"

View File

@ -1,7 +1,10 @@
--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
@ -22,10 +25,7 @@ $stmtarray = array(
end bug46994_proc2;"
);
foreach ($stmtarray as $stmt) {
$s = oci_parse($c, $stmt);
@oci_execute($s);
}
oci8_test_sql_execute($c, $stmtarray);
// Run Test
@ -64,10 +64,7 @@ $stmtarray = array(
"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);

View File

@ -1,12 +1,17 @@
--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);
@ -14,6 +19,8 @@ var_dump($rs);
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);
@ -25,6 +32,7 @@ var_dump($rs1);
===DONE===
<?php exit(0); ?>
--EXPECTF--
Test 1
array(1) {
[0]=>
array(1) {
@ -34,6 +42,7 @@ array(1) {
}
array(0) {
}
Test 2
array(1) {
[0]=>
array(1) {

View File

@ -1,7 +1,10 @@
--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--
@ -19,21 +22,7 @@ $stmtarray = array(
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
@ -54,13 +43,10 @@ echo $php_errormsg. "\n";
// 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===

View File

@ -0,0 +1,59 @@
--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===

View File

@ -1,7 +1,10 @@
--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

View File

@ -0,0 +1,394 @@
--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===

View File

@ -0,0 +1,56 @@
--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===

View File

@ -1,7 +1,10 @@
--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

View File

@ -1,7 +1,10 @@
--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

View File

@ -1,7 +1,10 @@
--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

View File

@ -1,7 +1,10 @@
--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

View File

@ -1,7 +1,10 @@
--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

View File

@ -1,7 +1,10 @@
--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

View File

@ -1,7 +1,10 @@
--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

View File

@ -1,7 +1,10 @@
--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

View File

@ -1,7 +1,10 @@
--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

View File

@ -1,7 +1,10 @@
--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

View File

@ -1,7 +1,10 @@
--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

View File

@ -1,7 +1,10 @@
--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

View File

@ -1,7 +1,10 @@
--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

View File

@ -1,7 +1,10 @@
--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

View File

@ -1,7 +1,10 @@
--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

View File

@ -1,7 +1,10 @@
--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

Some files were not shown because too many files have changed in this diff Show More