xref: /PHP-8.0/ext/oci8/tests/bug36403.phpt (revision f8d79582)
1--TEST--
2Bug #36403 (oci_execute no longer supports OCI_DESCRIBE_ONLY)
3--SKIPIF--
4<?php
5if (!extension_loaded('oci8')) die ("skip no oci8 extension");
6?>
7--FILE--
8<?php
9
10require(__DIR__.'/connect.inc');
11
12// Initialization
13
14$stmtarray = array(
15    "drop table bug36403_tab",
16    "create table bug36403_tab (c1 number, col2 number, column3 number, col4 number)"
17);
18
19oci8_test_sql_execute($c, $stmtarray);
20
21// Run Test
22
23echo "Test 1\n";
24
25$s = oci_parse($c, "select * from bug36403_tab");
26oci_execute($s, OCI_DESCRIBE_ONLY);
27for ($i = oci_num_fields($s); $i > 0; $i--) {
28    echo oci_field_name($s, $i) . "\n";
29}
30
31echo "Test 2\n";
32
33// Should generate an error: ORA-24338: statement handle not executed
34// since the statement handle was only described and not executed
35$row = oci_fetch_array($s);
36
37// Clean up
38
39$stmtarray = array(
40    "drop table bug36403_tab"
41);
42
43oci8_test_sql_execute($c, $stmtarray);
44
45?>
46--EXPECTF--
47Test 1
48COL4
49COLUMN3
50COL2
51C1
52Test 2
53
54Warning: oci_fetch_array(): ORA-%r(24338|01002)%r: %sbug36403.php on line %d
55