EF.DB.FD
FireDac-based database access layer.
TEFDBFDParams class
Utility class used to adapt FireDAC's TFDParams to the standard TParams.
procedure AssignValuesTo(const ADestination: TFDParams;Sets the Value property of every parameter in ADestination whose name matches the name of a parameter in the current object to that of the current object's parameter.
TEFDBFDInfo class
Retrieves metadata from a database through FireDAC.
constructor Create(const AConnection: TFDConnection);Creates the metadata reader bound to the given FireDAC connection.
property Connection: TFDConnection read FConnection write FConnection;The FireDAC connection used to read the database metadata.
class procedure AddKeyColumnsInPositionOrder(const ADataSet: TDataSet;Appends to the target lists the column names the open metadata dataset reports, each at the place its COLUMN_POSITION says rather than the place its row happened to arrive in. ADataSet is read from the current record to the end. AReferencedColumnFieldName and ReferencedColumnNames are for a foreign key, which has two lists that come out coupled by position; pass '' and nil for an index. AWhat names the key in the error message.
Public because the two Fetch...Columns methods above are meant to be overridden, and an override needs this to build its lists the same way.
Raises EEFDBError when the positions are not 1..n, each exactly once.
TEFDBFDConnection class
TEFDBConnection implementation over a FireDAC TFDConnection. Applies per-driver connection parameters (MSSQL, FB/IB, Oracle, PostgreSQL, MySQL) and registers a pooled FDManager connection definition so each query can run on its own connection.
property PoolDefName: string read FPoolDefName;Name of the FDManager pooled connection definition. CreateDBQuery uses this to acquire a fresh TFDConnection from the pool, so that each query is isolated and nested rules can iterate datasets without the FireDAC MARS-on-shared-connection issue.
property DriverId: string read GetDriverId;The FireDAC DriverID for this connection (read from the Connection/DriverID config: e.g. MSSQL, FB, IB, Ora, PG, MySQL).
procedure AfterConstruction;Creates the underlying TFDConnection (login prompt disabled) and the connection-string list.
destructor Destroy;Frees the underlying TFDConnection and the connection-string list.
function IsOpen: Boolean;Returns True if the underlying TFDConnection is connected.
function ExecuteImmediate(const AStatement: string): Integer;Executes the statement via TFDConnection.ExecSQL and returns the number of affected rows; wraps errors in EEFDBError.
procedure InternalStartTransaction;Starts a transaction on the underlying TFDConnection.
procedure InternalCommitTransaction;Commits the current transaction on the underlying TFDConnection.
procedure InternalRollbackTransaction;Rolls back the current transaction on the underlying TFDConnection.
function IsInTransaction: Boolean;Returns True if the underlying TFDConnection is in a transaction.
function FetchSequenceGeneratorValue(const ASequenceName: string): Int64;Sequence generators are not currently supported; always returns 0.
function GetLastAutoincValue(const ATableName: string = ''): Int64;Auto-inc value retrieval is not currently supported; always returns 0.
function CreateDBCommand: TEFDBCommand;Creates a TEFDBFDCommand linked to this connection.
function CreateDBQuery: TEFDBQuery;Creates a query (of GetQueryClass) linked to this connection.
function GetConnection: TObject;Returns the underlying FireDAC TFDConnection object.
TEFDBFDCommand class
TEFDBCommand implementation wrapping a FireDAC TFDQuery, used to execute statements that do not return a dataset.
procedure AfterConstruction;Creates the internal TFDQuery and parameter list.
destructor Destroy;Frees the internal TFDQuery and parameter list.
function Execute: Integer;Executes the command and returns the number of affected rows; wraps errors in EEFDBError.
TEFDBFDQuery class
TEFDBQuery implementation wrapping a FireDAC TFDQuery. Outside a transaction it acquires a private pooled TFDConnection so concurrent queries stay isolated; inside a transaction it shares the parent connection.
procedure AfterConstruction;Creates the internal TFDQuery and parameter list.
destructor Destroy;Frees the internal TFDQuery, the owned connection and the parameter list.
function Execute: Integer;Execute and Open are synonims in this class. Execute always returns 0.
procedure Open;Opens the underlying TFDQuery, expanding macros and binding parameters; wraps errors in EEFDBError.
procedure Close;Closes the underlying TFDQuery.
function IsOpen: Boolean;Returns True if the underlying TFDQuery is active.
TEFDBFDConnectionConfig class
FireDAC connection parameters. YAML path: DatabaseRouter/DatabaseName/Connection
TEFDBFDAdapter class
Data access adapter that creates FireDAC-based connections. Registered in the adapter registry under the id 'FD'.
Routines
function GetUseBooleanFields(ADriverID: string) : boolean;Returns True if the given FireDAC DriverID binds boolean values as native boolean parameters (True for MSSQL and PG), False when they must be converted to integers (FB, IB, Ora).
