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