xref: /PHP-7.1/ext/oci8/tests/bug36403.phpt (revision a2c0f872)
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(dirname(__FILE__).'/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===DONE===
47<?php exit(0); ?>
48--EXPECTF--
49Test 1
50COL4
51COLUMN3
52COL2
53C1
54Test 2
55
56Warning: oci_fetch_array(): ORA-%r(24338|01002)%r: %sbug36403.php on line %d
57===DONE===
58