Hi, just started on the list, and the didn't seem to get through the first
time, so I'll give it another whirl.

I'm trying the following code based on a modded db_oci8.inc (the mod is so
that the call to OCIExecute always passes OCI_DEFAULT rater than
OCI_COMMIT_ON_SUCCESS.

This is a snippet of the relevant code:

The variable $PartNumber contains the part number to query on:

  $db->Query("select part_nbr "
             ." from psns "
             ." where part_nbr = '".$PartNumber."' "
             ." for update ");
  $db->next_record();
?><SCRIPT>alert ("Waiting with record lock")</SCRIPT><?
   $db->Query("lock table psns in exclusive mode");
?><SCRIPT>alert ("Waiting with table lock")</SCRIPT><?
  $db->Query("update psns set user_id = 'XXXX' where part_nbr =
'".$PartNumber."' ");
  $db->Query("commit");

The problem is that between the firt select query and lock table there
should be a record lock on the requested record. Now opening up a SQLPlus
session I can perform an update on that record. If, from SQLPlus, I try and
lock the table or do a select for update, then this the locking works fine
and there is no problem, so I know it is not an oracle related problem
becuase of this.

I've tried this also with the OCI8 libraries and the same problem occurs.
What I don't understand is why this should occur, after all its just passing
SQL queries through and not doing anything else flash.

Between the table lock and the update the lock should also be placed at
table level, yet there is still no lock applied.


The results in debug mode are :

Obtained the Link_ID: Resource id #3
Debug: commit mode = 0 COMMIT On success = 32 Default = 0 (this is just to
check that the mode is OCI_DEFAULT)
Debug: query = select part_nbr from psns where part_nbr = 'XXXXXX' for
update
[PART_NBR]:XXXXXX
Debug: commit mode = 0 COMMIT On success = 32 Default = 0
Debug: query = lock table psns in exclusive mode
returned Debug: commit mode = 32 COMMIT On success = 32 Default = 0 (this is
just to check that the mode is OCI_DEFAULT)
Debug: query = update psns set user_id = 'XXXX' where part_nbr = 'XXXXXX'

Regards,
      Richard Halford


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to