Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2019-06

How to do insert/update and select on database

4 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Darius Blaszyk

Hi,

I'm new to database programming with Lazarus. So hence possible a couple of obvious questions!

I would like to do inserts, selects, and updates on a single SQLite database. I am now using multiple SQLQuery components with all their own queries. Is this the way it should work?

After a commit, the SQLQuery that populates the DBGrid is closed. Is this supposed to happen? The transaction component is set to caCommitRetaining. I believe I read somewhere that it should remain open in that case.

TIA!

Darius
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20190602/f95abf4f/attachment.html>

Reply by email

Michael Van Canneyt
to Darius Blaszyk
Darius Blaszyk wrote 8 lines
Hi, I'm new to database programming with Lazarus. So hence possible a couple of obvious questions! I would like to do inserts, selects, and updates on a single SQLite database. I am now using multiple SQLQuery components with all their own queries. Is this the way it should work?

It is one way to work. I usually do the same.

After a commit, the SQLQuery that populates the DBGrid is closed. Is this supposed to happen? The transaction component is set to caCommitRetaining. I believe I read somewhere that it should remain open in that case.

No, this is not what it means. You should avoid caCommitRetaining.

There is an option on TSQLQuery, sqoKeepOpenOnCommit

Documented here:

https://docs.freepascal.org/docs-html/current/fcl/sqldb/tsqlquery.options.html

It does what you want.

Michael.

Reply by email

Darius Blaszyk
to Michael Van Canneyt

Op zo 2 jun. 2019 om 22:55 schreef Michael Van Canneyt via lazarus <

Show quoted text 33 lines
On Sun, 2 Jun 2019, Darius Blaszyk via lazarus wrote: > Hi, > > I'm new to database programming with Lazarus. So hence possible a couple of > obvious questions! > > I would like to do inserts, selects, and updates on a single SQLite > database. I am now using multiple SQLQuery components with all their own > queries. Is this the way it should work? It is one way to work. I usually do the same. > After a commit, the SQLQuery that populates the DBGrid is closed. Is this > supposed to happen? The transaction component is set to caCommitRetaining. > I believe I read somewhere that it should remain open in that case. No, this is not what it means. You should avoid caCommitRetaining. There is an option on TSQLQuery, sqoKeepOpenOnCommit Documented here: https://docs.freepascal.org/docs-html/current/fcl/sqldb/tsqlquery.options.html It does what you want.

Thanks. As always good and to the point advice!

Regards, Darius
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20190603/0192f240/attachment.html>

Reply by email

Unknown author
to Darius Blaszyk
Darius Blaszyk wrote
Thanks. As always good and to the point advice!

AKA "Bikini format" - short and to the point -=B-)

NOTE: No off-list assistance is given without prior approval. *Please keep mailing list traffic on the list unless* *a signed and pre-paid contract is in effect with us.*

Reply by email