Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 3 of 3 total
Thread Using Threads to Load Local Memory Tables from Server Tables
Mon, May 29 2006 5:03 PMPermanent Link

"Johnnie Norsworthy"
I have a few server-based tables that I need to retrieve at program startup
and store as memory tables in a local session. I was going to do this
processing in threads that are created at some point in the program startup.
What I want is to allow the user interface to display one table in a listbox
and let the user interact with that listbox while the other tables load. I'd
use some kind of flag to indicate all the other tables were loaded.

I am looking for the fastest way to move a server-based table to a memory
table. I know how to save a server table to a memory stream and then load
from that stream into the memory table. But is that the only way? If I
remember correctly I have to do all the creation of the memory table before
reading the stream, which means I will have to duplicate a lot of code for
each table and if my table structure changes, I'll have to make sure to
modify that code.

Has anyone done a threaded version of loading a server table into a local
memory table that would not mind sharing their code? I want to make sure I
don't miss some of the component creation and property setting I'll need to
do to accomplish this.

Thanks,

-Johnnie

on a side-note, I hope v5 makes local and remote sessions work together more
easily:
SELECT * FROM [remotesession]Tablename INTO [LocalSession]TableName
would sure be nice
or TDBISAMTable.CopyTable(Table:TDBISAMTable) that would work across
sessions

Tue, May 30 2006 8:10 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Johnnie,

<< I am looking for the fastest way to move a server-based table to a memory
table. I know how to save a server table to a memory stream and then load
from that stream into the memory table. But is that the only way? >>

Yes, that's it.

<< If I remember correctly I have to do all the creation of the memory table
before reading the stream, which means I will have to duplicate a lot of
code for each table and if my table structure changes, I'll have to make
sure to modify that code. >>

Are the in-memory tables using the same structure as the server-based tables
?  If so, then you should be able to create the in-memory tables quite
easily using something like this:

with MyRemoteTable do
  begin
  FieldDefs.Update;
  IndexDefs.Update;
  end;
with MyLocalInMemoryTable do
  begin
  FieldDefs.Assign(MyRemoteTable.FieldDefs);
  IndexDefs.Assign(MyRemoteTable.IndexDefs);
  CreateTable;
  end;

<< Has anyone done a threaded version of loading a server table into a local
memory table that would not mind sharing their code? I want to make sure I
don't miss some of the component creation and property setting I'll need to
do to accomplish this. >>

Do you want the saving of the stream from the remote table to be included in
the threading also ?   If so, then that might make things a bit more
difficult because it will require a separate session/connection to the
database server for the thread.

--
Tim Young
Elevate Software
www.elevatesoft.com

Tue, May 30 2006 10:16 AMPermanent Link

"Johnnie Norsworthy"

"Tim Young [Elevate Software]" <timyoung@elevatesoft.com> wrote in message
news:2B2F1877-26D1-4D77-B914-0F39A9523E38@news.elevatesoft.com...

[informative reply cut]

> Do you want the saving of the stream from the remote table to be included
> in the threading also ?   If so, then that might make things a bit more
> difficult because it will require a separate session/connection to the
> database server for the thread.

I'll give this a try and report back if I have any problems. Thanks for your
help.

-Johnnie

Image