Additional
dbCAP
AnyDAC
ThinDAC
NCOCI8
Topic: Record blocking
Record blocking
Posted: 2008/02/11 05:00
 
Hello.

How can I block editing this same record by 2 and more users ??
I try use properties UpdateOptions of TAdConnection like LockMode, LockPoint and LockWait and I also write same LockSQL qurey for TAdUpdateSQL but it doesn't work.
Re:Record blocking
Posted: 2008/02/11 07:47
 
Hello

1) How you setup UpdateOptions ?
2) Try to set:
UpdateOptions.LockMode = lmPessimistic
UpdateOptions.LockPoint = lpImmediate
UpdateOptions.LokcWait = True
3) Also what is your DBMS ?

Regards,
Dmitry
Re:Record blocking
Posted: 2008/02/12 00:54
 
Hello

When i use this settings of UpdateOptions i get this message: "Update table undefined". Then I define LockSQL query for TAdUpdateSQL - I try empty update (something like: update table set id = :old_id where id = :old_id), but it doesn't work (different users can edit this record).

I use MySQL 5.0.

Greetings,
Mateusz
Re:Record blocking
Posted: 2008/02/12 01:06
 
1) If you get "Update table undefined", it means anydac is unable to get table name. You can specifiy it in UpdateOptions.UpdateTableName.
2) LockSQL for MySQL should contain something like that:

 SELECT FROM MyTab  WHERE ID = :OLD_ID LOCK IN SHARE MODE


And not an UPDATE command.
3) Pessimistic locking will work for InnoDB tables, for example. And will not for MyISAM.
Re:Record blocking
Posted: 2008/02/12 02:09
 
Hello,

1) I define UpdateTableName,
2) I use this kind of query for LockSql,
3) I use InnoDB tables for MySql

but locking still doesn't work. Maybe I must set some other properties ?

Greetings,

Mateusz