xref: /PHP-8.3/ext/oci8/tests/error_bind_2.phpt (revision a53e5617)
1--TEST--
2Test some more oci_bind_by_name error conditions
3--EXTENSIONS--
4oci8
5--SKIPIF--
6<?php
7require_once 'skipifconnectfailure.inc';
8$target_dbs = array('oracledb' => true, 'timesten' => true);  // test runs on these DBs
9require __DIR__.'/skipif.inc';
10preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches);
11if (!(isset($matches[0]) && $matches[1] >= 12)) {
12    die("skip expected output only valid when using Oracle Database 12c or greater");
13}
14preg_match('/^[[:digit:]]+/', oci_client_version(), $matches);
15if (!(isset($matches[0]) && $matches[0] >= 12)) {
16    die("skip works only with Oracle 12c or greater version of Oracle client libraries");
17}
18?>
19--FILE--
20<?php
21
22require __DIR__.'/connect.inc';
23
24// Initialization
25
26$stmtarray = array(
27    "drop table error_bind_2_tab",
28    "create table error_bind_2_tab(name varchar(10))"
29);
30oci8_test_sql_execute($c, $stmtarray);
31
32echo "Test 1 - SQLT_BOL\n";
33
34unset($name);
35$stmt = oci_parse($c, "insert into error_bind_2_tab values (:name)");
36oci_bind_by_name($stmt, ":name", $name, -1, SQLT_BOL);
37$name=$c;
38var_dump(oci_execute($stmt));
39
40echo "Test 2 - SQLT_BOL\n";
41
42unset($name);
43$stmt = oci_parse($c, "insert into error_bind_2_tab values (:name)");
44$name=$c;
45oci_bind_by_name($stmt, ":name", $name, -1, SQLT_BOL);
46
47// Clean up
48
49$stmtarray = array(
50    "drop table error_bind_2_tab",
51);
52oci8_test_sql_execute($c, $stmtarray);
53
54echo "Done\n";
55
56?>
57--EXPECTF--
58Test 1 - SQLT_BOL
59
60Warning: oci_execute(): Invalid variable used for bind in %s on line %d
61bool(false)
62Test 2 - SQLT_BOL
63
64Warning: oci_bind_by_name(): Invalid variable used for bind in %s on line %d
65Done
66