2005-09-06 19:33:18 +00:00
|
|
|
--TEST--
|
|
|
|
fetching cursor from a statement
|
2005-12-06 19:26:57 +00:00
|
|
|
--SKIPIF--
|
2005-09-06 19:33:18 +00:00
|
|
|
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
|
|
|
|
--FILE--
|
|
|
|
<?php
|
|
|
|
|
|
|
|
require dirname(__FILE__)."/connect.inc";
|
|
|
|
require dirname(__FILE__)."/create_table.inc";
|
|
|
|
|
|
|
|
$insert_sql = "INSERT INTO ".$schema.$table_name." (id, value) VALUES (1,1)";
|
|
|
|
|
|
|
|
if (!($s = ociparse($c, $insert_sql))) {
|
|
|
|
die("ociparse(insert) failed!\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
for ($i = 0; $i<3; $i++) {
|
|
|
|
if (!ociexecute($s)) {
|
|
|
|
die("ociexecute(insert) failed!\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!ocicommit($c)) {
|
|
|
|
die("ocicommit() failed!\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
$sql = "select CURSOR(select * from ".$schema.$table_name.") as curs FROM dual";
|
|
|
|
$stmt = ociparse($c, $sql);
|
|
|
|
|
|
|
|
ociexecute($stmt);
|
|
|
|
|
|
|
|
while ($result = ocifetchinto($stmt, $data, OCI_ASSOC)) {
|
|
|
|
ociexecute($data["CURS"]);
|
|
|
|
ocifetchinto($data["CURS"], $subdata, OCI_ASSOC);
|
|
|
|
var_dump($subdata);
|
|
|
|
var_dump(ocicancel($data["CURS"]));
|
|
|
|
ocifetchinto($data["CURS"], $subdata, OCI_ASSOC);
|
|
|
|
var_dump($subdata);
|
|
|
|
var_dump(ocicancel($data["CURS"]));
|
|
|
|
}
|
|
|
|
|
|
|
|
require dirname(__FILE__)."/drop_table.inc";
|
|
|
|
|
|
|
|
echo "Done\n";
|
|
|
|
|
|
|
|
?>
|
|
|
|
--EXPECTF--
|
|
|
|
array(2) {
|
|
|
|
["ID"]=>
|
|
|
|
string(1) "1"
|
|
|
|
["VALUE"]=>
|
|
|
|
string(1) "1"
|
|
|
|
}
|
|
|
|
bool(true)
|
|
|
|
|
|
|
|
Warning: ocifetchinto():%sORA-01002: fetch out of sequence in %scursors_old.php on line %d
|
|
|
|
array(2) {
|
|
|
|
["ID"]=>
|
|
|
|
string(1) "1"
|
|
|
|
["VALUE"]=>
|
|
|
|
string(1) "1"
|
|
|
|
}
|
|
|
|
bool(true)
|
|
|
|
Done
|
2006-07-10 20:48:04 +00:00
|
|
|
--UEXPECTF--
|
|
|
|
array(2) {
|
|
|
|
[u"ID"]=>
|
2006-11-10 16:56:19 +00:00
|
|
|
unicode(1) "1"
|
2006-07-10 20:48:04 +00:00
|
|
|
[u"VALUE"]=>
|
2006-11-10 16:56:19 +00:00
|
|
|
unicode(1) "1"
|
2006-07-10 20:48:04 +00:00
|
|
|
}
|
|
|
|
bool(true)
|
|
|
|
|
|
|
|
Warning: ocifetchinto(): ORA-01002: fetch out of sequence in %s on line %d
|
|
|
|
array(2) {
|
|
|
|
[u"ID"]=>
|
2006-11-10 16:56:19 +00:00
|
|
|
unicode(1) "1"
|
2006-07-10 20:48:04 +00:00
|
|
|
[u"VALUE"]=>
|
2006-11-10 16:56:19 +00:00
|
|
|
unicode(1) "1"
|
2006-07-10 20:48:04 +00:00
|
|
|
}
|
|
|
|
bool(true)
|
|
|
|
Done
|