> I want to do this:
>  read a row from table table_1 with select
>  change a row from  with update
>  change another row in table table_1 with update
> But queries  and  in the time of invoking, assume that row from
>  wasn't changed.
> Should I use LOCK TABLES? - I've tried that in query browser, but that
> doesn't prevent another thread to modify locked table.
One of the easiest ways is to start a read consistent transaction,
read the values for the rows you want to update.
Next, update the rows, but not just include the primary key to
locate the row, but also use the values you want to modify.
I want to update a customer record and change his address.
<read address info>
set address = 'New Address'
where customer_id = 121
and address = 'Old Address'
If this update fails to locate rows, you know that someone else
changed the value in the Address field before you were able
to update it.
Database Workbench - tool for InterBase, Firebird, MySQL, NexusDB, Oracle &
MS SQL Server
Database development questions? Check the forum!