xref: /PHP-7.2/ext/oci8/tests/cursor_bind_err.phpt (revision a2c0f872)
1--TEST--
2binding a cursor (with errors)
3--SKIPIF--
4<?php
5$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
6require(dirname(__FILE__).'/skipif.inc');
7?>
8--FILE--
9<?php
10
11require(dirname(__FILE__)."/connect.inc");
12
13// Initialize
14
15$stmtarray = array(
16    "drop table cursor_bind_err_tab",
17    "create table cursor_bind_err_tab (id number, value number)",
18    "insert into cursor_bind_err_tab (id, value) values (1,1)",
19    "insert into cursor_bind_err_tab (id, value) values (1,1)",
20    "insert into cursor_bind_err_tab (id, value) values (1,1)",
21);
22
23oci8_test_sql_execute($c, $stmtarray);
24
25// Run Test
26
27$sql = "select cursor(select * from cursor_bind_err_tab) into :cursor from dual";
28$stmt = oci_parse($c, $sql);
29
30$cursor = oci_new_cursor($c);
31oci_bind_by_name($stmt, ":cursor", $cursor, -1, OCI_B_CURSOR);
32
33oci_execute($stmt);
34
35oci_execute($cursor);
36var_dump(oci_fetch_assoc($cursor));
37
38// Cleanup
39
40$stmtarray = array(
41    "drop table cursor_bind_err_tab"
42);
43
44oci8_test_sql_execute($c, $stmtarray);
45
46echo "Done\n";
47
48?>
49--EXPECTF--
50Warning: oci_bind_by_name(): ORA-01036: %s in %s on line %d
51
52Warning: oci_fetch_assoc(): ORA-24338: %s in %s on line %d
53bool(false)
54Done
55