Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » ElevateDB Technical Support » Support Forums » ElevateDB General Discussion » View Thread |
Messages 1 to 9 of 9 total |
TClientDataSet + TEDBTable + TMemoryStream. |
Wed, Jul 25 2012 11:04 AM | Permanent Link |
Abdulaziz Al-Jasser | Hi,
For performance issue I am trying to save a TEDBTable to a TMemoryStream using "SaveToStream" method and loading it into a TClientDataSet using "LoadFromStream" but with no luck (I get an error in loading the stream)! First thing comes to my mind, is EDB compatible with Delphi stream? Regards, Abdulaziz Jasser |
Wed, Jul 25 2012 11:38 AM | Permanent Link |
Raul Team Elevate | Yes
A very trivial example would be something like this: var str:TMemoryStream; begin EDBTableSrc.TableName := 'SOURCETBL'; EDBTableDest.TableName := 'DESTTBL'; //open both EDBTableSrc.Active := true; EDBTableDest.Active := true; str := TMemoryStream.Create; try EDBTableSrc.SaveToStream(str); EDBTableDest.LoadFromStream(str); finally str.Free; end; EDBTableSrc.Active := false; EDBTableDest.Active := false; end; Raul On 7/25/2012 11:04 AM, Abdulaziz Jasser wrote: > Hi, > > For performance issue I am trying to save a TEDBTable to a TMemoryStream using "SaveToStream" method and loading it into a TClientDataSet using "LoadFromStream" but with no luck (I get an error in loading the stream)! First thing comes to my mind, is EDB compatible with Delphi stream? > Regards, > Abdulaziz Jasser > |
Wed, Jul 25 2012 3:03 PM | Permanent Link |
Abdulaziz Al-Jasser | Raul,
How about if change the destination table form TEDBTable to TClientDataSet? Would it work? Regards, Abdulaziz Jasser |
Wed, Jul 25 2012 3:31 PM | Permanent Link |
Abdulaziz Al-Jasser | Raul,
Ok... the issue is solved. My code was missing "CreateDataSet" method. Thanks. Regards, Abdulaziz Jasser |
Wed, Jul 25 2012 3:44 PM | Permanent Link |
Raul Team Elevate | Sorry - missed the TClientDataSet part.
No - EDB and TClientDataSet are 2 completely different DB engines and streams are not compatible (same way EDB and DBISAM streams would not be compatible). If you look at their class hierarchy then only common ancestor is TDataSet and unfortunately it does not implement LoadFromStream/SaveToStream so those function are specific to each side. If you need to be able to exchange data between EDB and TClientDataSet then you need to do it at the TDataSet level: - basically obtain 2 TDataSets and then run a dual-loop over them (one from 1st record to last and other thru fields for each row) and copy data field by field. Raul On 7/25/2012 3:03 PM, Abdulaziz Jasser wrote: > Raul, > > How about if change the destination table form TEDBTable to TClientDataSet? Would it work? > Regards, > Abdulaziz Jasser > |
Wed, Jul 25 2012 5:19 PM | Permanent Link |
Abdulaziz Al-Jasser | Raul,
<<If you need to be able to exchange data between EDB and TClientDataSet then you need to do it at the TDataSet level: - basically obtain 2 TDataSets and then run a dual-loop over them (one from 1st record to last and other thru fields for each row) and copy data field by field.>> That would be slow over a slow internet connection. I am looking for a method to move the data to the client pc and then loop the data localy. Regards, Abdulaziz Jasser |
Wed, Jul 25 2012 5:31 PM | Permanent Link |
Raul Team Elevate | Then just use the EDB on both sides - you can use it in pure in-memory
mode. Raul On 7/25/2012 5:19 PM, Abdulaziz Jasser wrote: > Raul, > > <<If you need to be able to exchange data between EDB and TClientDataSet > then you need to do it at the TDataSet level: > - basically obtain 2 TDataSets and then run a dual-loop over them (one > from 1st record to last and other thru fields for each row) and copy > data field by field.>> > > That would be slow over a slow internet connection. I am looking for a method to move the data to the client pc and then loop the data localy. > Regards, > Abdulaziz Jasser > |
Wed, Jul 25 2012 6:24 PM | Permanent Link |
Abdulaziz Al-Jasser | Raul wrote:
<<Then just use the EDB on both sides - you can use it in pure in-memory mode.>> I think you got my point. Can you point me to who to create a local table which will load the stream from the remote database? Regards, Abdulaziz Jasser |
Wed, Jul 25 2012 9:39 PM | Permanent Link |
Raul Team Elevate | The basic idea is to simply have 2 sessions in your application - one local and one remote. You would do the SaveToStream from remote EDBtable and then run the LoadFromStream on the local EDBTable. Check out the UseLocalSessionengineSettings option of the engine http://www.elevatesoft.com/manual?action=viewprop&id=edb2&product=rsdelphiwin32uni&version=XE2&comp=TEDBEngine&prop=UseLocalSessionEngineSettings You might also be interested in the ConfigMemory property: http://www.elevatesoft.com/manual?action=viewprop&id=edb2&product=rsdelphiwin32uni&version=XE2&comp=TEDBEngine&prop=ConfigMemory When you are creating the local database then just specify IN MEMORY as the path http://www.elevatesoft.com/manual?action=viewtopic&id=edb2sql&topic=CREATE_DATABASE Raul On 7/25/2012 6:24 PM, Abdulaziz Jasser wrote: > I think you got my point. Can you point me to who to create a local table which will load the stream from the remote database? > Regards, > Abdulaziz Jasser > |
This web page was last updated on Thursday, May 23, 2024 at 07:54 PM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |