xref: /PHP-5.5/ext/oci8/tests/bug36403.phpt (revision c7a8bd6a)
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");
6if (preg_match('/^1[01]\./', oci_client_version()) != 1) {
7    die("skip expected output only valid with Oracle 10g or greater version of client");
8}
9?>
10--FILE--
11<?php
12
13require(dirname(__FILE__).'/connect.inc');
14
15// Initialization
16
17$stmtarray = array(
18	"drop table bug36403_tab",
19	"create table bug36403_tab (c1 number, col2 number, column3 number, col4 number)"
20);
21
22oci8_test_sql_execute($c, $stmtarray);
23
24// Run Test
25
26echo "Test 1\n";
27
28$s = oci_parse($c, "select * from bug36403_tab");
29oci_execute($s, OCI_DESCRIBE_ONLY);
30for ($i = oci_num_fields($s); $i > 0; $i--) {
31	echo oci_field_name($s, $i) . "\n";
32}
33
34echo "Test 2\n";
35
36// Should generate an error: ORA-24338: statement handle not executed
37// since the statement handle was only described and not executed
38$row = oci_fetch_array($s);
39
40// Clean up
41
42$stmtarray = array(
43	"drop table bug36403_tab"
44);
45
46oci8_test_sql_execute($c, $stmtarray);
47
48?>
49===DONE===
50<?php exit(0); ?>
51--EXPECTF--
52Test 1
53COL4
54COLUMN3
55COL2
56C1
57Test 2
58
59Warning: oci_fetch_array(): ORA-%r(24338|01002)%r: %sbug36403.php on line %d
60===DONE===
61