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