Re: How use select for update

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 






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 work


My 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

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux