Lazarus

Programming => Databases => Topic started by: egsuh on November 05, 2018, 11:41:11 am

Title: [SOLVED] Can I edit TSQLQuery loaded from file or stream?
Post by: egsuh on November 05, 2018, 11:41:11 am
Hi,
As the title says, I cannot edit a TSQLQuery downloaded from web server (via Synapse).

In my Windows application, I could restore the query from SQLQuery1.LoadFromStream(AStream), and do other operations like first, next, and read the content. But I could not edit it (it is readonly, even though I never set it as readonly).

Any good idea on this? I'd like to download a subset of database (Firebird currently), change it, and update them back to the original database.
Title: Re: Can I edit TSQLQuery loaded from file or stream?
Post by: mangakissa on November 05, 2018, 03:30:26 pm
But if you create a stream to load the query on your Windows application, you can also do it with a stream from Synapse.

Why are you using a stream?
Title: Re: Can I edit TSQLQuery loaded from file or stream?
Post by: sash on November 05, 2018, 09:04:05 pm
Since TSQLQuery is a TCustomBufDataset, you can save TSQLQuery to stream/file and then load into TBufDataset, which will be editable (however, if you need to apply changes back to database - it's up to you).

This (TSQLQuery <->Synapse <-> Client with TBufDatasets) is exactly how I'm using it as a 3-tired solution.
Title: Re: Can I edit TSQLQuery loaded from file or stream?
Post by: valdir.marcos on November 06, 2018, 12:15:38 am
As the title says, I cannot edit a TSQLQuery downloaded from web server (via Synapse).

In my Windows application, I could restore the query from SQLQuery1.LoadFromStream(AStream), and do other operations like first, next, and read the content. But I could not edit it (it is readonly, even though I never set it as readonly).

Any good idea on this? I'd like to download a subset of database (Firebird currently), change it, and update them back to the original database.
Have you tried REST Dataware components?

My New Project Lazarus REST/JSON Server/Client
http://forum.lazarus.freepascal.org/index.php/topic,36290.0.html
Title: Re: Can I edit TSQLQuery loaded from file or stream?
Post by: egsuh on November 06, 2018, 02:42:47 am
Quote
you can also do it with a stream from Synapse.

Have you tried REST Dataware components?

Yes. I'm using Synapse, but I'd like to download a dataset from webserver. I just use 'httpsend' from Synapse.
I know there are other technologies like REST or WebService Toolkit, but for now using web server seems the best option, because I may need a web-browser application later. Any suggestions or advises are welcomed.

Quote
Since TSQLQuery is a TCustomBufDataset, you can save TSQLQuery to stream/file and then load into TBufDataset, which will be editable (however, if you need to apply changes back to database - it's up to you).

Oh this is really good news (news? ^^).  Yes.. I can do without any dataset running on client (e.g. using TStrings with fieldname=fielddata) to upload the changed content, but I'm looking for a neater solution and using TBufDataSet seems to be one.  Thank you very much.
TinyPortal © 2005-2018