--FILE--
<?php
- require dirname(__FILE__).'/connect.inc';
- require dirname(__FILE__).'/create_table.inc';
-
- if ($c) {
- $ora_sql = "INSERT INTO
- ".$schema.$table_name." (id, value)
- VALUES ('1','1')
- RETURNING
- ROWID
- INTO :v_rowid ";
-
- $statement = OCIParse($c,$ora_sql);
- $rowid = OCINewDescriptor($c,OCI_D_ROWID);
- OCIBindByName($statement,":v_rowid", $rowid,-1,OCI_B_ROWID);
- if (OCIExecute($statement)) {
- OCICommit($c);
- }
- OCIFreeStatement($statement);
- $rowid->free();
- }
-
- require dirname(__FILE__).'/drop_table.inc';
-
- echo "Done\n";
+require(dirname(__FILE__).'/connect.inc');
+
+// Initialize
+
+$stmtarray = array(
+ "drop table bug26133_tab",
+ "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);
+}
+
+// Run Test
+
+$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);
+OCIBindByName($statement,":v_rowid", $rowid,-1,OCI_B_ROWID);
+if (OCIExecute($statement)) {
+ OCICommit($c);
+}
+OCIFreeStatement($statement);
+$rowid->free();
+
+// Cleanup
+
+$stmtarray = array(
+ "drop table bug26133_tab"
+);
+
+foreach ($stmtarray as $stmt) {
+ $s = oci_parse($c, $stmt);
+ oci_execute($s);
+}
+
+echo "Done\n";
?>
--EXPECT--
Done
--TEST--
-Bug #32325 (Can't retrieve collection using OCI8)
+Bug #32325 (Cannot retrieve collection using OCI8)
--SKIPIF--
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
--FILE--
<?php
-require dirname(__FILE__).'/connect.inc';
-require dirname(__FILE__).'/create_table.inc';
-
-$create_stmt = oci_parse($c, "create or replace type ut_num_list_t as table of number");
-oci_execute($create_stmt);
-
-$collection = oci_new_collection($c, "UT_NUM_LIST_T");
-
-$sql = "
- begin
- select ut_num_list_t(1,2,3,4) into :list from dual;
+require(dirname(__FILE__).'/connect.inc');
+
+// Initialize
+
+$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;
+ }
+ }
+}
+
+// Run test
+
+$collection = oci_new_collection($c, "BUG32325_T");
+
+$sql = "begin
+ select bug32325_t(1,2,3,4) into :list from dual;
end;";
$stmt = oci_parse($c, $sql);
var_dump($collection->getelem(1));
var_dump($collection->getelem(2));
-$drop_stmt = oci_parse($c, "drop type ut_num_list_t");
-oci_execute($drop_stmt);
+// Cleanup
+
+$stmtarray = array(
+ "drop type bug32325_t"
+);
+
+foreach ($stmtarray as $stmt) {
+ $s = oci_parse($c, $stmt);
+ oci_execute($s);
+}
echo "Done\n";
?>
---EXPECTF--
+--EXPECT--
int(4)
float(2)
float(3)
--FILE--
<?php
-require dirname(__FILE__)."/connect.inc";
-require dirname(__FILE__)."/create_table.inc";
+require(dirname(__FILE__)."/connect.inc");
-$insert_sql = "INSERT INTO ".$schema.$table_name." (id, value) VALUES (1,1)";
+// Initialize
-if (!($s = oci_parse($c, $insert_sql))) {
- die("oci_parse(insert) failed!\n");
-}
+$stmtarray = array(
+ "drop table cursor_bind_err_tab",
+ "create table cursor_bind_err_tab (id number, value number)",
+ "insert into cursor_bind_err_tab (id, value) values (1,1)",
+ "insert into cursor_bind_err_tab (id, value) values (1,1)",
+ "insert into cursor_bind_err_tab (id, value) values (1,1)",
+);
-for ($i = 0; $i<3; $i++) {
- if (!oci_execute($s)) {
- die("oci_execute(insert) failed!\n");
+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;
+ }
}
}
-if (!oci_commit($c)) {
- die("oci_commit() failed!\n");
+foreach ($stmtarray as $stmt) {
+ $s = oci_parse($c, $stmt);
+ oci_execute($s);
}
-$sql = "select CURSOR(select * from ".$schema.$table_name.") into :cursor from dual";
+// Run Test
+
+$sql = "select cursor(select * from cursor_bind_err_tab) into :cursor from dual";
$stmt = oci_parse($c, $sql);
$cursor = oci_new_cursor($c);
oci_execute($cursor);
var_dump(oci_fetch_assoc($cursor));
-require dirname(__FILE__)."/drop_table.inc";
+// Cleanup
+
+$stmtarray = array(
+ "drop table cursor_bind_err_tab"
+);
+
+foreach ($stmtarray as $stmt) {
+ $s = oci_parse($c, $stmt);
+ oci_execute($s);
+}
echo "Done\n";
?>
--EXPECTF--
-Warning: oci_bind_by_name(): ORA-01036: illegal variable name/number in %s on line %d
+Warning: oci_bind_by_name(): ORA-01036: %s in %s on line %d
-Warning: oci_fetch_assoc(): ORA-24338: statement handle not executed in %s on line %d
+Warning: oci_fetch_assoc(): ORA-24338: %s in %s on line %d
bool(false)
Done
--FILE--
<?php
-require dirname(__FILE__)."/connect.inc";
-require dirname(__FILE__)."/create_table.inc";
+require(dirname(__FILE__)."/connect.inc");
-$insert_sql = "INSERT INTO ".$schema.$table_name." (id, value) VALUES (1,1)";
+// Initialize
-if (!($s = ociparse($c, $insert_sql))) {
- die("ociparse(insert) failed!\n");
-}
+$stmtarray = array(
+ "drop table cursors_old_tab",
+ "create table cursors_old_tab (id number, value number)",
+ "insert into cursors_old_tab (id, value) values (1,1)",
+ "insert into cursors_old_tab (id, value) values (1,1)",
+ "insert into cursors_old_tab (id, value) values (1,1)",
+);
-for ($i = 0; $i<3; $i++) {
- if (!ociexecute($s)) {
- die("ociexecute(insert) failed!\n");
+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;
+ }
}
}
-if (!ocicommit($c)) {
- die("ocicommit() failed!\n");
+foreach ($stmtarray as $stmt) {
+ $s = oci_parse($c, $stmt);
+ oci_execute($s);
}
-$sql = "select CURSOR(select * from ".$schema.$table_name.") as curs FROM dual";
+// Run Test
+
+$sql = "select cursor(select * from cursors_old_tab) as curs from dual";
$stmt = ociparse($c, $sql);
ociexecute($stmt);
var_dump(ocicancel($data["CURS"]));
}
-require dirname(__FILE__)."/drop_table.inc";
+// Cleanup
+
+$stmtarray = array(
+ "drop table cursors_old_tab"
+);
+
+foreach ($stmtarray as $stmt) {
+ $s = oci_parse($c, $stmt);
+ oci_execute($s);
+}
echo "Done\n";
?>
--EXPECTF--
array(2) {
- [u"ID"]=>
- unicode(1) "1"
- [u"VALUE"]=>
- unicode(1) "1"
+ [%u|b%"ID"]=>
+ %unicode|string%(1) "1"
+ [%u|b%"VALUE"]=>
+ %unicode|string%(1) "1"
}
bool(true)
-Warning: ocifetchinto(): ORA-01002: fetch out of sequence in %s on line %d
+Warning: ocifetchinto():%sORA-01002: %s in %scursors_old.php on line %d
array(2) {
- [u"ID"]=>
- unicode(1) "1"
- [u"VALUE"]=>
- unicode(1) "1"
+ [%u|b%"ID"]=>
+ %unicode|string%(1) "1"
+ [%u|b%"VALUE"]=>
+ %unicode|string%(1) "1"
}
bool(true)
Done
--FILE--
<?php
-require dirname(__FILE__)."/connect.inc";
-require dirname(__FILE__).'/create_table.inc';
+require(dirname(__FILE__)."/connect.inc");
-$insert_sql = "INSERT INTO ".$schema.$table_name." (id, value) VALUES (1,1)";
+// Initialize
-if (!($s = oci_parse($c, $insert_sql))) {
- die("oci_parse(insert) failed!\n");
-}
+$stmtarray = array(
+ "drop table default_prefetch_tab",
+ "create table default_prefetch_tab (id number, value number)",
+ "insert into default_prefetch_tab (id, value) values (1,1)",
+ "insert into default_prefetch_tab (id, value) values (1,1)",
+ "insert into default_prefetch_tab (id, value) values (1,1)",
+);
-for ($i = 0; $i<3; $i++) {
- if (!oci_execute($s)) {
- die("oci_execute(insert) failed!\n");
+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;
+ }
}
}
-if (!oci_commit($c)) {
- die("oci_commit() failed!\n");
+foreach ($stmtarray as $stmt) {
+ $s = oci_parse($c, $stmt);
+ oci_execute($s);
}
-$select_sql = "SELECT * FROM ".$schema.$table_name."";
+// Run Test
+
+$select_sql = "select * from default_prefetch_tab";
if (!($s = oci_parse($c, $select_sql))) {
die("oci_parse(select) failed!\n");
var_dump(oci_num_rows($s));
-require dirname(__FILE__).'/drop_table.inc';
+// Cleanup
+
+$stmtarray = array(
+ "drop table default_prefetch_tab"
+);
+
+foreach ($stmtarray as $stmt) {
+ $s = oci_parse($c, $stmt);
+ oci_execute($s);
+}
+
echo "Done\n";
?>
--FILE--
<?php
-require dirname(__FILE__)."/connect.inc";
-require dirname(__FILE__).'/create_table.inc';
+require(dirname(__FILE__)."/connect.inc");
-$insert_sql = "INSERT INTO ".$schema.$table_name." (id, value) VALUES (1,1)";
+// Initialize
-if (!($s = oci_parse($c, $insert_sql))) {
- die("oci_parse(insert) failed!\n");
-}
+$stmtarray = array(
+ "drop table default_prefetch1_tab",
+ "create table default_prefetch1_tab (id number, value number)",
+ "insert into default_prefetch1_tab (id, value) values (1,1)",
+ "insert into default_prefetch1_tab (id, value) values (1,1)",
+ "insert into default_prefetch1_tab (id, value) values (1,1)",
+);
-for ($i = 0; $i<3; $i++) {
- if (!oci_execute($s)) {
- die("oci_execute(insert) failed!\n");
+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;
+ }
}
}
-if (!oci_commit($c)) {
- die("oci_commit() failed!\n");
+foreach ($stmtarray as $stmt) {
+ $s = oci_parse($c, $stmt);
+ oci_execute($s);
}
-$select_sql = "SELECT * FROM ".$schema.$table_name."";
+// Run Test
+
+$select_sql = "select * from default_prefetch1_tab";
if (!($s = oci_parse($c, $select_sql))) {
die("oci_parse(select) failed!\n");
}
var_dump(oci_fetch($s));
-
var_dump(oci_num_rows($s));
-require dirname(__FILE__).'/drop_table.inc';
+
+// Cleanup
+
+$stmtarray = array(
+ "drop table default_prefetch1_tab"
+);
+
+foreach ($stmtarray as $stmt) {
+ $s = oci_parse($c, $stmt);
+ oci_execute($s);
+}
echo "Done\n";
?>
--FILE--
<?php
-require dirname(__FILE__)."/connect.inc";
-require dirname(__FILE__).'/create_table.inc';
+require(dirname(__FILE__)."/connect.inc");
-$insert_sql = "INSERT INTO ".$schema.$table_name." (id, value) VALUES (1,1)";
+// Initialize
-if (!($s = oci_parse($c, $insert_sql))) {
- die("oci_parse(insert) failed!\n");
-}
+$stmtarray = array(
+ "drop table default_prefetch2_tab",
+ "create table default_prefetch2_tab (id number, value number)",
+ "insert into default_prefetch2_tab (id, value) values (1,1)",
+ "insert into default_prefetch2_tab (id, value) values (1,1)",
+ "insert into default_prefetch2_tab (id, value) values (1,1)",
+);
-for ($i = 0; $i<3; $i++) {
- if (!oci_execute($s)) {
- die("oci_execute(insert) failed!\n");
+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;
+ }
}
}
-if (!oci_commit($c)) {
- die("oci_commit() failed!\n");
+foreach ($stmtarray as $stmt) {
+ $s = oci_parse($c, $stmt);
+ oci_execute($s);
}
-$select_sql = "SELECT * FROM ".$schema.$table_name."";
+// Run Test
+
+$select_sql = "select * from default_prefetch2_tab";
if (!($s = oci_parse($c, $select_sql))) {
die("oci_parse(select) failed!\n");
}
var_dump(oci_fetch($s));
-
var_dump(oci_num_rows($s));
-require dirname(__FILE__).'/drop_table.inc';
+// Cleanup
+
+$stmtarray = array(
+ "drop table default_prefetch2_tab"
+);
+
+foreach ($stmtarray as $stmt) {
+ $s = oci_parse($c, $stmt);
+ oci_execute($s);
+}
echo "Done\n";
?>
--FILE--
<?php
-require dirname(__FILE__)."/connect.inc";
-require dirname(__FILE__)."/create_table.inc";
-
-$insert_sql = "INSERT INTO ".$schema.$table_name." (string) VALUES ('some')";
-
-if (!($s = oci_parse($c, $insert_sql))) {
- die("oci_parse(insert) failed!\n");
+require(dirname(__FILE__)."/connect.inc");
+
+// Initialize
+
+$stmtarray = array(
+ "drop table define_tab",
+ "create table define_tab (string varchar(10))",
+ "insert into define_tab (string) values ('some')",
+);
+
+foreach ($stmtarray as $stmt) {
+ $s = oci_parse($c, $stmt);
+ $r = @oci_execute($s);
+ if (!$r) {
+ $m = oci_error($s);
+ if (!in_array($m['code'], array( // ignore expected errors
+ 942 // table or view does not exist
+ ))) {
+ echo $stmt . PHP_EOL . $m['message'] . PHP_EOL;
+ }
+ }
}
-if (!oci_execute($s)) {
- die("oci_execute(insert) failed!\n");
-}
+// Run test
-$stmt = oci_parse($c, "SELECT string FROM ".$table_name."");
+$stmt = oci_parse($c, "select string from define_tab");
/* the define MUST be done BEFORE ociexecute! */
-$strong = '';
+$string = '';
oci_define_by_name($stmt, "STRING", $string, 20);
oci_execute($stmt);
var_dump($string);
}
-require dirname(__FILE__)."/drop_table.inc";
+// Cleanup
+
+$stmtarray = array(
+ "drop table define_tab"
+);
+
+foreach ($stmtarray as $stmt) {
+ $s = oci_parse($c, $stmt);
+ oci_execute($s);
+}
echo "Done\n";
?>
---EXPECT--
-unicode(4) "some"
+--EXPECTF--
+%unicode|string%(%d) "some"
Done
--FILE--
<?php
-require dirname(__FILE__)."/connect.inc";
-require dirname(__FILE__)."/create_table.inc";
+require(dirname(__FILE__)."/connect.inc");
-$insert_sql = "INSERT INTO ".$schema.$table_name." (string) VALUES ('some')";
+// Initialize
-if (!($s = oci_parse($c, $insert_sql))) {
- die("oci_parse(insert) failed!\n");
-}
+$stmtarray = array(
+ "drop table define1_tab",
+ "create table define1_tab (string varchar(10))",
+ "insert into define1_tab (string) values ('some')",
+);
-if (!oci_execute($s)) {
- die("oci_execute(insert) failed!\n");
+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;
+ }
+ }
}
-$stmt = oci_parse($c, "SELECT string FROM ".$table_name."");
+// Run test
+
+$stmt = oci_parse($c, "select string from define1_tab");
/* the define MUST be done BEFORE ociexecute! */
-$strong = '';
+$string = '';
var_dump(oci_define_by_name($stmt, "STRING", $string, 20));
var_dump(oci_define_by_name($stmt, "STRING", $string, 20));
var_dump(oci_define_by_name($stmt, "", $string, 20));
var_dump($string);
}
-require dirname(__FILE__)."/drop_table.inc";
+// Cleanup
+
+$stmtarray = array(
+ "drop table define1_tab"
+);
+
+foreach ($stmtarray as $stmt) {
+ $s = oci_parse($c, $stmt);
+ oci_execute($s);
+}
echo "Done\n";
Warning: oci_define_by_name() expects at least 3 parameters, 2 given in %s on line %d
NULL
-unicode(4) "some"
+%unicode|string%(4) "some"
Done
--FILE--
<?php
-require dirname(__FILE__)."/connect.inc";
-require dirname(__FILE__)."/create_table.inc";
+require(dirname(__FILE__)."/connect.inc");
-$insert_sql = "INSERT INTO ".$schema.$table_name." (value, string) VALUES (1234, 'some')";
+// Initialize
-if (!($s = oci_parse($c, $insert_sql))) {
- die("oci_parse(insert) failed!\n");
-}
+$stmtarray = array(
+ "drop table define4_tab",
+ "create table define4_tab (value number, string varchar(10))",
+ "insert into define4_tab (value, string) values (1234, 'some')",
+);
-if (!oci_execute($s)) {
- die("oci_execute(insert) failed!\n");
+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;
+ }
+ }
}
-$stmt = oci_parse($c, "SELECT value, string FROM ".$table_name."");
+// Run test
+
+$stmt = oci_parse($c, "select value, string from define4_tab");
echo "Test 1\n";
// Only one of the two columns is defined
var_dump($string);
var_dump(oci_result($stmt, 'STRING'));
-require dirname(__FILE__)."/drop_table.inc";
+// Cleanup
+
+$stmtarray = array(
+ "drop table define4_tab"
+);
+
+foreach ($stmtarray as $stmt) {
+ $s = oci_parse($c, $stmt);
+ oci_execute($s);
+}
echo "Done\n";
Test 1
bool(true)
Test 2
-unicode(4) "1234"
-unicode(4) "some"
-unicode(4) "some"
-unicode(4) "some"
-unicode(4) "1234"
-unicode(4) "some"
+%unicode|string%(4) "1234"
+%unicode|string%(4) "some"
+%unicode|string%(4) "some"
+%unicode|string%(4) "some"
+%unicode|string%(4) "1234"
+%unicode|string%(4) "some"
Test 3
bool(true)
-unicode(4) "some"
+%unicode|string%(4) "some"
Warning: oci_result(): %d is not a valid oci8 statement resource in %s on line %d
bool(false)
Done
+
--FILE--
<?php
-require dirname(__FILE__)."/connect.inc";
-require dirname(__FILE__)."/create_table.inc";
+require(dirname(__FILE__)."/connect.inc");
-$insert_sql = "INSERT INTO ".$schema.$table_name." (id, string) VALUES (1, 'some')";
-$s = oci_parse($c, $insert_sql);
-var_dump(oci_execute($s));
+// Initialize
-$insert_sql = "INSERT INTO ".$schema.$table_name." (id, string) VALUES (2, 'thing')";
-$s = oci_parse($c, $insert_sql);
-var_dump(oci_execute($s));
+$stmtarray = array(
+ "drop table define5_tab",
+ "create table define5_tab (id number, string varchar(10))",
+ "insert into define5_tab (id, string) values (1, 'some')",
+ "insert into define5_tab (id, string) values (2, 'thing')",
+);
+
+foreach ($stmtarray as $stmt) {
+ $s = oci_parse($c, $stmt);
+ $r = @oci_execute($s);
+ if (!$r) {
+ $m = oci_error($s);
+ if (!in_array($m['code'], array( // ignore expected errors
+ 942 // table or view does not exist
+ ))) {
+ echo $stmt . PHP_EOL . $m['message'] . PHP_EOL;
+ }
+ }
+}
+
+// Run test
echo "Test 1 - must do define before execute\n";
-$stmt = oci_parse($c, "SELECT string FROM ".$table_name." where id = 1");
+$stmt = oci_parse($c, "select string from define5_tab where id = 1");
oci_execute($stmt);
var_dump(oci_define_by_name($stmt, "STRING", $string));
while (oci_fetch($stmt)) {
}
echo "Test 2 - normal define order\n";
-$stmt = oci_parse($c, "SELECT string FROM ".$table_name." where id = 1");
+$stmt = oci_parse($c, "select string from define5_tab where id = 1");
var_dump(oci_define_by_name($stmt, "STRING", $string));
oci_execute($stmt);
}
echo "Test 3 - no new define done\n";
-$stmt = oci_parse($c, "SELECT string FROM ".$table_name." where id = 2");
+$stmt = oci_parse($c, "select string from define5_tab where id = 2");
oci_execute($stmt);
while (oci_fetch($stmt)) {
var_dump($string); // not updated with new value
var_dump(oci_result($stmt, 'STRING'));
}
-require dirname(__FILE__)."/drop_table.inc";
+// Cleanup
+
+$stmtarray = array(
+ "drop table define5_tab"
+);
+
+foreach ($stmtarray as $stmt) {
+ $s = oci_parse($c, $stmt);
+ oci_execute($s);
+}
echo "Done\n";
?>
---EXPECT--
-bool(true)
-bool(true)
+--EXPECTF--
Test 1 - must do define before execute
bool(true)
NULL
-unicode(4) "some"
+%unicode|string%(4) "some"
Test 2 - normal define order
bool(true)
-unicode(4) "some"
+%unicode|string%(4) "some"
Test 3 - no new define done
-unicode(4) "some"
-unicode(5) "thing"
+%unicode|string%(4) "some"
+%unicode|string%(5) "thing"
Done
+
--FILE--
<?php
-require dirname(__FILE__)."/connect.inc";
-require dirname(__FILE__)."/create_table.inc";
-
-$insert_sql = "INSERT INTO ".$schema.$table_name." (string) VALUES ('some')";
-
-if (!($s = ociparse($c, $insert_sql))) {
- die("oci_parse(insert) failed!\n");
+require(dirname(__FILE__)."/connect.inc");
+
+// Initialize
+
+$stmtarray = array(
+ "drop table define_old_tab",
+ "create table define_old_tab (string varchar(10))",
+ "insert into define_old_tab (string) values ('some')",
+);
+
+foreach ($stmtarray as $stmt) {
+ $s = oci_parse($c, $stmt);
+ $r = @oci_execute($s);
+ if (!$r) {
+ $m = oci_error($s);
+ if (!in_array($m['code'], array( // ignore expected errors
+ 942 // table or view does not exist
+ ))) {
+ echo $stmt . PHP_EOL . $m['message'] . PHP_EOL;
+ }
+ }
}
-if (!ociexecute($s)) {
- die("oci_execute(insert) failed!\n");
-}
+// Run test
-$stmt = ociparse($c, "SELECT string FROM ".$table_name."");
+$stmt = ociparse($c, "select string from define_old_tab");
/* the define MUST be done BEFORE ociexecute! */
-$strong = '';
+$string = '';
ocidefinebyname($stmt, "STRING", $string, 20);
ociexecute($stmt);
var_dump($string);
}
-require dirname(__FILE__)."/drop_table.inc";
+// Cleanup
+
+$stmtarray = array(
+ "drop table define_old_tab"
+);
+
+foreach ($stmtarray as $stmt) {
+ $s = oci_parse($c, $stmt);
+ oci_execute($s);
+}
+
echo "Done\n";
?>
---EXPECT--
-unicode(4) "some"
+--EXPECTF--
+%unicode|string%(4) "some"
Done
--FILE--
<?php
-require dirname(__FILE__)."/connect.inc";
-require dirname(__FILE__).'/create_table.inc';
+require(dirname(__FILE__)."/connect.inc");
-$insert_sql = "INSERT INTO ".$schema.$table_name." (id, value) VALUES (1,1)";
+// Initialize
-if (!($s = oci_parse($c, $insert_sql))) {
- die("oci_parse(insert) failed!\n");
-}
+$stmtarray = array(
+ "drop table fetch_tab",
+ "create table fetch_tab (id number, value number)",
+ "insert into fetch_tab (id, value) values (1,1)",
+ "insert into fetch_tab (id, value) values (1,1)",
+ "insert into fetch_tab (id, value) values (1,1)",
+);
-for ($i = 0; $i<3; $i++) {
- if (!oci_execute($s)) {
- die("oci_execute(insert) failed!\n");
+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;
+ }
}
}
-if (!oci_commit($c)) {
- die("oci_commit() failed!\n");
+foreach ($stmtarray as $stmt) {
+ $s = oci_parse($c, $stmt);
+ oci_execute($s);
}
-$select_sql = "SELECT * FROM ".$schema.$table_name."";
+// Run Test
-if (!($s = oci_parse($c, $select_sql))) {
+if (!($s = oci_parse($c, "select * from fetch_tab"))) {
die("oci_parse(select) failed!\n");
}
}
while(ocifetch($s)) {
- $i = 1;
- while ($row = ociresult($s, $i)) {
- $i++;
+ $row = ociresult($s, 1);
+ $row1 = ociresult($s, 2);
var_dump($row);
- }
+ var_dump($row1);
+}
+
+// Cleanup
+
+$stmtarray = array(
+ "drop table fetch_tab"
+);
+
+foreach ($stmtarray as $stmt) {
+ $s = oci_parse($c, $stmt);
+ oci_execute($s);
}
-require dirname(__FILE__).'/drop_table.inc';
echo "Done\n";
?>
---EXPECT--
-unicode(1) "1"
-unicode(1) "1"
-unicode(1) "1"
-unicode(1) "1"
-unicode(1) "1"
-unicode(1) "1"
+--EXPECTF--
+%unicode|string%(1) "1"
+%unicode|string%(1) "1"
+%unicode|string%(1) "1"
+%unicode|string%(1) "1"
+%unicode|string%(1) "1"
+%unicode|string%(1) "1"
Done
--FILE--
<?php
-require dirname(__FILE__)."/connect.inc";
-require dirname(__FILE__).'/create_table.inc';
+require(dirname(__FILE__)."/connect.inc");
-$insert_sql = "INSERT INTO ".$schema."".$table_name." (id, value) VALUES (1,1)";
+// Initialize
-if (!($s = oci_parse($c, $insert_sql))) {
- die("oci_parse(insert) failed!\n");
-}
+$stmtarray = array(
+ "drop table fetch_all_tab",
+ "create table fetch_all_tab (id number, value number)",
+ "insert into fetch_all_tab (id, value) values (1,1)",
+ "insert into fetch_all_tab (id, value) values (1,1)",
+ "insert into fetch_all_tab (id, value) values (1,1)"
+);
-for ($i = 0; $i<3; $i++) {
- if (!oci_execute($s)) {
- die("oci_execute(insert) failed!\n");
+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;
+ }
}
}
-if (!oci_commit($c)) {
- die("oci_commit() failed!\n");
-}
-
-$select_sql = "SELECT * FROM ".$schema."".$table_name."";
-
-if (!($s = oci_parse($c, $select_sql))) {
+if (!($s = oci_parse($c, "select * from fetch_all_tab"))) {
die("oci_parse(select) failed!\n");
}
var_dump(ocifetchstatement($s, $all));
var_dump($all);
-require dirname(__FILE__).'/drop_table.inc';
+// Cleanup
+
+$stmtarray = array(
+ "drop table fetch_all_tab"
+);
+
+foreach ($stmtarray as $stmt) {
+ $s = oci_parse($c, $stmt);
+ oci_execute($s);
+}
echo "Done\n";
?>
---EXPECT--
+--EXPECTF--
int(3)
-array(5) {
- [u"ID"]=>
+array(2) {
+ [%u|b%"ID"]=>
array(3) {
[0]=>
- unicode(1) "1"
+ %unicode|string%(1) "1"
[1]=>
- unicode(1) "1"
+ %unicode|string%(1) "1"
[2]=>
- unicode(1) "1"
+ %unicode|string%(1) "1"
}
- [u"VALUE"]=>
+ [%u|b%"VALUE"]=>
array(3) {
[0]=>
- unicode(1) "1"
+ %unicode|string%(1) "1"
[1]=>
- unicode(1) "1"
+ %unicode|string%(1) "1"
[2]=>
- unicode(1) "1"
- }
- [u"BLOB"]=>
- array(3) {
- [0]=>
- NULL
- [1]=>
- NULL
- [2]=>
- NULL
- }
- [u"CLOB"]=>
- array(3) {
- [0]=>
- NULL
- [1]=>
- NULL
- [2]=>
- NULL
- }
- [u"STRING"]=>
- array(3) {
- [0]=>
- NULL
- [1]=>
- NULL
- [2]=>
- NULL
+ %unicode|string%(1) "1"
}
}
int(3)
-array(5) {
- [u"ID"]=>
- array(3) {
- [0]=>
- unicode(1) "1"
- [1]=>
- unicode(1) "1"
- [2]=>
- unicode(1) "1"
- }
- [u"VALUE"]=>
- array(3) {
- [0]=>
- unicode(1) "1"
- [1]=>
- unicode(1) "1"
- [2]=>
- unicode(1) "1"
- }
- [u"BLOB"]=>
- array(3) {
- [0]=>
- NULL
- [1]=>
- NULL
- [2]=>
- NULL
- }
- [u"CLOB"]=>
+array(2) {
+ [%u|b%"ID"]=>
array(3) {
[0]=>
- NULL
+ %unicode|string%(1) "1"
[1]=>
- NULL
+ %unicode|string%(1) "1"
[2]=>
- NULL
+ %unicode|string%(1) "1"
}
- [u"STRING"]=>
+ [%u|b%"VALUE"]=>
array(3) {
[0]=>
- NULL
+ %unicode|string%(1) "1"
[1]=>
- NULL
+ %unicode|string%(1) "1"
[2]=>
- NULL
+ %unicode|string%(1) "1"
}
}
Done
--FILE--
<?php
-require dirname(__FILE__)."/connect.inc";
-require dirname(__FILE__).'/create_table.inc';
+require(dirname(__FILE__)."/connect.inc");
-$insert_sql = "INSERT INTO ".$schema."".$table_name." (id, value) VALUES (:idbv,:vbv)";
+// Initialize
+$stmtarray = array(
+ "drop table fetch_all3_tab",
+ "create table fetch_all3_tab (id number, value number)",
+);
+
+foreach ($stmtarray as $stmt) {
+ $s = oci_parse($c, $stmt);
+ $r = @oci_execute($s);
+ if (!$r) {
+ $m = oci_error($s);
+ if (!in_array($m['code'], array( // ignore expected errors
+ 942 // table or view does not exist
+ ))) {
+ echo $stmt . PHP_EOL . $m['message'] . PHP_EOL;
+ }
+ }
+}
+
+foreach ($stmtarray as $stmt) {
+ $s = oci_parse($c, $stmt);
+ oci_execute($s);
+}
+
+$insert_sql = "insert into fetch_all3_tab (id, value) values (:idbv,:vbv)";
$s = oci_parse($c, $insert_sql);
oci_bind_by_name($s, ":idbv", $idbv, SQLT_INT);
oci_bind_by_name($s, ":vbv", $vbv, SQLT_INT);
oci_commit($c);
-$select_sql = "SELECT ID, VALUE FROM ".$schema."".$table_name." order by id";
+// Run Test
+
+$select_sql = "select id, value from fetch_all3_tab order by id";
$s = oci_parse($c, $select_sql);
oci_execute($s);
var_dump(oci_fetch_all($s, $all, 0, -1, OCI_NUM|OCI_ASSOC));
var_dump($all);
-require dirname(__FILE__).'/drop_table.inc';
+
+// Cleanup
+
+$stmtarray = array(
+ "drop table fetch_all3_tab"
+);
+
+foreach ($stmtarray as $stmt) {
+ $s = oci_parse($c, $stmt);
+ oci_execute($s);
+}
echo "Done\n";
?>
---EXPECT--
+--EXPECTF--
None
int(4)
array(2) {
- [u"ID"]=>
+ [%u|b%"ID"]=>
array(4) {
[0]=>
- unicode(1) "1"
+ %unicode|string%(1) "1"
[1]=>
- unicode(1) "2"
+ %unicode|string%(1) "2"
[2]=>
- unicode(1) "3"
+ %unicode|string%(1) "3"
[3]=>
- unicode(1) "4"
+ %unicode|string%(1) "4"
}
- [u"VALUE"]=>
+ [%u|b%"VALUE"]=>
array(4) {
[0]=>
- unicode(2) "-1"
+ %unicode|string%(2) "-1"
[1]=>
- unicode(2) "-2"
+ %unicode|string%(2) "-2"
[2]=>
- unicode(2) "-3"
+ %unicode|string%(2) "-3"
[3]=>
- unicode(2) "-4"
+ %unicode|string%(2) "-4"
}
}
OCI_ASSOC
int(4)
array(2) {
- [u"ID"]=>
+ [%u|b%"ID"]=>
array(4) {
[0]=>
- unicode(1) "1"
+ %unicode|string%(1) "1"
[1]=>
- unicode(1) "2"
+ %unicode|string%(1) "2"
[2]=>
- unicode(1) "3"
+ %unicode|string%(1) "3"
[3]=>
- unicode(1) "4"
+ %unicode|string%(1) "4"
}
- [u"VALUE"]=>
+ [%u|b%"VALUE"]=>
array(4) {
[0]=>
- unicode(2) "-1"
+ %unicode|string%(2) "-1"
[1]=>
- unicode(2) "-2"
+ %unicode|string%(2) "-2"
[2]=>
- unicode(2) "-3"
+ %unicode|string%(2) "-3"
[3]=>
- unicode(2) "-4"
+ %unicode|string%(2) "-4"
}
}
OCI_FETCHSTATEMENT_BY_COLUMN
int(4)
array(2) {
- [u"ID"]=>
+ [%u|b%"ID"]=>
array(4) {
[0]=>
- unicode(1) "1"
+ %unicode|string%(1) "1"
[1]=>
- unicode(1) "2"
+ %unicode|string%(1) "2"
[2]=>
- unicode(1) "3"
+ %unicode|string%(1) "3"
[3]=>
- unicode(1) "4"
+ %unicode|string%(1) "4"
}
- [u"VALUE"]=>
+ [%u|b%"VALUE"]=>
array(4) {
[0]=>
- unicode(2) "-1"
+ %unicode|string%(2) "-1"
[1]=>
- unicode(2) "-2"
+ %unicode|string%(2) "-2"
[2]=>
- unicode(2) "-3"
+ %unicode|string%(2) "-3"
[3]=>
- unicode(2) "-4"
+ %unicode|string%(2) "-4"
}
}
OCI_FETCHSTATEMENT_BY_COLUMN|OCI_ASSOC
int(4)
array(2) {
- [u"ID"]=>
+ [%u|b%"ID"]=>
array(4) {
[0]=>
- unicode(1) "1"
+ %unicode|string%(1) "1"
[1]=>
- unicode(1) "2"
+ %unicode|string%(1) "2"
[2]=>
- unicode(1) "3"
+ %unicode|string%(1) "3"
[3]=>
- unicode(1) "4"
+ %unicode|string%(1) "4"
}
- [u"VALUE"]=>
+ [%u|b%"VALUE"]=>
array(4) {
[0]=>
- unicode(2) "-1"
+ %unicode|string%(2) "-1"
[1]=>
- unicode(2) "-2"
+ %unicode|string%(2) "-2"
[2]=>
- unicode(2) "-3"
+ %unicode|string%(2) "-3"
[3]=>
- unicode(2) "-4"
+ %unicode|string%(2) "-4"
}
}
OCI_FETCHSTATEMENT_BY_COLUMN|OCI_NUM
[0]=>
array(4) {
[0]=>
- unicode(1) "1"
+ %unicode|string%(1) "1"
[1]=>
- unicode(1) "2"
+ %unicode|string%(1) "2"
[2]=>
- unicode(1) "3"
+ %unicode|string%(1) "3"
[3]=>
- unicode(1) "4"
+ %unicode|string%(1) "4"
}
[1]=>
array(4) {
[0]=>
- unicode(2) "-1"
+ %unicode|string%(2) "-1"
[1]=>
- unicode(2) "-2"
+ %unicode|string%(2) "-2"
[2]=>
- unicode(2) "-3"
+ %unicode|string%(2) "-3"
[3]=>
- unicode(2) "-4"
+ %unicode|string%(2) "-4"
}
}
OCI_FETCHSTATEMENT_BY_COLUMN|OCI_NUM|OCI_ASSOC
[0]=>
array(4) {
[0]=>
- unicode(1) "1"
+ %unicode|string%(1) "1"
[1]=>
- unicode(1) "2"
+ %unicode|string%(1) "2"
[2]=>
- unicode(1) "3"
+ %unicode|string%(1) "3"
[3]=>
- unicode(1) "4"
+ %unicode|string%(1) "4"
}
[1]=>
array(4) {
[0]=>
- unicode(2) "-1"
+ %unicode|string%(2) "-1"
[1]=>
- unicode(2) "-2"
+ %unicode|string%(2) "-2"
[2]=>
- unicode(2) "-3"
+ %unicode|string%(2) "-3"
[3]=>
- unicode(2) "-4"
+ %unicode|string%(2) "-4"
}
}
OCI_FETCHSTATEMENT_BY_ROW
array(4) {
[0]=>
array(2) {
- [u"ID"]=>
- unicode(1) "1"
- [u"VALUE"]=>
- unicode(2) "-1"
+ [%u|b%"ID"]=>
+ %unicode|string%(1) "1"
+ [%u|b%"VALUE"]=>
+ %unicode|string%(2) "-1"
}
[1]=>
array(2) {
- [u"ID"]=>
- unicode(1) "2"
- [u"VALUE"]=>
- unicode(2) "-2"
+ [%u|b%"ID"]=>
+ %unicode|string%(1) "2"
+ [%u|b%"VALUE"]=>
+ %unicode|string%(2) "-2"
}
[2]=>
array(2) {
- [u"ID"]=>
- unicode(1) "3"
- [u"VALUE"]=>
- unicode(2) "-3"
+ [%u|b%"ID"]=>
+ %unicode|string%(1) "3"
+ [%u|b%"VALUE"]=>
+ %unicode|string%(2) "-3"
}
[3]=>
array(2) {
- [u"ID"]=>
- unicode(1) "4"
- [u"VALUE"]=>
- unicode(2) "-4"
+ [%u|b%"ID"]=>
+ %unicode|string%(1) "4"
+ [%u|b%"VALUE"]=>
+ %unicode|string%(2) "-4"
}
}
OCI_FETCHSTATEMENT_BY_ROW|OCI_ASSOC
array(4) {
[0]=>
array(2) {
- [u"ID"]=>
- unicode(1) "1"
- [u"VALUE"]=>
- unicode(2) "-1"
+ [%u|b%"ID"]=>
+ %unicode|string%(1) "1"
+ [%u|b%"VALUE"]=>
+ %unicode|string%(2) "-1"
}
[1]=>
array(2) {
- [u"ID"]=>
- unicode(1) "2"
- [u"VALUE"]=>
- unicode(2) "-2"
+ [%u|b%"ID"]=>
+ %unicode|string%(1) "2"
+ [%u|b%"VALUE"]=>
+ %unicode|string%(2) "-2"
}
[2]=>
array(2) {
- [u"ID"]=>
- unicode(1) "3"
- [u"VALUE"]=>
- unicode(2) "-3"
+ [%u|b%"ID"]=>
+ %unicode|string%(1) "3"
+ [%u|b%"VALUE"]=>
+ %unicode|string%(2) "-3"
}
[3]=>
array(2) {
- [u"ID"]=>
- unicode(1) "4"
- [u"VALUE"]=>
- unicode(2) "-4"
+ [%u|b%"ID"]=>
+ %unicode|string%(1) "4"
+ [%u|b%"VALUE"]=>
+ %unicode|string%(2) "-4"
}
}
OCI_FETCHSTATEMENT_BY_ROW|OCI_FETCHSTATEMENT_BY_COLUMN
array(4) {
[0]=>
array(2) {
- [u"ID"]=>
- unicode(1) "1"
- [u"VALUE"]=>
- unicode(2) "-1"
+ [%u|b%"ID"]=>
+ %unicode|string%(1) "1"
+ [%u|b%"VALUE"]=>
+ %unicode|string%(2) "-1"
}
[1]=>
array(2) {
- [u"ID"]=>
- unicode(1) "2"
- [u"VALUE"]=>
- unicode(2) "-2"
+ [%u|b%"ID"]=>
+ %unicode|string%(1) "2"
+ [%u|b%"VALUE"]=>
+ %unicode|string%(2) "-2"
}
[2]=>
array(2) {
- [u"ID"]=>
- unicode(1) "3"
- [u"VALUE"]=>
- unicode(2) "-3"
+ [%u|b%"ID"]=>
+ %unicode|string%(1) "3"
+ [%u|b%"VALUE"]=>
+ %unicode|string%(2) "-3"
}
[3]=>
array(2) {
- [u"ID"]=>
- unicode(1) "4"
- [u"VALUE"]=>
- unicode(2) "-4"
+ [%u|b%"ID"]=>
+ %unicode|string%(1) "4"
+ [%u|b%"VALUE"]=>
+ %unicode|string%(2) "-4"
}
}
OCI_FETCHSTATEMENT_BY_ROW|OCI_FETCHSTATEMENT_BY_COLUMN|OCI_ASSOC
array(4) {
[0]=>
array(2) {
- [u"ID"]=>
- unicode(1) "1"
- [u"VALUE"]=>
- unicode(2) "-1"
+ [%u|b%"ID"]=>
+ %unicode|string%(1) "1"
+ [%u|b%"VALUE"]=>
+ %unicode|string%(2) "-1"
}
[1]=>
array(2) {
- [u"ID"]=>
- unicode(1) "2"
- [u"VALUE"]=>
- unicode(2) "-2"
+ [%u|b%"ID"]=>
+ %unicode|string%(1) "2"
+ [%u|b%"VALUE"]=>
+ %unicode|string%(2) "-2"
}
[2]=>
array(2) {
- [u"ID"]=>
- unicode(1) "3"
- [u"VALUE"]=>
- unicode(2) "-3"
+ [%u|b%"ID"]=>
+ %unicode|string%(1) "3"
+ [%u|b%"VALUE"]=>
+ %unicode|string%(2) "-3"
}
[3]=>
array(2) {
- [u"ID"]=>
- unicode(1) "4"
- [u"VALUE"]=>
- unicode(2) "-4"
+ [%u|b%"ID"]=>
+ %unicode|string%(1) "4"
+ [%u|b%"VALUE"]=>
+ %unicode|string%(2) "-4"
}
}
OCI_FETCHSTATEMENT_BY_ROW|OCI_FETCHSTATEMENT_BY_COLUMN|OCI_NUM
[0]=>
array(2) {
[0]=>
- unicode(1) "1"
+ %unicode|string%(1) "1"
[1]=>
- unicode(2) "-1"
+ %unicode|string%(2) "-1"
}
[1]=>
array(2) {
[0]=>
- unicode(1) "2"
+ %unicode|string%(1) "2"
[1]=>
- unicode(2) "-2"
+ %unicode|string%(2) "-2"
}
[2]=>
array(2) {
[0]=>
- unicode(1) "3"
+ %unicode|string%(1) "3"
[1]=>
- unicode(2) "-3"
+ %unicode|string%(2) "-3"
}
[3]=>
array(2) {
[0]=>
- unicode(1) "4"
+ %unicode|string%(1) "4"
[1]=>
- unicode(2) "-4"
+ %unicode|string%(2) "-4"
}
}
OCI_FETCHSTATEMENT_BY_ROW|OCI_FETCHSTATEMENT_BY_COLUMN|OCI_NUM|OCI_ASSOC
[0]=>
array(2) {
[0]=>
- unicode(1) "1"
+ %unicode|string%(1) "1"
[1]=>
- unicode(2) "-1"
+ %unicode|string%(2) "-1"
}
[1]=>
array(2) {
[0]=>
- unicode(1) "2"
+ %unicode|string%(1) "2"
[1]=>
- unicode(2) "-2"
+ %unicode|string%(2) "-2"
}
[2]=>
array(2) {
[0]=>
- unicode(1) "3"
+ %unicode|string%(1) "3"
[1]=>
- unicode(2) "-3"
+ %unicode|string%(2) "-3"
}
[3]=>
array(2) {
[0]=>
- unicode(1) "4"
+ %unicode|string%(1) "4"
[1]=>
- unicode(2) "-4"
+ %unicode|string%(2) "-4"
}
}
OCI_FETCHSTATEMENT_BY_ROW|OCI_NUM
[0]=>
array(2) {
[0]=>
- unicode(1) "1"
+ %unicode|string%(1) "1"
[1]=>
- unicode(2) "-1"
+ %unicode|string%(2) "-1"
}
[1]=>
array(2) {
[0]=>
- unicode(1) "2"
+ %unicode|string%(1) "2"
[1]=>
- unicode(2) "-2"
+ %unicode|string%(2) "-2"
}
[2]=>
array(2) {
[0]=>
- unicode(1) "3"
+ %unicode|string%(1) "3"
[1]=>
- unicode(2) "-3"
+ %unicode|string%(2) "-3"
}
[3]=>
array(2) {
[0]=>
- unicode(1) "4"
+ %unicode|string%(1) "4"
[1]=>
- unicode(2) "-4"
+ %unicode|string%(2) "-4"
}
}
OCI_FETCHSTATEMENT_BY_ROW|OCI_NUM|OCI_ASSOC
[0]=>
array(2) {
[0]=>
- unicode(1) "1"
+ %unicode|string%(1) "1"
[1]=>
- unicode(2) "-1"
+ %unicode|string%(2) "-1"
}
[1]=>
array(2) {
[0]=>
- unicode(1) "2"
+ %unicode|string%(1) "2"
[1]=>
- unicode(2) "-2"
+ %unicode|string%(2) "-2"
}
[2]=>
array(2) {
[0]=>
- unicode(1) "3"
+ %unicode|string%(1) "3"
[1]=>
- unicode(2) "-3"
+ %unicode|string%(2) "-3"
}
[3]=>
array(2) {
[0]=>
- unicode(1) "4"
+ %unicode|string%(1) "4"
[1]=>
- unicode(2) "-4"
+ %unicode|string%(2) "-4"
}
}
OCI_NUM
[0]=>
array(4) {
[0]=>
- unicode(1) "1"
+ %unicode|string%(1) "1"
[1]=>
- unicode(1) "2"
+ %unicode|string%(1) "2"
[2]=>
- unicode(1) "3"
+ %unicode|string%(1) "3"
[3]=>
- unicode(1) "4"
+ %unicode|string%(1) "4"
}
[1]=>
array(4) {
[0]=>
- unicode(2) "-1"
+ %unicode|string%(2) "-1"
[1]=>
- unicode(2) "-2"
+ %unicode|string%(2) "-2"
[2]=>
- unicode(2) "-3"
+ %unicode|string%(2) "-3"
[3]=>
- unicode(2) "-4"
+ %unicode|string%(2) "-4"
}
}
OCI_NUM|OCI_ASSOC
[0]=>
array(4) {
[0]=>
- unicode(1) "1"
+ %unicode|string%(1) "1"
[1]=>
- unicode(1) "2"
+ %unicode|string%(1) "2"
[2]=>
- unicode(1) "3"
+ %unicode|string%(1) "3"
[3]=>
- unicode(1) "4"
+ %unicode|string%(1) "4"
}
[1]=>
array(4) {
[0]=>
- unicode(2) "-1"
+ %unicode|string%(2) "-1"
[1]=>
- unicode(2) "-2"
+ %unicode|string%(2) "-2"
[2]=>
- unicode(2) "-3"
+ %unicode|string%(2) "-3"
[3]=>
- unicode(2) "-4"
+ %unicode|string%(2) "-4"
}
}
Done
--FILE--
<?php
-require dirname(__FILE__)."/connect.inc";
-require dirname(__FILE__).'/create_table.inc';
+require(dirname(__FILE__)."/connect.inc");
-$insert_sql = "INSERT INTO ".$schema."".$table_name." (id, value) VALUES (1,1)";
+// Initialize
-if (!($s = oci_parse($c, $insert_sql))) {
- die("oci_parse(insert) failed!\n");
-}
+$stmtarray = array(
+ "drop table fetch_into_tab",
+ "create table fetch_into_tab (id number, value number)",
+ "insert into fetch_into_tab (id, value) values (1,1)",
+ "insert into fetch_into_tab (id, value) values (1,1)",
+ "insert into fetch_into_tab (id, value) values (1,1)",
+);
-for ($i = 0; $i<3; $i++) {
- if (!oci_execute($s)) {
- die("oci_execute(insert) failed!\n");
+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;
+ }
}
}
-if (!oci_commit($c)) {
- die("oci_commit() failed!\n");
+foreach ($stmtarray as $stmt) {
+ $s = oci_parse($c, $stmt);
+ oci_execute($s);
}
-$select_sql = "SELECT * FROM ".$schema."".$table_name."";
+// Run Test
-if (!($s = oci_parse($c, $select_sql))) {
+if (!($s = oci_parse($c, "select * from fetch_into_tab"))) {
die("oci_parse(select) failed!\n");
}
-/* oci_fetch_all */
+/* ocifetchinto */
if (!oci_execute($s)) {
die("oci_execute(select) failed!\n");
}
var_dump(ocifetchinto($s, $all));
var_dump($all);
-/* oci_fetch_all */
+/* ocifetchinto */
if (!oci_execute($s)) {
die("oci_execute(select) failed!\n");
}
var_dump(ocifetchinto($s, $all, OCI_NUM+OCI_ASSOC+OCI_RETURN_NULLS+OCI_RETURN_LOBS));
var_dump($all);
-require dirname(__FILE__).'/drop_table.inc';
+// Cleanup
+
+$stmtarray = array(
+ "drop table fetch_into_tab"
+);
+
+foreach ($stmtarray as $stmt) {
+ $s = oci_parse($c, $stmt);
+ oci_execute($s);
+}
echo "Done\n";
?>
---EXPECT--
-int(5)
+--EXPECTF--
+int(2)
array(2) {
[0]=>
- unicode(1) "1"
+ %unicode|string%(1) "1"
[1]=>
- unicode(1) "1"
+ %unicode|string%(1) "1"
}
-int(5)
-array(10) {
+int(2)
+array(4) {
[0]=>
- unicode(1) "1"
- [u"ID"]=>
- unicode(1) "1"
+ %unicode|string%(1) "1"
+ [%u|b%"ID"]=>
+ %unicode|string%(1) "1"
[1]=>
- unicode(1) "1"
- [u"VALUE"]=>
- unicode(1) "1"
- [2]=>
- NULL
- [u"BLOB"]=>
- NULL
- [3]=>
- NULL
- [u"CLOB"]=>
- NULL
- [4]=>
- NULL
- [u"STRING"]=>
- NULL
+ %unicode|string%(1) "1"
+ [%u|b%"VALUE"]=>
+ %unicode|string%(1) "1"
}
Done
--FILE--
<?php
-require dirname(__FILE__)."/connect.inc";
-require dirname(__FILE__).'/create_table.inc';
+require(dirname(__FILE__)."/connect.inc");
-$insert_sql = "INSERT INTO ".$schema."".$table_name." (id, value) VALUES (1,1)";
+// Initialize
-if (!($s = oci_parse($c, $insert_sql))) {
- die("oci_parse(insert) failed!\n");
-}
+$stmtarray = array(
+ "drop table fetch_row_tab",
+ "create table fetch_row_tab (id number, value number)",
+ "insert into fetch_row_tab (id, value) values (1,1)",
+ "insert into fetch_row_tab (id, value) values (1,1)",
+ "insert into fetch_row_tab (id, value) values (1,1)",
+);
-for ($i = 0; $i<3; $i++) {
- if (!oci_execute($s)) {
- die("oci_execute(insert) failed!\n");
+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;
+ }
}
}
-if (!oci_commit($c)) {
- die("oci_commit() failed!\n");
+foreach ($stmtarray as $stmt) {
+ $s = oci_parse($c, $stmt);
+ oci_execute($s);
}
-$select_sql = "SELECT * FROM ".$schema."".$table_name."";
+// Run Test
-if (!($s = oci_parse($c, $select_sql))) {
+if (!($s = oci_parse($c, "select * from fetch_row_tab"))) {
die("oci_parse(select) failed!\n");
}
var_dump($row);
}
-require dirname(__FILE__).'/drop_table.inc';
+// Cleanup
+
+$stmtarray = array(
+ "drop table fetch_row_tab"
+);
+
+foreach ($stmtarray as $stmt) {
+ $s = oci_parse($c, $stmt);
+ oci_execute($s);
+}
echo "Done\n";
?>
---EXPECT--
-array(5) {
+--EXPECTF--
+array(2) {
[0]=>
- unicode(1) "1"
+ %unicode|string%(1) "1"
[1]=>
- unicode(1) "1"
- [2]=>
- NULL
- [3]=>
- NULL
- [4]=>
- NULL
+ %unicode|string%(1) "1"
}
-array(5) {
+array(2) {
[0]=>
- unicode(1) "1"
+ %unicode|string%(1) "1"
[1]=>
- unicode(1) "1"
- [2]=>
- NULL
- [3]=>
- NULL
- [4]=>
- NULL
+ %unicode|string%(1) "1"
}
-array(5) {
+array(2) {
[0]=>
- unicode(1) "1"
+ %unicode|string%(1) "1"
[1]=>
- unicode(1) "1"
- [2]=>
- NULL
- [3]=>
- NULL
- [4]=>
- NULL
+ %unicode|string%(1) "1"
}
Done
--FILE--
<?php
-require dirname(__FILE__)."/connect.inc";
-require dirname(__FILE__).'/create_table.inc';
-
-$insert_sql = "INSERT INTO ".$schema."".$table_name." (id, value) VALUES (1,1)";
-
-if (!($s = oci_parse($c, $insert_sql))) {
- die("oci_parse(insert) failed!\n");
-}
-
-for ($i = 0; $i<3; $i++) {
- if (!oci_execute($s)) {
- die("oci_execute(insert) failed!\n");
+require(dirname(__FILE__)."/connect.inc");
+
+// Initialize
+
+$stmtarray = array(
+ "drop table field_funcs1_tab",
+ "create table field_funcs1_tab (id number, value number)",
+ "insert into field_funcs1_tab (id, value) values (1,1)",
+ "insert into field_funcs1_tab (id, value) values (1,1)",
+ "insert into field_funcs1_tab (id, value) values (1,1)",
+);
+
+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;
+ }
}
}
-if (!oci_commit($c)) {
- die("oci_commit() failed!\n");
+foreach ($stmtarray as $stmt) {
+ $s = oci_parse($c, $stmt);
+ oci_execute($s);
}
-$select_sql = "SELECT * FROM ".$schema."".$table_name."";
+// Run Test
-if (!($s = oci_parse($c, $select_sql))) {
+if (!($s = oci_parse($c, "select * from field_funcs1_tab"))) {
die("oci_parse(select) failed!\n");
}
var_dump(oci_field_size($s));
-require dirname(__FILE__).'/drop_table.inc';
+
+// Cleanup
+
+$stmtarray = array(
+ "drop table field_funcs1_tab"
+);
+
+foreach ($stmtarray as $stmt) {
+ $s = oci_parse($c, $stmt);
+ oci_execute($s);
+}
echo "Done\n";
?>
--EXPECTF--
-array(5) {
+array(2) {
[0]=>
- unicode(1) "1"
+ %unicode|string%(1) "1"
[1]=>
- unicode(1) "1"
- [2]=>
- NULL
- [3]=>
- NULL
- [4]=>
- NULL
+ %unicode|string%(1) "1"
}
Warning: oci_field_is_null(): Invalid column index "-1" in %s on line %d
--FILE--
<?php
-require dirname(__FILE__)."/connect.inc";
-require dirname(__FILE__).'/create_table.inc';
+require(dirname(__FILE__)."/connect.inc");
-$s = oci_parse($c, 'drop table b41917t');
+$s = oci_parse($c, 'drop table field_funcs2_tab');
@oci_execute($s);
$t = array("C01" => "NUMBER",
"C16" => "REAL",
);
-$stmt = "create table b41917t (\n";
+$stmt = "create table field_funcs2_tab (\n";
foreach ($t as $colname => $type) {
$stmt .= "$colname $type,\n";
}
$s = oci_parse($c, $stmt);
oci_execute($s);
-$s = oci_parse($c, "select * from b41917t");
+$s = oci_parse($c, "select * from field_funcs2_tab");
oci_execute($s);
for ($i = 1; $i <= oci_num_fields($s); $i++) {
C14 FLOAT(9): precision 9, scale -127
C15 DOUBLE PRECISION: precision 126, scale -127
C16 REAL: precision 63, scale -127
-Done
\ No newline at end of file
+Done
--FILE--
<?php
-require dirname(__FILE__)."/connect.inc";
-require dirname(__FILE__).'/create_table.inc';
+require(dirname(__FILE__)."/connect.inc");
+
+// Initialize
+
+$stmtarray = array(
+ "drop table num_tab",
+ "create table num_tab (id number, value number)",
+);
+
+foreach ($stmtarray as $stmt) {
+ $s = oci_parse($c, $stmt);
+ $r = @oci_execute($s);
+ if (!$r) {
+ $m = oci_error($s);
+ if (!in_array($m['code'], array( // ignore expected errors
+ 942 // table or view does not exist
+ ))) {
+ echo $stmt . PHP_EOL . $m['message'] . PHP_EOL;
+ }
+ }
+}
+
+foreach ($stmtarray as $stmt) {
+ $s = oci_parse($c, $stmt);
+ oci_execute($s);
+}
+
+// Run Test
echo "Test 1\n";
var_dump(ocirowcount());
var_dump(ocinumcols());
var_dump(oci_num_fields());
-$insert_sql = "INSERT INTO ".$schema.$table_name." (id, value) VALUES (1,1)";
-
+echo "Test 2\n";
+$insert_sql = "insert into num_tab (id, value) values (1,1)";
if (!($s = oci_parse($c, $insert_sql))) {
- die("oci_parse(insert) failed!\n");
+ die("oci_parse(insert) failed!\n");
}
-echo "Test 2\n";
var_dump(ocirowcount($s));
var_dump(oci_num_rows($s));
var_dump(ocinumcols($s));
var_dump(oci_num_fields($s));
// All rows
-$select_sql = "SELECT * FROM ".$schema.$table_name."";
+$select_sql = "select * from num_tab";
if (!($s = oci_parse($c, $select_sql))) {
die("oci_parse(select) failed!\n");
var_dump(oci_num_fields($s));
// One row
-$select_sql = "SELECT id, value FROM ".$schema.$table_name." WHERE ROWNUM < 2";
+$select_sql = "SELECT id, value FROM num_tab WHERE ROWNUM < 2";
if (!($s = oci_parse($c, $select_sql))) {
die("oci_parse(select) failed!\n");
var_dump(oci_num_fields($s));
// No rows
-$select_sql = "SELECT id FROM ".$schema.$table_name." WHERE 1=0";
+$select_sql = "select id from num_tab where 1=0";
if (!($s = oci_parse($c, $select_sql))) {
die("oci_parse(select) failed!\n");
var_dump(ocinumcols($s));
var_dump(oci_num_fields($s));
-$delete_sql = "DELETE FROM ".$schema.$table_name."";
+$delete_sql = "delete from num_tab";
if (!($s = oci_parse($c, $delete_sql))) {
die("oci_parse(delete) failed!\n");
var_dump(ocinumcols($s));
var_dump(oci_num_fields($s));
-require dirname(__FILE__).'/drop_table.inc';
+
+// Cleanup
+
+$stmtarray = array(
+ "drop table num_tab"
+);
+
+foreach ($stmtarray as $stmt) {
+ $s = oci_parse($c, $stmt);
+ oci_execute($s);
+}
echo "Done\n";
Test 5b
int(0)
int(0)
-int(5)
-int(5)
+int(2)
+int(2)
Test 5c
int(3)
int(3)
-int(5)
-int(5)
+int(2)
+int(2)
Test 6
int(1)
int(1)
--FILE--
<?php
-require dirname(__FILE__)."/connect.inc";
-require dirname(__FILE__).'/create_table.inc';
+require(dirname(__FILE__)."/connect.inc");
-$insert_sql = "INSERT INTO ".$schema.$table_name." (id, value) VALUES (1,1)";
+// Initialize
-if (!($s = oci_parse($c, $insert_sql))) {
- die("oci_parse(insert) failed!\n");
-}
+$stmtarray = array(
+ "drop table prefetch_tab",
+ "create table prefetch_tab (id number, value number)",
+ "insert into prefetch_tab (id, value) values (1,1)",
+ "insert into prefetch_tab (id, value) values (1,1)",
+ "insert into prefetch_tab (id, value) values (1,1)",
+);
-for ($i = 0; $i<3; $i++) {
- if (!oci_execute($s)) {
- die("oci_execute(insert) failed!\n");
+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;
+ }
}
}
-if (!oci_commit($c)) {
- die("oci_commit() failed!\n");
+foreach ($stmtarray as $stmt) {
+ $s = oci_parse($c, $stmt);
+ oci_execute($s);
}
-$select_sql = "SELECT * FROM ".$schema.$table_name."";
+// Run Test
+
+$select_sql = "select * from prefetch_tab";
if (!($s = oci_parse($c, $select_sql))) {
die("oci_parse(select) failed!\n");
}
var_dump(oci_fetch($s));
-
var_dump(oci_num_rows($s));
-require dirname(__FILE__).'/drop_table.inc';
-
+// Cleanup
+
+$stmtarray = array(
+ "drop table prefetch_tab"
+);
+
+foreach ($stmtarray as $stmt) {
+ $s = oci_parse($c, $stmt);
+ oci_execute($s);
+}
+
echo "Done\n";
?>
--EXPECT--
--FILE--
<?php
-require dirname(__FILE__)."/connect.inc";
-require dirname(__FILE__).'/create_table.inc';
+require(dirname(__FILE__)."/connect.inc");
-$insert_sql = "INSERT INTO ".$schema.$table_name." (id, value) VALUES (1,1)";
+$stmtarray = array(
+ "drop table prefetch_old_tab",
+ "create table prefetch_old_tab (id number, value number)",
+ "insert into prefetch_old_tab (id, value) values (1,1)",
+ "insert into prefetch_old_tab (id, value) values (1,1)",
+ "insert into prefetch_old_tab (id, value) values (1,1)",
+);
-if (!($s = ociparse($c, $insert_sql))) {
- die("ociparse(insert) failed!\n");
+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;
+ }
+ }
}
-for ($i = 0; $i<3; $i++) {
- if (!ociexecute($s)) {
- die("ociexecute(insert) failed!\n");
- }
+foreach ($stmtarray as $stmt) {
+ $s = oci_parse($c, $stmt);
+ oci_execute($s);
}
+// Run Test
+
if (!ocicommit($c)) {
die("ocicommit() failed!\n");
}
-$select_sql = "SELECT * FROM ".$schema.$table_name."";
+$select_sql = "select * from prefetch_old_tab";
if (!($s = ociparse($c, $select_sql))) {
die("ociparse(select) failed!\n");
}
var_dump(ocifetch($s));
-
var_dump(ocirowcount($s));
-require dirname(__FILE__).'/drop_table.inc';
+
+// Cleanup
+
+$stmtarray = array(
+ "drop table prefetch_old_tab"
+);
+
+foreach ($stmtarray as $stmt) {
+ $s = oci_parse($c, $stmt);
+ oci_execute($s);
+}
echo "Done\n";
?>