Re: How use select for update
| From: | Christopher Jones | Date: | Thu, 16 Sep 2004 08:12:41 +0000 |
| Subject: | Re: How use select for update | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-36223@lists.php.net to get a copy of this message | ||
Chris wrote:
Is row-level locking happening? I think that the lock doesn t work When are you checking the locks? I am checking the lock with an SQLPLUS session If i lock my table with SQLPLUS, PHP can make an select for update But if i try to lock with PHP i can make an other select for update with sqlplus So my lock doesn t workMy locks work. In SQL*Plus: select * from emp for update; In a PHP script: $query = 'select * from emp for update nowait'; $stid = OCIParse($conn, $query); $r = OCIExecute($stid, OCI_DEFAULT); The output of the PHP script is: Warning: ociexecute(): OCIStmtExecute: ORA-00054: resource busy and acquire with NOWAIT specified in c:\cj\test.php on line 25 This shows that the rows were locked and not available. Calling the PHP script before the SQL*Plus script has different behaviour. See http://www.orafaq.com/faqphp.htm#TRANS : "If one doesn't commit or rollback at the end of a script, PHP will do an implicit commit" Chris