Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » DBISAM Technical Support » Support Forums » DBISAM Client/Server » View Thread |
Messages 1 to 3 of 3 total |
Code: Using a Server Query to Fill a Local Memory Table |
Wed, Aug 9 2006 11:11 AM | Permanent Link |
"Johnnie Norsworthy" | I just wanted to share my code for copying a server query to a local memory
table. I use this code extensively for populating Developer Express Quantum Grids. All of the exception handling is done around the method calling code. I have this method located in a centralized data module which includes all my different session and database components. I hope others find this useful. I do not know of any way to make this faster, but I'm open for suggestions. I can populate a large grid from a server in less than a second in most cases. -Johnnie procedure ServerQueryToLocalMemoryTable(var ServerQuery: TDBISAMQuery; var LocalMemoryTable: TDBISAMTable); var MemoryStream: TMemoryStream; begin MemoryStream := TMemoryStream.Create; try ServerQuery.RequestLive := True; // does not create table on server ServerQuery.Open; ServerQuery.SaveToStream(MemoryStream); // check to see if reloading or creating a new memory table if LocalMemoryTable.Exists then begin LocalMemoryTable.Close; LocalMemoryTable.EmptyTable; end else begin LocalMemoryTable.FieldDefs.Assign(ServerQuery.FieldDefs); LocalMemoryTable.CreateTable; end; ServerQuery.Close; LocalMemoryTable.LoadFromStream(MemoryStream); finally FreeAndNil(MemoryStream); end; end; |
Fri, Aug 11 2006 1:43 AM | Permanent Link |
Oliver Bock | Johnnie Norsworthy wrote:
> I just wanted to share my code for copying a server query to a local memory > table. I use this code extensively for populating Developer Express Quantum > Grids. >... > LocalMemoryTable.FieldDefs.Assign(ServerQuery.FieldDefs); > LocalMemoryTable.CreateTable; Is the above step necessary? I thought LoadFromStream would create the table and structure for you. Oliver |
Fri, Aug 11 2006 12:04 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Oliver,
<< Is the above step necessary? I thought LoadFromStream would create the table and structure for you. >> Nope, you need to create the table first. -- Tim Young Elevate Software www.elevatesoft.com |
This web page was last updated on Saturday, May 4, 2024 at 12:54 AM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |