I’ve come across some legacy code using Oracle’s oci_execute() with OCI_DEFAULT flag.
oci_execute($this->result, OCI_DEFAULT);
However, this server now runs PHP > 5.3.2. According to the PHP Docs for OCI_DEFAULT:
Obsolete as of PHP 5.3.2 (PECL OCI8 1.4) but still available for backward compatibility. Use the equivalent OCI_NO_AUTO_COMMIT in new code.
So my question is two part:
- What did
OCI_DEFAULTrepresent for PHP < 5.3.2? - What is the effective mode when using
OCI_DEFAULTin PHP >= 5.3.2? (i.e. the code above)
In attempts to answer part 2, I was hoping to find oci_execute_mode() for debugging. However, AFAIK such functions do not exist. From running the script it appears it commits on successful PHP script end (i.e. when the connection is closed).
The docs answer your first question.
Then if you look for OCI_NO_AUTO_COMMIT…
Short answer: “OCI_DEFAULT < PHP 5.3.2” = “same as OCI_NO_AUTO_COMMIT >= PHP 5.3.2” = “Don’t automatically commit the statement being executed right now.”
It does the same thing as it did in < 5.3.2 to preserve backwards compatibility – it’s just obsolete/deprecated now. You can use either OCI_DEFAULT or OCI_NO_AUTO_COMMIT, but you should use the latter because it may not be around forever.