Recent

Author Topic: How to add records to a TSQLQuery without inserting them in the database  (Read 1010 times)

Jvan

  • Full Member
  • ***
  • Posts: 181
Is it possible?
« Last Edit: May 29, 2021, 12:17:01 am by Jvan »

lucamar

  • Hero Member
  • *****
  • Posts: 4167
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 ...
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

Jvan

  • Full Member
  • ***
  • Posts: 181
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.

lucamar

  • Hero Member
  • *****
  • Posts: 4167
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 ... :-[
« Last Edit: May 29, 2021, 01:10:15 am by lucamar »
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

 

TinyPortal © 2005-2018