InterBase¶
InterBase is Embarcadero's lightweight, embeddable SQL database. Trysil's InterBase driver is close to Firebird, but uses InterBase-specific SQL: generators (CREATE GENERATOR / GEN_ID) for sequences and ROWS pagination.
Unit: Trysil.Data.FireDAC.InterBase
Delphi Edition: Community
SQL Dialect 3 required¶
InterBase databases used with Trysil must be created with SQL Dialect 3. Dialect 3 is required for the column types Trysil maps to — BOOLEAN, 64-bit NUMERIC(18,0), and TIMESTAMP.
Trysil does not create databases — provisioning the database (and choosing its dialect) is up to you. The DDL generated by the Trysil Expert for InterBase assumes a Dialect 3 database.
isql creates a Dialect 1 database unless you issue SET SQL DIALECT 3; before CREATE DATABASE; most GUI tools (IBConsole) default to Dialect 3.
Type notes¶
- 64-bit integers (
Int64): InterBase has noBIGINTkeyword (a Firebird extension) — useNUMERIC(18,0). - GUID (
TGUID):CHAR(16) CHARACTER SET OCTETS(16-byte binary). - Boolean: native
BOOLEAN(Dialect 3 only).
Setup¶
uses
Trysil.Data.FireDAC.InterBase;
TTInterBaseConnection.RegisterConnection(
'Main', 'localhost', 'SYSDBA', 'masterkey', 'C:\data\database.ib');
LConnection := TTInterBaseConnection.Create('Main');
try
LContext := TTContext.Create(LConnection);
try
// Use the context...
finally
LContext.Free;
end;
finally
LConnection.Free;
end;
Connection Pooling¶
Enable connection pooling for server applications:
Sequences¶
InterBase uses generators for primary key generation (InterBase has no CREATE SEQUENCE statement — that is a Firebird extension):
The next value is retrieved using GEN_ID:
Map it to the entity:
[TTable('Persons')]
[TSequence('PersonsID')]
type
TPerson = class
strict private
[TPrimaryKey]
[TColumn('ID')]
FID: TTPrimaryKey;
// ...
end;