1--TEST--
2ocistatementtype()
3--SKIPIF--
4<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
5--FILE--
6<?php
7
8require __DIR__."/connect.inc";
9
10if (!empty($dbase)) {
11	var_dump($c = ocilogon($user, $password, $dbase));
12}
13else {
14	var_dump($c = ocilogon($user, $password));
15}
16
17$sqls = Array(
18    "SELECT * FROM table",
19    "DELETE FROM table WHERE id = 1",
20    "INSERT INTO table VALUES(1)",
21    "UPDATE table SET id = 1",
22	"DROP TABLE table",
23	"CREATE OR REPLACE PROCEDURE myproc(v1 NUMBER) as BEGIN DBMS_OUTPUT.PUT_LINE(v1); END;",
24    "CREATE TABLE table (id NUMBER)",
25    "ALTER TABLE table ADD (col1 NUMBER)",
26    "BEGIN NULL; END;",
27    "DECLARE myn NUMBER BEGIN myn := 1; END;",
28    "CALL myproc(1)",
29    "WRONG SYNTAX",
30    ""
31);
32
33foreach ($sqls as $sql) {
34	$s = ociparse($c, $sql);
35	var_dump(ocistatementtype($s));
36}
37
38echo "Done\n";
39
40?>
41--EXPECTF--
42resource(%d) of type (oci8 connection)
43string(6) "SELECT"
44string(6) "DELETE"
45string(6) "INSERT"
46string(6) "UPDATE"
47string(4) "DROP"
48string(6) "CREATE"
49string(6) "CREATE"
50string(5) "ALTER"
51string(5) "BEGIN"
52string(7) "DECLARE"
53string(4) "CALL"
54string(7) "UNKNOWN"
55string(7) "UNKNOWN"
56Done
57