Anybody remember ReportSmith in one of the early releases of Delph (3 maybe) – 
what a nightmare that was, the datasets returned could be so out of date 
because of the speed lag …. Sort of think what you are now talking about is a 
similar issue reinvented!

 

 

From: [email protected] 
<[email protected]> On Behalf Of Stephen Barker
Sent: Thursday, June 16, 2022 6:16 PM
To: NZ Borland Developers Group - Delphi List <[email protected]>
Subject: Re: [DUG] Using Queries

 

Hi, 

I haven't used the standard Delphi TQuery and TTable for many years, but I do 
heavily use a third party product called DBISAM.

DBISAM has the behaviour you describe, and not surprising as it is fully 
TDataset compatible. I'm not sure how its behaviour compares to the standard 
TQuery, but it goes like this:

TDBISAMQuery has a boolean property called RequestLive. For safety it is false 
by default. If set to true before the query is executed it instructs the engine 
to attempt a live query, i.e. the result is effectively a direct view into the 
underlying table data and can be edited as you observed. However if it is 
false, the query result is a copy of the data - it can still be edited but 
changes will be discarded after closing. This is very useful for creating 
complex datasets from multiple tables, calculations, lookups, aggregates etc 
that otherwise couldn't be done with straight SQL. Usually needed for further 
exporting, reporting, API etc and no risk of altering the source data.

Also, in the above there is another boolean property ResultIsLive, so you can 
determine the state of the result set. 

Actually I just checked and the standard TQuery does have a RequestLive 
property also, so it was not just a DBISAM thing.

https://docwiki.embarcadero.com/Libraries/Sydney/en/Bde.DBTables.TQuery.RequestLive
 

cheers 
Steve Barker 

> -----Original Message----- 
> From: Adrian Williams [mailto:[email protected]] 
> Sent: Monday, 13 June 2022 10:05 a.m. 
> To: NZ Borland Developers Group - Delphi List 
> Subject: [DUG] Using Queries 
> 
> Hi all 
> 
> I wonder if someone could clarify something regarding Queries. 
> 
> I understand that if you run a query on a table it returns a  
> subset or 
> snapshot of data from the table based on the SQL statement 
> supplied. (In 
> my Paradox days, a query created an 'ANSWER' table that could be 
> navigated as a table, but was separate from the original data). 
> 
> What I have discovered (more by accident), is that if you 
> edit records 
> in the query data and call  the query's POST method it will post the 
> changes back to original table. Also by using the APPEND and INSERT 
> methods on the query, you can create new records in the base 
> table. What 
> I have been able to ascertain is that the database engine seamlessly 
> creates the SQL code to run UPDATE and INSERT statements to amend the 
> original table in the background. 
> 
> My question is: Is this a 'proper' and acceptable way of updating a 
> table by modifying the Query data? Or is this fraught with danger and 
> bad practice? 
> 
> Appreciate any comments on this. 
> 
> Regards 
> Adrian Williams 
> _______________________________________________ 
> NZ Borland Developers Group - Delphi mailing list 
> Post: [email protected] <mailto:[email protected]>  
> Admin: http://delphi.org.nz/mailman/listinfo/delphi 
> Unsubscribe: send an email to 
> [email protected] 
> <mailto:[email protected]>  with Subject: unsubscribe 
> 

  <http://zjwgp.tsmtpclick.com/tracking/qaR9ZGL0BQH5AmN3AQH4Zwp4ZGx1Zvj.gif> 

_______________________________________________
NZ Borland Developers Group - Delphi mailing list
Post: [email protected]
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to [email protected] with 
Subject: unsubscribe

Reply via email to