Skip to content

EF.DB.ODAC

Devart ODAC-based database access layer (Oracle only).

This unit provides an alternative Oracle back-end based on Devart's Oracle Data Access Components (ODAC), for sites that own an ODAC license and prefer it over the OCI/FireDAC path. It does NOT replace EF.DB.FD: Oracle via FireDAC (DriverID = Ora) keeps working exactly as before and remains the default option for sites without ODAC.

Because ODAC is a third-party commercial library, this unit is NOT part of KittoXCore.dpk (which must compile with a plain Delphi install). To enable the 'ODAC' adapter in an application, add EF.DB.ODAC to the application's UseKitto.pas (or project uses clause) and add the ODAC library path to the project search path. Referencing the unit is enough: the adapter self-registers in the initialization section with the ClassId 'ODAC'.

Config.yaml example: <code> ODAC_Oracle: ODAC Connection:

EZ Connect string: host:port/service_name (Oracle XE 21c PDB = xepdb1)

Server: localhost:1521/xepdb1 User_Name: HELLOKITTO Password: 12345

Direct mode connects over Oracle Net without an installed Oracle

client (requires ODAC Professional). Set to False to use OCI.

Direct: True

Oracle has no native boolean: booleans map to NUMBER(1) (0/1).

Charset: AL32UTF8

ConnectMode: Normal (default), SysDBA or SysOper.

ConnectMode: Normal

Optional: ALTER SESSION SET CURRENT_SCHEMA on connect.

Schema: HELLOKITTO </code>

TEFDBODACParams class

Utility class used to adapt the standard TParams to ODAC's TDAParams.

pascal
procedure AssignValuesTo(const ADestination: TDAParams;

Sets the value 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, applying Oracle-specific type coercions.

TEFDBODACInfo class

Retrieves metadata from an Oracle database through ODAC. The Oracle data dictionary (USER_* views) is queried directly with SQL, so no dependency is placed on ODAC's own metadata provider.

pascal
constructor Create(const AConnection: TOraSession);

Creates the info object bound to the given ODAC session.

pascal
property Connection: TOraSession read FConnection write FConnection;

The ODAC session used to retrieve database metadata.

TEFDBODACConnection class

ODAC implementation of TEFDBConnection (Oracle only), backed by a Devart TOraSession.

pascal
procedure AfterConstruction;

Creates the internal TOraSession.

pascal
destructor Destroy;

Destroys the internal TOraSession.

pascal
function IsOpen: Boolean;

ODAC implementation of TEFDBConnection.IsOpen.

pascal
function ExecuteImmediate(const AStatement: string): Integer;

ODAC implementation of TEFDBConnection.ExecuteImmediate.

pascal
procedure InternalStartTransaction;

ODAC implementation of TEFDBConnection.InternalStartTransaction.

pascal
procedure InternalCommitTransaction;

ODAC implementation of TEFDBConnection.InternalCommitTransaction.

pascal
procedure InternalRollbackTransaction;

ODAC implementation of TEFDBConnection.InternalRollbackTransaction.

pascal
function IsInTransaction: Boolean;

ODAC implementation of TEFDBConnection.IsInTransaction.

pascal
function FetchSequenceGeneratorValue(const ASequenceName: string): Int64;

Fetches the next value of an Oracle sequence generator (sequence.NEXTVAL).

pascal
function GetLastAutoincValue(const ATableName: string = ''): Int64;

Not surfaced by this adapter; Oracle apps should use sequences. Always returns 0.

pascal
function CreateDBCommand: TEFDBCommand;

ODAC implementation of TEFDBConnection.CreateDBCommand.

pascal
function CreateDBQuery: TEFDBQuery;

ODAC implementation of TEFDBConnection.CreateDBQuery.

pascal
function GetConnection: TObject;

Returns the underlying TOraSession instance.

TEFDBODACCommand class

ODAC implementation of TEFDBCommand (statements returning no result set), backed by a TOraSQL.

pascal
procedure AfterConstruction;

Creates the internal TOraSQL and its parameters.

pascal
destructor Destroy;

Destroys the internal TOraSQL and its parameters.

pascal
function Execute: Integer;

ODAC implementation of TEFDBCommand.Execute; returns the number of affected rows.

TEFDBODACQuery class

ODAC implementation of TEFDBQuery (statements returning a result set), backed by a TOraQuery.

pascal
procedure AfterConstruction;

Creates the internal TOraQuery and its parameters.

pascal
destructor Destroy;

Destroys the internal TOraQuery and its parameters.

pascal
function Execute: Integer;

Execute and Open are synonims in this class. Execute always returns 0.

pascal
procedure Open;

ODAC implementation of TEFDBQuery.Open; opens the underlying dataset.

pascal
procedure Close;

ODAC implementation of TEFDBQuery.Close; closes the underlying dataset.

pascal
function IsOpen: Boolean;

ODAC implementation of TEFDBQuery.IsOpen.

TEFDBODACConnectionConfig class

Devart ODAC (Oracle) connection parameters. YAML path: DatabaseRouter/DatabaseName/Connection

TEFDBODACAdapter class

Database adapter that creates ODAC (Oracle) connections. Self-registers with the adapter registry under the ClassId 'ODAC'.

Released under Apache License, Version 2.0.