Problems of locks with oci
443813May 13 2005 — edited May 19 2005I have a problem with locks.
I try to create a lock thanks to "SELECT X FROM TAB FOR UPDATE NOWAIT".
to do this :
- I parse my query : $resource = ociparse ($onnection, "SELECT X FROM TAB FOR UPDATE NOWAIT") ;
- I execute my query : ociexecute ($resource, OCI_DEFAULT) ;
- I don't close the connection in the script.
If I use the query in SQL*PLUS and (without commit or rollback in SQL*PLUS of course) I start my php script, I obtain the ORA error which tells there is a lock etc... So all is good.
But if I start the script before, and the query in SQL*PLUS after, there is no lock created by the script. Like if there was an implicite rollback.
I don't know if it's a problem of oci, or a problem of configuration or a problem of PHP...
Reproduce code:
---------------
$connect = ociplogon($user, $password,$tns) ;
$resource = ociparse ($connect, "SELECT X FROM TAB FOR UPDATE NOWAIT") ;
ociexecute ($resource, OCI_DEFAULT) ;
Expected result:
----------------
If two scripts are executed at the same time : an oracle error in one of both script.
Actual result:
--------------
No error, and no lock created.