* * *

Author Topic: [SOLVED] Can I edit TSQLQuery loaded from file or stream?  (Read 900 times)

egsuh

  • Full Member
  • ***
  • Posts: 171
[SOLVED] Can I edit TSQLQuery loaded from file or stream?
« 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.
« Last Edit: November 07, 2018, 09:27:38 am by egsuh »

mangakissa

  • Hero Member
  • *****
  • Posts: 840
Re: Can I edit TSQLQuery loaded from file or stream?
« Reply #1 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?
Lazarus 1.84 (32b) / FPC 3.0.4
Windows 10

sash

  • Full Member
  • ***
  • Posts: 116
Re: Can I edit TSQLQuery loaded from file or stream?
« Reply #2 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.
Lazarus 1.8.4 Unversioned directory FPC 3.0.4 x86_64-linux-gtk2

valdir.marcos

  • Hero Member
  • *****
  • Posts: 524
Re: Can I edit TSQLQuery loaded from file or stream?
« Reply #3 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

egsuh

  • Full Member
  • ***
  • Posts: 171
Re: Can I edit TSQLQuery loaded from file or stream?
« Reply #4 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.

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus