I have taken to creating queries on the fly instead of having a whole lot of
Utility queries sitting on my screens.
e.g.
procedure DoSomething();
var
qryTemp : TQuery;
begin
qryTemp := TQuery.Create(nil);
qryTemp.DatabaseName := strDatabaseName; // where strDatabaseName is a
global variable naming the alias
qryTemp.SQL.Add('SELECT .... ');
qryTemp.Open;
...
qryTemp.Free;
end;
Is this good or bad programming programming practice. You don't have to
worry about whether you are using a query that should be still open for some
other purpose.
Steve
-----Original Message-----
From: Mark Derricutt [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, 20 June 2001 09:43
To: Multiple recipients of list delphi
Subject: RE: [DUG]: Use of TQuery's
Coincidentally I thought about this last night and am working out a layout
for a simple TDataSetPool component, that I can set to have a maximum
number of datasets, and then just call something like GetDataset, and it'll
return an unused one from the pool.
I've often had a TQuery sitting around that I use for generic on the fly
queries instead of creating/freeing one in the local procedure, but
occasionally get into the case when one event that uses the same TQuery
gets called at the same time as another, and causes problems...
Mark
--On Tuesday, June 19, 2001 2:28 PM +1200 James Low <[EMAIL PROTECTED]>
wrote:
> 3) I have one Utility query which I create odds and sodds queries, such
> as for establishing if records exist/ dont exist etc.
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED]
with body of "unsubscribe delphi"
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED]
with body of "unsubscribe delphi"