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