Page 1 of 1

Save/load dataset and table to/from memory stream

Posted: 26.05.2011, 22:42
by JD
Hello everyone,

I need some help with saving a Zeos query and a Zeos table to a memory stream. I would also like to know how to load a Zeos query and a Zeos table from a memory stream.

I've seen

ZQuery1.Properties.SaveToStream
ZTable1.Properties.SaveToStream

but I don't know how they really work.

Thank you for your kind assistance.

Posted: 30.05.2011, 14:56
by trupka
I probably misunderstood something, but must ask - why do you want to store Properties into memstream? It's just a simple string (Zquery1.Properties.Text == string).
Maybe you want to store entire component or Zquery/ZTable data?

Posted: 31.05.2011, 21:58
by JD
I want to store the data - a record or the entire dataset - not the properties, to a stream. All I found was
ZQuery1.Properties.SaveToStream
ZTable1.Properties.SaveToStream

so I was wondering how it works.

Does anyone know how I can save a Zeos dataset to a stream?

Thanks for your assistance.

Posted: 01.06.2011, 17:45
by trupka
IMO, there's no simple way to store data to a stream. This task will probably need some component coding. Loading from stream into component is another story (nearly impossible).
I still can't imagine why would you need this?
If you want to store data locally for fast lookup and offline work, take a look into Dephi's TClientDataSet component.

Posted: 01.06.2011, 21:17
by Pitfiend
I think it is possible. You get the datafields, you convert them to something similar to a csv format, you add them to your string stream, repeat as needed, them you save your stream. To load a stream into component you do it in reverse order.

This kind of process can be usefull to make database dumps or batch exporting to other applications.

Hope this helps.

Posted: 03.06.2011, 14:56
by JD
It is possible. I've seen it done with data components other than Zeos. Like trupka said, Delphi's TClientDataSet is one example. Another is Lazarus' TMemDataset & TBufDataset. RX Components' TRxMemoryData that works in Delphi & Lazarus also does this.

But these are client side components. I want Zeos on the server sending data to these client side components OR exporting data to other applications.

I can think of an XML solution but I want a working alternative in case the client side application cannot handle XML.

Re: Save/load dataset and table to/from memory stream

Posted: 10.06.2020, 18:09
by papelhigienico3
No one had progress with this feature?

Re: Save/load dataset and table to/from memory stream

Posted: 11.06.2020, 10:03
by marsupilami
Hello papelhigienico3,

it really depends on what you want to do. The Zeos Webservice Server, implemented for Zeos 7.3 does something like this. But saving and restoring a dataset usually ist not all that is to this. So - what do you want to do once you can save and load datasets?

Best regards,

Jan