Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 2 of 2 total
Thread Multi-Thread Queries??
Thu, Jan 30 2014 4:53 PMPermanent Link

Praveen A B

I'm using Delphi 2007 and DBISAM 4.26 b3. I have some questions regarding accessing and populating dbisam datasets in threads.

1) I have 20 local tables in folder C:\TempDB. At application startup I copy them to MEMORY DB as below -

//This procedure is called in a thread.
procedure CreateCache;
var
 tblTemp: TDBISAMTable;
begin
 tblTemp := TDBISAMTable.Create(nil);
 for i := 1 to 20 do
 begin
    tblTemp.DataBaseName := C:\TempDB;
    tblTemp.TableName := CacheTableName[i];
    tblTemp.Open;
    tblTemp.CopyTable('MEMORY', tblTemp.TableName);
    tblTemp.Close;
 end;  
 tblTemp.Free;
end;

Is the above code fine or do I need to create Session and Database components with new SessionName.

2) I have TDBISAMTable, say tblMain, which is connected to a grid component. In order to populate data, I send an SOAP-XML request to server and the xml response is parsed and populated into tblMain. This process happens in a thread which references tblMain, Do I need to have new sessionname and database component in thread when working with tblMain ?
Fri, Jan 31 2014 4:46 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Praveen,

<< Is the above code fine or do I need to create Session and Database
components with new SessionName. >>

You need to create a separate TDBISAMSession, at the very least.  You can
skip creating a separate TDBISAMDatabase at just specify the database name
(if remote) or database path (if local).

<< 2) I have TDBISAMTable, say tblMain, which is connected to a grid
component. In order to populate data, I send an SOAP-XML request to server
and the xml response is parsed and populated into tblMain. This process
happens in a thread which references tblMain, Do I need to have new
sessionname and database component in thread when working with tblMain ? >>

Yes. You'll need to do the work in the thread with separate component
instances, and then call Refresh on the table instance in the main thread
when done.

Tim Young
Elevate Software
www.elevatesoft.com
Image