diff --git a/reference/oci8/functions/oci-statement-type.xml b/reference/oci8/functions/oci-statement-type.xml index ba2c996ff2..c3d1d078fd 100644 --- a/reference/oci8/functions/oci-statement-type.xml +++ b/reference/oci8/functions/oci-statement-type.xml @@ -3,7 +3,7 @@ oci_statement_type - Returns the type of an OCI statement + Returns the type of a statement @@ -13,7 +13,8 @@ resourcestatement - Returns the type of the provided OCI statement. + Returns a keyword identifying the type of the + OCI8 statement. @@ -25,7 +26,7 @@ statement - A valid OCI statement identifier. + A valid OCI8 statement identifier from oci_parse. @@ -36,22 +37,67 @@ &reftitle.returnvalues; - Returns the query type ofstatement as one of the - following values: - - SELECT - UPDATE - DELETE - INSERT - CREATE - DROP - ALTER - BEGIN - DECLARE - CALL (since PHP 5.2.1 and OCI8 - 1.2.3) - UNKNOWN - + Returns the type of statement as one of the + following strings. + + Statement type + + + + Return String + Notes + + + + + ALTER +   + + + BEGIN +   + + + CALL + Introduced in PHP 5.2.1 (PECL OCI8 1.2.3) + + + CREATE +   + + + DECLARE +   + + + DELETE +   + + + DROP +   + + + INSERT +   + + + SELECT +   + + + UPDATE +   + + + UNKNOWN +   + + + +
+
+ Returns &false; on error.
@@ -64,15 +110,20 @@ "); - } +$conn = oci_connect('hr', 'welcome', 'localhost/XE'); + +$stid = oci_parse($conn, 'DELETE FROM departments WHERE department_id = 130;'); +if (oci_statement_type($stid) == "DELETE") { + trigger_error('You are not allowed to delete from this table', E_USER_ERROR); +} +else { + oci_execute($stid); // delete the row +} + +oci_free_statement($stid); +oci_close($conn); - oci_close($conn); ?> ]]> @@ -84,10 +135,9 @@ &reftitle.notes; - In PHP versions before 5.0.0 you must use ocistatementtype instead. - This name still can be used, it was left as alias of - oci_statement_type for downwards compatability. - This, however, is deprecated and not recommended. + In PHP versions before 5.0.0 you must + use ocistatementtype instead. + &oci.name.compat.note;