Leo Bidi
Leo Bidi

Reputation: 51

How to "block" a record with SQL command in an Advantage database local server?

I have a small project that use very few tables with Advantage Local Server.

The database is used by 2 PC's and 2 Windows Delphi apps each.

I need to update a record in one table that it is like an ID that needs to be unique.

How can I get sure that anyone else it's updating the same record on the same table?

As I mention, I am using ALS, so I can't use transactions.

I have this code, I think I read somewhere else that this statement was blocking the record.

qry.sql.clear
qry.sql.add ( 'select number from table where 1 = 1 )
qry.open

Can anyone give me some advice?

Unfortunately Advantage does not have anything like an WITH LOCK statement in the commands.

Thanks

Upvotes: 0

Views: 60

Answers (1)

Saurabh Srivastava
Saurabh Srivastava

Reputation: 26

SELECT * 
FROM test_table
WHERE primary_id = 1
FOR UPDATE;

Upvotes: -1

Related Questions