php-src/ext/oci8/tests/cursor_bind_err.phpt
Antony Dovgal e0ed2b45ff new tests
2005-09-06 19:33:18 +00:00

54 lines
1.2 KiB
PHP

--TEST--
binding a cursor (with errors)
--SKIPIF--
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
--ENV--
return "
ORACLE_HOME=".(isset($_ENV['ORACLE_HOME']) ? $_ENV['ORACLE_HOME'] : '')."
NLS_LANG=".(isset($_ENV['NLS_LANG']) ? $_ENV['NLS_LANG'] : '')."
";
--FILE--
<?php
require dirname(__FILE__)."/connect.inc";
require dirname(__FILE__)."/create_table.inc";
$insert_sql = "INSERT INTO ".$schema.$table_name." (id, value) VALUES (1,1)";
if (!($s = oci_parse($c, $insert_sql))) {
die("oci_parse(insert) failed!\n");
}
for ($i = 0; $i<3; $i++) {
if (!oci_execute($s)) {
die("oci_execute(insert) failed!\n");
}
}
if (!oci_commit($c)) {
die("oci_commit() failed!\n");
}
$sql = "select CURSOR(select * from ".$schema.$table_name.") into :cursor from dual";
$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_execute($cursor);
var_dump(oci_fetch_assoc($cursor));
require dirname(__FILE__)."/drop_table.inc";
echo "Done\n";
?>
--EXPECTF--
Warning: oci_bind_by_name(): ORA-01036: illegal variable name/number in %s on line %d
Warning: oci_fetch_assoc(): ORA-24338: statement handle not executed in %s on line %d
bool(false)
Done