Recent

Author Topic: Loading streams into a dataset  (Read 3130 times)

JD

  • Hero Member
  • *****
  • Posts: 1848
Loading streams into a dataset
« on: April 01, 2015, 06:17:57 pm »
Hi there everyone,

I have a problem with loading streams into a dataset. I use sqldb server side & I had earlier saved the dataset to a stream using SaveToStream.

On the client side, I created a TSQLQuery instance dynamically intending to use LoadFromStream to read the dataset sent by the server. However I abandonned it because the query instance required a database file client side.

So I changed it to a ZMQueryDataset instance but that gives me an error saying "Missing (compatible) dataset, cannot open". I just want to load it into memory & then copy it into the controls on the client side GUI. Is this possible or should I change my strategy?

Thanks a lot,

JD
Windows - Lazarus 2.1/FPC 3.2 (built using fpcupdeluxe),
Linux Mint - Lazarus 2.1/FPC 3.2 (built using fpcupdeluxe)

mORMot; Zeos 8; SQLite, PostgreSQL & MariaDB; VirtualTreeView

LacaK

  • Hero Member
  • *****
  • Posts: 691
Re: Loading streams into a dataset
« Reply #1 on: April 01, 2015, 07:37:37 pm »
On server side do you use TSQLQuery.SaveToStream ?
If so, then on client you can use TBufDataset, because TSQLQuery is descendant of TBufDataSet.
And TBufDataSet does not require Database as it is client in memory dataset.

JD

  • Hero Member
  • *****
  • Posts: 1848
Re: Loading streams into a dataset
« Reply #2 on: April 01, 2015, 11:01:10 pm »
On server side do you use TSQLQuery.SaveToStream ?
If so, then on client you can use TBufDataset, because TSQLQuery is descendant of TBufDataSet.
And TBufDataSet does not require Database as it is client in memory dataset.
Yes I used TSQLQuery.SaveToStream on the server side. Using TBufDataset on the client side gives exactly the same error which is to be expected because TBufDataset is the ancestor of ZMQueryDataset.
Windows - Lazarus 2.1/FPC 3.2 (built using fpcupdeluxe),
Linux Mint - Lazarus 2.1/FPC 3.2 (built using fpcupdeluxe)

mORMot; Zeos 8; SQLite, PostgreSQL & MariaDB; VirtualTreeView

LacaK

  • Hero Member
  • *****
  • Posts: 691
Re: Loading streams into a dataset
« Reply #3 on: April 02, 2015, 11:44:34 am »
Strange!
In same version of FPC binary format should be identical so Save/Load should work.
Can you post here small compilabe project which shows error ?

JD

  • Hero Member
  • *****
  • Posts: 1848
Re: Loading streams into a dataset
« Reply #4 on: April 03, 2015, 10:31:54 am »
Strange!
In same version of FPC binary format should be identical so Save/Load should work.
Can you post here small compilabe project which shows error ?

I've decided to change the strategy. I've gone back to using my tried & trusted TCollections to send/receive data.

Thanks
Windows - Lazarus 2.1/FPC 3.2 (built using fpcupdeluxe),
Linux Mint - Lazarus 2.1/FPC 3.2 (built using fpcupdeluxe)

mORMot; Zeos 8; SQLite, PostgreSQL & MariaDB; VirtualTreeView

 

TinyPortal © 2005-2018