Locking Help Needed

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Rober Watson
Posts: 7
Joined: Tue 02 Sep 2008 16:14

Locking Help Needed

Post by Rober Watson » Mon 19 Jan 2009 03:02

I have a table of class registrations. Each class has a set limit of allowable registrations. Whenever a user desires to register for a class I want to insure the class is not full and then, if it is not, add them to the class registration role. I insure it is not full by counting all the registrations and then comparing to the allowable for the class. I need to lock the table to insure that no one else registers while I am counting and entering a new record. How do I best do this please??

mySQLQuery.Lock;
do my thing;
mySQLQuery.UnLock;
??????

TIA,
Bob Watson

Dimon
Devart Team
Posts: 2910
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Mon 19 Jan 2009 13:57

To solve the problem you should use the Lock or LockTable methods.
You can find more detailed information about these methods in the MyDAC help.

Post Reply