Lazarus

Programming => Databases => Topic started by: Jvan on May 29, 2021, 12:14:55 am

Title: How to add records to a TSQLQuery without inserting them in the database
Post by: Jvan on May 29, 2021, 12:14:55 am
Is it possible?
Title: Re: How to add records to a TSQLQuery without inserting them in the database
Post by: lucamar on May 29, 2021, 12:51:16 am
In theory yes: as long as you don't commit the transaction they should be kept just in the (updated) query dataset, waiting to be committed to the database.

However you should test it thoroughly, just in case ...
Title: Re: How to add records to a TSQLQuery without inserting them in the database
Post by: Jvan on May 29, 2021, 12:58:06 am
In theory yes: as long as you don't commit the transaction they should be kept just in the (updated) query dataset, waiting to be committed to the database.

However you should test it thoroughly, just in case ...


An example, please.
Title: Re: How to add records to a TSQLQuery without inserting them in the database
Post by: lucamar on May 29, 2021, 01:08:07 am
An example, please.

You'll have to wait till tomorrow; I'm off to bed (it's 1 a.m. here ;)).

Or you could try yourself; the normal flow when adding/deleting/modifying a record is:
Code: Pascal  [Select][+][-]
  1. SQLQuery.Update;
  2. SQLTransaction.Commit;

Just leave out the "SQLTransaction.Commit" and the SQLQuery should update itself but not reflect the changes to the database.

Note, though, that I've never tried anything like this, so I might be completely wrong ... :-[
TinyPortal © 2005-2018