Board index » delphi » Adaptive Server Anywhere 6.0 - Transaction isolation

Adaptive Server Anywhere 6.0 - Transaction isolation

Hi,

I seem to have a problem with the transaction isolation on this SQL-Server.
On the Database component I have set the TransIsolation to tiReadCommitted.

What I want to do is reading a value from a table increment it and save this
value back down in the same record - and this must be done absolutely
transaction secure, so that there will NEVER be 2 users getting the same
value.

I have written a select statement thet reads the value and the I increment
it in Delphi and writes it back down in another query like this :

      sql.Add('update');
      sql.Add('  '+SequenceTable);
      sql.Add('set');
      sql.Add('  '+FieldnameCurrVal+' = :NextVal');
      sql.Add('where');
      sql.Add('  '+FieldnameSequence+' = :Sequence and ');
      sql.Add('  '+FieldnameCurrVal +' = :CurrVal ');

so in my update statement I event make sure that I only save it back if the
value did not change. But still I have problems that different users gets
the same value, so I wonder if BDE is at all setting any transaction
isloation level.

Is there someone who has any experince with this, and known how to solve the
problem?

--------------------------------
Jens Dein
IPOS as, Norway

 

Re:Adaptive Server Anywhere 6.0 - Transaction isolation


I solved the problem myself. Now I make the update before the select and
that locks the record for other users.

 --------------------------------
 Jens Dein
 IPOS as, Norway

Other Threads