xref: /PHP-7.0/ext/oci8/tests/statement_type.phpt (revision 65f50e7e)
1--TEST--
2oci_statement_type()
3--SKIPIF--
4<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
5--FILE--
6<?php
7
8require dirname(__FILE__)."/connect.inc";
9
10$sqls = Array(
11    "SELECT * FROM table",
12    "DELETE FROM table WHERE id = 1",
13    "INSERT INTO table VALUES(1)",
14    "UPDATE table SET id = 1",
15	"DROP TABLE table",
16	"CREATE OR REPLACE PROCEDURE myproc(v1 NUMBER) as BEGIN DBMS_OUTPUT.PUT_LINE(v1); END;",
17    "CREATE TABLE table (id NUMBER)",
18    "ALTER TABLE table ADD (col1 NUMBER)",
19    "BEGIN NULL; END;",
20    "DECLARE myn NUMBER BEGIN myn := 1; END;",
21    "CALL myproc(1)",
22    "WRONG SYNTAX",
23    ""
24);
25
26foreach ($sqls as $sql) {
27	$s = oci_parse($c, $sql);
28	var_dump(oci_statement_type($s));
29}
30
31echo "Done\n";
32
33?>
34--EXPECTF--
35string(6) "SELECT"
36string(6) "DELETE"
37string(6) "INSERT"
38string(6) "UPDATE"
39string(4) "DROP"
40string(6) "CREATE"
41string(6) "CREATE"
42string(5) "ALTER"
43string(5) "BEGIN"
44string(7) "DECLARE"
45string(4) "CALL"
46string(7) "UNKNOWN"
47string(7) "UNKNOWN"
48Done
49