Save/load dataset and table to/from memory stream

In this forum we will discuss things relating the ZEOSLib 6.6.x stable versions

Moderators: gto, EgonHugeist

Post Reply
JD
Senior Boarder
Senior Boarder
Posts: 53
Joined: 06.09.2009, 18:27

Save/load dataset and table to/from memory stream

Post 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.
trupka
Expert Boarder
Expert Boarder
Posts: 140
Joined: 26.08.2007, 22:10

Post 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?
JD
Senior Boarder
Senior Boarder
Posts: 53
Joined: 06.09.2009, 18:27

Post 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.
trupka
Expert Boarder
Expert Boarder
Posts: 140
Joined: 26.08.2007, 22:10

Post 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.
User avatar
Pitfiend
Senior Boarder
Senior Boarder
Posts: 68
Joined: 12.12.2009, 07:27

Post 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.
JD
Senior Boarder
Senior Boarder
Posts: 53
Joined: 06.09.2009, 18:27

Post 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.
papelhigienico3
Fresh Boarder
Fresh Boarder
Posts: 4
Joined: 23.04.2020, 00:31

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

Post by papelhigienico3 »

No one had progress with this feature?
marsupilami
Platinum Boarder
Platinum Boarder
Posts: 1939
Joined: 17.01.2011, 14:17

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

Post 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
Post Reply