>Would be better to use the singelton type pattern or a function that returns
>the object value, but it first checks if the object exists.

Doing some memory hunting but singleton goes like

Unit Unit1;

interface
uses
   ADOdb;

  function Q:TAdoQuery;

implementation

var
  _Q :TADOQuery;

function Q:TADOQuery;
begin
  // Gets created on first use...
  if _Q=nil then _Q := TADOQuery.Create(nil);
  result := _Q;
end;

finalization
  _Q.Free; // No need to nil it at the end of the application...
end.

--
Aaron Scott-Boddendijk
Jump Productions
(07) 838-3371 Voice
(07) 838-3372 Fax


---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz

Reply via email to