FireDAC.Comp.Client.TFDCustomConnection.Temporary
Delphi
property Temporary: Boolean read FTemporary write FTemporary default False;
C++
__property bool Temporary = {read=FTemporary, write=FTemporary, default=0};
Contents
Properties
Type | Visibility | Source | Unit | Parent |
---|---|---|---|---|
property | public | FireDAC.Comp.Client.pas FireDAC.Comp.Client.hpp |
FireDAC.Comp.Client | TFDCustomConnection |
Description
Shows whether a connection object is created on-the-fly (is temporary) and managed automatically, or if it is explicitly created, managed, and freed by the application (is persistent).
Use the Temporary property to determine whether a connection component is created on-the-fly and managed automatically (True value), or is an explicitly created, persistent one, managed and freed by the application (False value).
A temporary connection object is created when a dataset or command has set ConnectionName to the name of the existing connection definition and needs a real connection object to communicate with the DBMS. That happens at Prepare, Open, Execute, ExecSQL, ExecProc calls.
A temporary connection object is freed when the dataset or command is unprepared. An application can keep the temporary connection object for later reusing by setting Temporary to False. After that, the application is responsible for closing the connection when it is no longer needed.
Example
var
oConn: TFDconnection;
...
FDQuery1.ConnectionName := 'Access_Demo';
FDQuery1.Open;
...
oConn := FDManager.FindConnection('Access_Demo');
// here oConn.Temporary = True. The oConn will be destroyed after disconnecting ADQuery1
oConn.Temporary := False;
...
FDQuery1.Disconnect;
// here oConn is alive due to setting oConn.Temporary to False