🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.database.multi-tier
1 messages
1 total messages Started by Ian Broadhurst Fri, 19 Oct 2001 13:48
Unwanted: Error 'Too many record locks on table'
#440
Author: Ian Broadhurst
Date: Fri, 19 Oct 2001 13:48
47 lines
2416 bytes
I have a client/server application where the clients use data-aware
controls (TDBGrid etc) and TClientDataSets, and the server uses a
TClientDataSet (used for all providers called cdsInternalUpdate),
TProviders and TTables inside a TDataModule. The database tables are
of type dBASE with a level of 4.

When a user deletes a record from the control, the server deletes the
record from the database table using for following:

int MyVal = iSomePassedInId;
cdsInternalUpdate->ProviderName = 'Provider1';
cdsInternalUpdate->Open();
if (cdsInternalUpdate->Locate('ID', MyVal, Opts))
{
   cdsInternalUpdate->Delete();
   cdsInternalUpdate->ApplyUpdates(0); //calls
Provider1AfterUpdateRecord
}

In the Provider1AfterUpdateRecord method, I remove all related records
from other tables and log the record change to a log file. I remove
the records from the tables directly like so:

String OldIdx =Table2->IndexName;
Table2->IndexName = 'ID';

if (Table2->Locate('ID', MyVal, Opts))
{
  while (!Table2->Eof && 
          Table2->FieldByName('ID')->AsInteger ==MyVal)              
  {
    Table2->Delete();
  }
}

It is here that I get the error 'Too many record locks on table'. I
believe that it occurs during the Table2->Locate() or Table2->Delete()
method. This occurs when using one client connected to the server.

Any suggestions???
Are you allowed to access a TTable from within an AfterUpdate method?
Is there anything fundamentally wrong with the way in which I have
gone about this?

All help greatly appreciated!

Ian Broadhurst
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads