diff --git a/reference/oci8/functions/oci-execute.xml b/reference/oci8/functions/oci-execute.xml index 7009e9a05a..413c9e627c 100644 --- a/reference/oci8/functions/oci-execute.xml +++ b/reference/oci8/functions/oci-execute.xml @@ -14,7 +14,21 @@ intmodeOCI_COMMIT_ON_SUCCESS - Executes a previously parsed statement. + Executes a statement previously returned + from oci_parse. + + + After execution, statements like INSERT will + have data committed to the database by default. For statements + like SELECT, execution performs the logic of the + query. Query results can subsequently be fetched in PHP with + functions like oci_fetch_array. + + + Each parsed statement may be executed multiple times, saving the + cost of re-parsing. This is commonly used + for INSERT statements when data is bound + with oci_bind_by_name. @@ -34,16 +48,27 @@ mode - Allows you to specify whether oci_execute - should immediately commit database changes. The default value - is OCI_COMMIT_ON_SUCCESS. - - - If you don't want statements to be committed automatically, - specify OCI_NO_AUTO_COMMIT as - your mode. Prior to PHP 5.3.2 and for - PECL oci8 < 1.4 use OCI_DEFAULT which - is an alias for OCI_NO_AUTO_COMMIT. + An optional second parameter can be one of the following constants: + + + OCI_COMMIT_ON_SUCCESS - Automatically + commit changes when the statement has succeeded. This is the + default. + + + OCI_NO_AUTO_COMMIT - Do not + automatically commit changes. Prior to PHP 5.3.2 and for + PECL oci8 < 1.4 use OCI_DEFAULT + which is an alias for OCI_NO_AUTO_COMMIT. + + + OCI_DESCRIBE_ONLY - Make query meta + data available to functions + like oci_field_name but do not create + a result set. Any subsequent fetch call such + as oci_fetch_array will fail. + + When using OCI_NO_AUTO_COMMIT mode, you're @@ -52,6 +77,10 @@ Explicitly call oci_commit to commit a transaction, or oci_rollback to abort it. + + Using transactions is recommended for relational data + consistency and for performance reasons. + @@ -65,8 +94,103 @@ + + &reftitle.examples; + + + <function>oci_execute</function> without specifying a mode example + + +]]> + + + + + + <function>oci_execute</function> with <constant>OCI_NO_AUTO_COMMIT</constant> example + + +]]> + + + + + + <function>oci_execute</function> with different commit modes example + + +]]> + + + + + + <function>oci_execute</function> with + <constant>OCI_DESCRIBE_ONLY</constant> example + +\n"; +} + +?> +]]> + + + + + &reftitle.notes; + + + Any call to oci_execute that uses + OCI_COMMIT_ON_SUCCESS mode explicitly or by default will commit + any previous uncommitted transaction. + + + Any Oracle DDL statement such as CREATE or DROP will automatically + commit any uncommitted transaction. + + In PHP versions before 5.0.0 you must