Components for Delphi (IBX) - Interface Specification
Description
Delphi's core database functionality is accomplished by two groups of components, namely DataAccess components and DataAware components. DataAccess components encapsulate the interface to a database server. DataAware components are user interface components that are data aware and so can interface with data access components.
DataAccess architecture is quite structured and cleanly abstracted to enable creating custom non-BDE DataAccess components. Such a custom DataAccess mechanism continues to interface with all the standard DataAware components. IBDAC provides a custom DataAccess component set for native InterBase access.
The Interface specifcation document specifies the interface and documents them for all the Components and Objects in IBDAC. The Interface is complete and self-contained, whereas the documentation part only covers the parts that differ from Standard Delphi components.
Interface
unit IBIntf;
interface
type
TIBDatabase=class(TComponent)
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure CheckActive;
procedure CheckInactive;
procedure Close;
procedure CreateDatabase;
property DBParamByDPB[const Idx: Integer]: String
read GetDBParamByDPB write SetDBParamByDPB;
procedure DropDatabase;
procedure ForceClose;
function IndexOfDBConst(st: String): Integer;
procedure Open;
function TestConnected: Boolean;
property DataSetCount: Integer read GetDataSetCount;
property DataSets[Index: Integer]: TIBBase read
GetDataSet;
property Handle: TISC_DB_HANDLE read FHandle;
property TransactionCount: Integer read
GetTransactionCount;
property Transactions[Index: Integer]:
TIBTransaction read GetTransaction;
published
property Connected: Boolean read GetConnected write
SetConnected default False;
property DatabaseName: string read FDBName write
SetDatabaseName;
property Params: TStrings read FDBParams write
SetDBParams;
procedure ApplyUpdates(const DataSets: array of
TIBCustomDataSet);
procedure CloseDataSets;
property TraceFlags: TTraceFlags read FtraceFlags
write SetTraceFlags;
property OnLogin: TNotifyEvent read FOnLogin write
FOnLogin;
property DefaultTransaction: TIBTransaction read
FDefaultTransaction write SetDefaultTransaction;
property IdleTimer: Integer read GetIdleTimer write
SetIdleTimer;
property LoginPrompt: Boolean read FLoginPrompt write
FLoginPrompt default True;
property OnConnect: TNotifyEvent read FOnConnect
write FOnConnect;
property OnIdleTimer: TNotifyEvent read FOnIdleTimer
write FOnIdleTimer;
property SQLDialect : Integer read GetSQLDialect
write SetSQLDialect;
property DBSQLDialect : Integer read FDBSQLDialect;
end;
TIBTransaction=class(TComponent)
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure Commit;
procedure CommitRetaining;
procedure Rollback;
procedure StartTransaction;
procedure CheckInTransaction;
procedure CheckNotInTransaction;
property DatabaseCount: Integer read
GetDatabaseCount;
property Databases[Index: Integer]: TIBDatabase read
GetDatabase;
property DataSetCount: Integer read GetDataSetCount;
property DataSets[Index: Integer]: TIBBase read
GetDataSet;
property Handle: TISC_TR_HANDLE read FHandle;
property InTransaction: Boolean read
GetInTransaction;
property TPB: PChar read FTPB;
property TPBLength: Short read FTPBLength;
published
property Active: Boolean read GetInTransaction write
SetActive;
property IdleTimer: Integer read GetIdleTimer write
SetIdleTimer default 0;
property TimeoutAction: TTransactionAction read
FTimeoutAction write FTimeoutAction;
property Params: TStrings read FTRParams write
SetTRParams;
property OnIdleTimer: TNotifyEvent read FOnIdleTimer
write FOnIdleTimer;
end;
TIBCustomDataSet=class(TDataset)
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure ApplyUpdates;
procedure ExternalFileInput(InputObject:
TIBExternalFile);
procedure ExternalFileOutput(OutputObject:
TIBExternalFile);
function CachedUpdateStatus: TCachedUpdateStatus;
procedure CancelUpdates;
procedure FetchAll;
function LocateNext(const KeyFields: String;
const KeyValues: Variant; Options: TLocateOptions): Boolean;
procedure RevertRecord;
procedure Undelete;
function CompareBookmarks(Bookmark1, Bookmark2:
TBookmark): Integer; override;
function CreateBlobStream(Field: TField; Mode:
TBlobStreamMode): TStream; override;
function GetCurrentRecord(Buffer: PChar): Boolean;
override;
function GetFieldData(Field: TField; Buffer:
Pointer): Boolean; overload; override;
function GetFieldData(FieldNo: Integer; Buffer:
Pointer): Boolean; overload; override;
function Locate(const KeyFields: String; const
KeyValues: Variant; Options: TLocateOptions): Boolean; override;
function Lookup(const KeyFields: string; const
KeyValues: Variant; const ResultFields: string): Variant; override;
function UpdateStatus: TUpdateStatus; override;
procedure GetProviderAttributes(List: TList);
override;
property DBHandle: PISC_DB_HANDLE read GetDBHandle;
property TRHandle: PISC_TR_HANDLE read GetTRHandle;
property Provider: IProvider read GetProvider;
property UpdateObject: TIBDataSetUpdateObject read
FUpdateObject write SetUpdateObject;
property UpdatesPending: Boolean read UpdatesPending;
property UpdateRecordTypes: TIBUpdateRecordTypes read
FupdateRecordTypes write SetUpdateRecordTypes;
published
property Database: TIBDatabase read GetDatabase write
SetDatabase;
property Transaction: TIBTransaction read
GetTransaction write SetTransaction;
property Active;
property AutoCalcFields;
property CachedUpdates: Boolean read FCachedUpdates
write SetCachedUpdates;
property AfterCancel;
property AfterClose;
property AfterDelete;
property AfterEdit;
property AfterInsert;
property AfterOpen;
property AfterPost;
property AfterScroll;
property BeforeCancel;
property BeforeClose;
property BeforeDelete;
property BeforeEdit;
property BeforeInsert;
property BeforeOpen;
property BeforePost;
property BeforeScroll;
property OnCalcFields;
property OnDeleteError;
property OnEditError;
property OnNewRecord;
property OnPostError;
property OnUpdateError: TIBUpdateErrorEvent read
FonUpdateError write FOnUpdateError;
property OnUpdateRecord: TIBUpdateRecordEvent read
FonUpdateRecord write FOnUpdateRecord;
end;
TIBMasterDataLink=class(TDetailDataLink)
public
constructor Create(DataSet: TDataSet);
destructor Destroy; override;
property FieldNames: string read FFieldNames write
SetFieldNames;
property Fields: TList read FFields;
property OnMasterChange: TNotifyEvent read
FOnMasterChange write FOnMasterChange;
property OnMasterDisable: TNotifyEvent read
FOnMasterDisable write FOnMasterDisable;
end;
TIBTable=class(TIBCustomDataSet)
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
function BatchMove(ASource: TIBCustomDataSet; AMode:
TBatchMode): Longint;
procedure AddIndex(const Name, Fields: string;
Options: TIndexOptions; const DescFields: string='');
procedure ApplyRange;
procedure CancelRange;
procedure CreateTable;
procedure DeleteIndex(const Name: string);
procedure DeleteTable;
procedure EditKey;
procedure EditRangeEnd;
procedure EditRangeStart;
procedure EmptyTable;
function FindKey(const KeyValues: array of const):
Boolean;
procedure FindNearest(const KeyValues: array of
const);
procedure GetDetailLinkFields(MasterFields,
DetailFields: TList); override;
procedure GetIndexNames(List: TStrings);
procedure GetProviderAttributes(List: Tlist);
override;
procedure GotoCurrent(Table: TIBTable);
function GotoKey: Boolean;
procedure GotoNearest;
procedure SetKey;
procedure SetRange(const StartValues, EndValues:
array of const);
procedure SetRangeEnd;
procedure SetRangeStart;
property Exists: Boolean read GetExists;
property IndexFieldCount: Integer read
GetIndexFieldCount;
property IndexFields[Index: Integer]: TField read
GetIndexField write SetIndexField;
property KeyExclusive: Boolean read GetKeyExclusive
write SetKeyExclusive;
property KeyFieldCount: Integer read GetKeyFieldCount
write SetKeyFieldCount;
property NameList: TStrings read GetNameList;
published
property Constraints stored ConstraintsStored;
property DefaultIndex: Boolean read FDefaultIndex
write FDefaultIndex default True;
property FieldDefs stored FieldDefsStored;
property IndexDefs: TIndexDefs read FIndexDefs write
SetIndexDefs stored IndexDefsStored;
property IndexFieldNames: string read
GetIndexFieldNames write SetIndexFieldNames;
property IndexName: string read GetIndexName write
SetIndexName;
property MasterFields: string read GetMasterFields
write SetMasterFields;
property MasterSource: TDataSource read GetDataSource
write SetDataSource;
property ReadOnly: Boolean read FReadOnly write
SetReadOnly default False;
property StoreDefs: Boolean read FStoreDefs write
FStoreDefs default False;
property TableName: String read FTableName write
SetTableName;
property UpdateMode;
property UpdateObject;
property TableComponentOptions:
TIBTableComponentOptions read FTableComponentOptions write SetTableComponentOptions default [];
end;
TIBQuery=class(TIBCustomDataSet)
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure ExecSQL;
procedure GetDetailLinkFields(MasterFields,
DetailFields: TList); override;
procedure GetProviderAttributes(List: TList);
override;
function ParamByName(const Value: string): TParam;
procedure Prepare;
procedure UnPrepare;
property Prepared: Boolean read FPrepared write
SetPrepare;
property ParamCount: Word read GetParamsCount;
property Text: string read FText;
property RowsAffected: Integer read GetRowsAffected;
published
property Constrained: Boolean read FConstrained write
FConstrained default False;
property Constraints stored ConstraintsStored;
property ParamCheck: Boolean read FParamCheck write
FParamCheck default True;
property RequestLive: Boolean read FRequestLive write
FRequestLive default False;
property SQL: TStrings read FSQL write SetQuery;
property Params: TParams read FParams write
SetParamsList stored False;
property UniDirectional: Boolean read FUniDirectional
write FUniDirectional default False;
property UpdateMode;
property UpdateObject;
end;
TIBUpdateSQL=class(TIBDataSetUpdateObject)
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure Apply(UpdateKind: TUpdateKind); override;
procedure ExecSQL(UpdateKind: TUpdateKind);
procedure SetParams(UpdateKind: TUpdateKind);
property DataSet;
property Query[UpdateKind: TUpdateKind]: TIBQuery
read GetQuery;
property SQL[UpdateKind: TUpdateKind]: TStrings read
GetSQL write SetSQL;
published
property ModifySQL: TStrings index 0 read GetSQLIndex
write SetSQLIndex;
property InsertSQL: TStrings index 1 read GetSQLIndex
write SetSQLIndex;
property DeleteSQL: TStrings index 2 read GetSQLIndex
write SetSQLIndex;
end;
TIBProvider=class(TDataSetProvider)
public
constructor Create(AOwner: TComponent); override;
function ApplyUpdates(var Delta: OleVariant;
MaxErrors: Integer; out ErrorCount: Integer): OleVariant; override;
function FetchData(const Packet: OleVariant):
OleVariant; override;
procedure Reset(MetaData: WordBool); override;
procedure SetParams(Values: OleVariant); override;
published
property DataSet: TIBCustomDataSet read GetDataSet
write SetDataSet;
property ResolveToDataSet: Boolean read
FResolveToDataSet write SetResolveToDataSet default False;
end;
TIBBlobStream=class(TStream)
public
constructor Create;
destructor Destroy; override;
function Call(ErrCode: ISC_STATUS; RaiseError:
Boolean): ISC_STATUS;
procedure CheckReadable;
procedure CheckWritable;
procedure Finalize;
procedure LoadFromFile(Filename: String);
procedure LoadFromStream(Stream: TStream);
function Read(var Buffer; Count: Longint): Longint;
override;
procedure SaveToFile(Filename: String);
procedure SaveToStream(Stream: TStream);
function Seek(Offset: Longint; Origin: Word):
Longint; override;
procedure SetSize(NewSize: Long); override;
procedure Truncate;
function Write(const Buffer; Count: Longint):
Longint; override;
property Handle: TISC_BLOB_HANDLE read FHandle;
property BlobID: TISC_QUAD read FBlobID write
SetBlobID;
property BlobMaxSegmentSize: Long read
FBlobMaxSegmentSize;
property BlobNumSegments: Long read FBlobNumSegments;
property BlobSize: Long read FBlobSize;
property BlobType: Short read FBlobType;
property Database: TIBDatabase read GetDatabase write
SetDatabase;
property DBHandle: PISC_DB_HANDLE read GetDBHandle;
property Mode: TBlobStreamMode read FMode write
SetMode;
property Transaction: TIBTransaction read
GetTransaction write SetTransaction;
property TRHandle: PISC_TR_HANDLE read GetTRHandle;
end;
TIBDataSet=class(TIBCustomDataSet)
public
procedure Prepare;
property DynamicSQLParams;
property Prepared : Boolean read GetPrepared;
property QDelete;
property QInsert;
property QRefresh;
property QSelect;
property QUpdate;
property StatementType;
property UpdatesPending;
property Bof;
property Bookmark;
property DefaultFields;
property Designer;
property Eof;
property FieldCount;
property FieldDefs;
property Fields;
property FieldValues;
property Found;
property Modified;
property RecordCount;
property State;
published
property CachedUpdates;
property DeleteSQL;
property InsertSQL;
property RefreshSQL;
property SelectSQL;
property UpdateRecordTypes;
property UpdateSQL;
property DatabaseDisconnecting;
property DatabaseDisconnected;
property DatabaseFree;
property OnUpdateError;
property OnUpdateRecord;
property TransactionEnding;
property TransactionEnded;
property TransactionFree;
property DataSource read GetDataSource write
SetDataSource;
end;
TIBBase=class(TObject)
public
constructor Create(AOwner: TObject);
destructor Destroy; override;
procedure CheckDatabase; virtual;
procedure CheckTransaction; virtual;
OnDatabaseDisconnecting: TNotifyEvent;
OnDatabaseDisconnected: TNotifyEvent;
OnDatabaseFree: TNotifyEvent;
OnTransactionEnding: TNotifyEvent;
OnTransactionEnded: TNotifyEvent;
OnTransactionFree: TNotifyEvent;
property Database: TIBDatabase read Fdatabase
write SetDatabase;
property DBHandle: PISC_DB_HANDLE read GetDBHandle;
property Owner: TObject read FOwner;
property TRHandle: PISC_TR_HANDLE read GetTRHandle;
property Transaction: TIBTransaction read Transaction
write SetTransaction;
end;
TIBXSQLVAR=class(TObject)
public
constructor Create(Query: TIBDynamicSQL);
procedure LoadFromFile(const FileName: String);
procedure LoadFromStream(Stream: TStream);
procedure SaveToFile(const FileName: String);
procedure SaveToStream(Stream: TStream);
property AsDateTime: TDateTime read GetAsDateTime
write SetAsDateTime;
property AsDouble: Double read GetAsDouble write
SetAsDouble;
property AsFloat: Float read GetAsFloat write
SetAsFloat;
property AsCurrency: Currency read GetAsCurrency
write SetAsCurrency;
property AsInt64: Int64 read GetAsInt64 write
SetAsInt64;
property AsInteger: Integer read GetAsLong write
SetAsLong;
property AsLong: Long read GetAsLong write SetAsLong;
property AsPointer: Pointer read GetAsPointer write
SetAsPointer;
property AsQuad: TISC_QUAD read GetAsQuad write
SetAsQuad;
property AsShort: Short read GetAsShort write
SetAsShort;
property AsString: String read GetAsString write
SetAsString;
property AsVariant: Variant read GetAsVariant write
SetAsVariant;
property AsXSQLVAR: PXSQLVAR read GetAsXSQLVAR write
SetAsXSQLVAR;
property Data: PXSQLVAR read FXSQLVAR write FXSQLVAR;
property IsNull: Boolean read GetIsNull write
SetIsNull;
property IsNullable: Boolean read GetIsNullable write
SetIsNullable;
property Index: Integer read FIndex;
property Modified: Boolean read FModified write
FModified;
property Name: String read FName;
property Size: Integer read GetSize;
property SQLType: Integer read GetSQLType;
property Value: Variant read GetAsVariant write
SetAsVariant;
property VariantFalse: Variant read FVariantFalse
write FVariantFalse;
property VariantTrue: Variant read FVariantFalse
write FVariantTrue;
end;
TIBXSQLDA=class(TObject)
public
constructor Create(Query: TIBDynamicSQL);
destructor Destroy; override;
procedure AddName(FieldName: String; Idx: Integer);
property AsXSQLDA: PXSQLDA read GetXSQLDA;
property ByName[Idx: String]: TIBXSQLVAR read
GetXSQLVARByName;
property Count: Integer read FCount write SetCount;
property Modified: Boolean read GetModified;
property Names: String read GetNames;
property RecordSize: Integer read GetRecordSize;
property Vars[Idx: Integer]: TIBXSQLVAR read
GetXSQLVAR; default;
end;
TIBDynamicSQL=class(TComponent)
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure ExternalFileInput(InputObject:
TIBExternalFile);
procedure ExternalFileOutput(OutputObject:
TIBExternalFile);
function Call(ErrCode: ISC_STATUS; RaiseError:
Boolean): ISC_STATUS;
procedure CheckClosed;
procedure CheckOpen;
procedure CheckValidStatement;
procedure Close;
function Current: TIBXSQLDA;
procedure ExecQuery;
procedure FreeHandle;
function Next: TIBXSQLDA;
procedure Prepare;
property BOF: Boolean read FBOF;
property DBHandle: PISC_DB_HANDLE read GetDBHandle;
property EOF: Boolean read GetEOF;
property FieldByName[FieldName: String]: TIBXSQLVAR
read GetFieldByName;
property Fields[const Idx: Integer]: TIBXSQLVAR read
GetFields;
property FieldIndex[FieldName: String]: Integer read
GetFieldIndex;
property Open: Boolean read FOpen;
property Params: TIBXSQLDA read GetSQLParams;
property Plan: String read GetPlan;
property Prepared: Boolean read FPrepared;
property RecordCount: Integer read GetRecordCount;
property SQLType: TIBSQLTypes read FSQLType;
property TRHandle: PISC_TR_HANDLE read GetTRHandle;
property CanModify: Boolean read FCanModify;
property Handle: TISC_STMT_HANDLE read FHandle;
published
property Database: TIBDatabase read GetDatabase write
SetDatabase;
property GoToFirstRecordOnExecute: Boolean read
FGoToFirstRecordOnExecute write FgoToFirstRecordOnExecute default True;
property ParamCheck: Boolean read FParamCheck write
FParamCheck;
property SQL: TStrings read FSQL write SetSQL;
property Transaction: TIBTransaction read
GetTransaction write SetTransaction;
property OnSQLChanging: TNotifyEvent read
FOnSQLChanging write FOnSQLChanging;
end;
TIBExternalFile=class(TObject)
protected
FFilename: String;
FColumns: TIBXSQLDA;
FParams: TIBXSQLDA;
public
function Move: Boolean; virtual; abstract;
procedure ReadyFile; virtual; abstract;
property Columns: TIBXSQLDA read FColumns;
property Filename: String read FFilename write FFilename;
property Params: TIBXSQLDA read FParams;
end;
TIBExternalFileOutput=class(TIBExternalFile)
public
function WriteColumns: Boolean; virtual; abstract;
end;
TIBExternalFileInput=class(TIBExternalFile)
public
function ReadParameters: Boolean; virtual; abstract;
end;
TIBOutputDelimitedFile=class(TIBExternalFileOutput)
public
destructor Destroy; override;
procedure ReadyFile; override;
function WriteColumns: Boolean; override;
property ColDelimiter: String read FColDelimiter
write FColDelimiter;
property OutputTitles: Boolean read FOutputTitles
write FOutputTitles;
property RowDelimiter: String read FRowDelimiter write FRowDelimiter;
end;
TIBInputDelimitedFile=class(TIBExternalFileInput)
public
destructor Destroy; override;
function GetColumn(var Col: String): Integer;
function ReadParameters: Boolean; override;
procedure ReadyFile; override;
property ColDelimiter: String read FColDelimiter
write FColDelimiter;
property ReadBlanksAsNull: Boolean read FReadBlanksAsNull
write FReadBlanksAsNull;
property RowDelimiter: String read FRowDelimiter
write FRowDelimiter;
property SkipTitles: Boolean read FSkipTitles write
FSkipTitles;
end;
TIBOutputRawFile=class(TIBExternalFileOutput)
public
destructor Destroy; override;
procedure ReadyFile; override;
function WriteColumns: Boolean; override;
end;
TIBInputRawFile=class(TIBExternalFileInput)
public
destructor Destroy; override;
function ReadParameters: Boolean; override;
procedure ReadyFile; override;
end;
TIBDBInfo=class(TComponent)
public
property DBHandle: PISC_DB_HANDLE read FHandle write
FHandle;
property Allocation: Long read GetAllocation;
property BaseLevel: Long read GetBaseLevel;
property DBFileName: String read GetDBFileName;
property DBSiteName: String read GetDBSiteName;
property DBImplementationNo: Long read
GetDBImplementationNo;
property DBImplementationClass: Long read
GetDBImplementationClass;
property NoReserve: Long read GetNoReserve;
property ODSMinorVersion: Long read
GetODSMinorVersion;
property ODSMajorVersion: Long read
GetODSMajorVersion;
property PageSize: Long read GetPageSize;
property Version: String read GetVersion;
property CurrentMemory: Long read GetCurrentMemory;
property ForcedWrites: Long read GetForcedWrites;
property MaxMemory: Long read GetMaxMemory;
property NumBuffers: Long read GetNumBuffers;
property SweepInterval: Long read GetSweepInterval;
property UserNames: TStringList read GetUserNames;
property Fetches: Long read GetFetches;
property Marks: Long read GetMarks;
property Reads: Long read GetReads;
property Writes: Long read GetWrites;
property BackoutCount: Long read GetBackoutCount;
property DeleteCount: Long read GetDeleteCount;
property ExpungeCount: Long read GetExpungeCount;
property InsertCount: Long read GetInsertCount;
property PurgeCount: Long read GetPurgeCount;
property ReadIdxCount: Long read GetReadIdxCount;
property ReadSeqCount: Long read GetReadSeqCount;
property UpdateCount: Long read GetUpdateCount;
property LogFile: Long read GetLogFile;
property CurLogFileName: String read
GetCurLogFileName;
property CurLogPartitionOffset: Long read
GetCurLogPartitionOffset;
property NumWALBuffers: Long read GetNumWALBuffers;
property WALBufferSize: Long read GetWALBufferSize;
property WALCheckpointLength: Long read
GetWALCheckpointLength;
property WALCurCheckpointInterval: Long read
GetWALCurCheckpointInterval;
property WALPrvCheckpointFilename: String read
GetWALPrvCheckpointFilename;
property WALPrvCheckpointPartOffset: Long read
GetWALPrvCheckpointPartOffset;
property WALGroupCommitWaitUSecs: Long read
GetWALGroupCommitWaitUSecs;
property WALNumIO: Long read GetWALNumIO;
property WALAverageIOSize: Long read
GetWALAverageIOSize;
property WALNumCommits: Long read GetWALNumCommits;
property WALAverageGroupCommitSize: Long read
GetWALAverageGroupCommitSize;
end;
implementation
end.
Documentation
TIBDatabase
Properties
String DBName
This is the database name. To connect to a local InterBase database, this is just the file name. To connect to an InterBase database on a remote server using TCP/IP, this is
<server name>:<file name on server>
To connect to an InterBase database on a remote server using NetBeui, this is
\<server name
String DBParamByDPB
This property allows the developer to inspect and set DPB parameters without looking at the DBParams string list.
For example DBParamByDPB[isc_dpb_user_name] is used to set and inspect the user name.
TStrings DBParams
When trying to establish a connection to a database, the database parameters are a textual representation of the parameters you want to pass to the InterBase server in order to establish the connection. For example:
isc_dpb_user_name=SYSDBA
isc_dpb_password=masterkey
isc_dpb_role=whatever
See the InterBase API Guide for further documentation on database
parameters. For some understanding of how database parameter buffers are
generated in IBDAC, take a look at the GenerateDPB
< procedure
defined in IB.pas.
When trying to create a database, DBParams contains the parameters part of
the InterBase CREATE DATABASE
DDL command. For example, to
create a database as shown in the below DDL example,
CREATE DATABASE c:testexampleDB.gdb
USER "SYSDBA"
PASSWORD "masterkey"
PAGE_SIZE 4096
You would set the DBName property to c:testexampleDB.gdb, and set DBParams to:
USER "SYSDBA"
PASSWORD "masterkey"
PAGE_SIZE 4096
Then, invoke the CreateDatabase
< method.
Public, read-only: TISC_DB_HANDLE Handle
The InterBase database handle. This is used in all calls to the InterBase API.
TIBTransaction DefaultTransaction
IBDAC does not mandate that a single database connection manage a single transaction; however, it is very convenient to let a database specify a primary transaction to be used.
Integer IdleTimer
By specifying a timeout, the developer can indicate how long the database should wait before automatically terminating the connection.
Public, read-only: Integer TransactionCount
How many transactions are attached to this database?
Public, read-only: TIBTransaction Transaction
Given an integer index, it returns the TIBTransaction at the given index. This is used internally for broadcasting important messages to attached components. (For example, if the database is disconnecting, all attached data sets must be told).
Methods
Procedure: CheckActive
Procedure: CheckInactive
Procedure: ForceClose
Ask (or force) the database connection to close. Forcing the database connection to close can be messy--Use it at your own risk.
Procedure: CreateDatabase;
Procedure: DropDatabase;
Try to create (or drop) the named database, using the DBParams as
the "rest" of the CREATE DATABASE
command.
Function: Integer IndexOfDBConst(st: String)
Try to find the parameter in the database parameters list. Return -1 if nothing was found.
Events
Published Event: TNotifyEvent OnConnect
This event is kicked off after a database succesfully connects.
Published Event: TNotifyEvent OnIdleTimer
This event is kicked off after a database connection "times out".
TIBTransaction
Properties
Public, read-only: Integer DatabaseCount
How many databases are a part of this transaction? (Hey! InterBase supports multi-database transctions... So does IBDAC!)
Public, read-only: TIBDatabase Databases
Given an integer index, return the database at the index.
Integer IdleTimer
How long should this transaction wait before automatically committing or rolling back?
TTransactionAction TimeoutAction
When the transaction times out, should the transaction commit, roll back or commit-retaining?
Public, read-only: PChar TPB
A read only look at the transaction parameter buffer.
Public, read-only: Short TPBLength
The length of the transaction parameter buffer.
TStrings Params
A textual representation of the transaction parameter buffer.
See the InterBase API Guide for the names of the parameters to provide.
Methods
Procedure: CheckInTransaction
Procedure: CheckNotInTransaction
Raise an exception if there are no databases in the transactions database list. Raise an exception if the transaction is active. Raise an exception if the transaction is not active.
Procedure: CommitRetaining
Events
Published Event: TNotifyEvent OnIdleTimer
This event is kicked off after a transaction has timed out.
TIBDynamicSQL
TIBDynamicSQL
is an extremely simple component that will
quickly and efficiently execute an InterBase SQL statement with minimal
overhead. It has no standard interface to Data-aware controls and is
unidirectional.
Properties
Public, read-only: Boolean BOF
Is the query at the beginning of the query?
TIBDatabase Database
The database component to which the query is attached.
Public, read-only: PISC_DB_HANDLE DBHandle
A pointer to the InterBase database handle.
Public, read-only: Boolean EOF
Has the query returned all result rows? (Only meaningful for select queries).
Public, read-only: Integer FieldIndex
Given a field name, return the index of the named field.
i :=qry.FieldIndex[INT_FIELD];
TIBXSQLVAR Fields
Given an index, return the indexed field of the current record.
TIBXSQLVAR FieldByName
Return the referenced field of the current record.
Boolean GoToFirstRecordOnExecute
This property tells the query to go to the first record in the result set after opening it.
By default, this property is set to true. It exists primarily for use in
TIBDataSet
, which sets this value to False
for its
internal TIBDynamicSQL
s.
Public, read-only: Boolean Open
Is the query open?
Public, read-only: TIBXSQLDA Params
< TIBXSQLDA
is a IBDAC extension to InterBases
extended SQL descriptor. For the time-being, youre stuck looking at the
source code and the InterBase API Guide for more information.
Public, read-only: String Plan
Once a query has been prepared, you can get the query plan by querying this property.
Public, read-only: Boolean Prepared
Has this query been prepared yet?
Public, read-only: Integer RecordCount
The current count of records returned from the query. If result set is to return 100 rows, RecordCount will be 100 only after all records have been visited. That is, after looking at the first record, RecordCount is 1, and so on.
TStrings SQL
This the the SQL query that you wish to execute.
Public, read-only: TIBSQLTypes SQLType
This property tells you what type of query you are about to execute.
Possible values are: TIBSQLTypes=(SQLUnknown, SQLSelect, SQLInsert, SQLUpdate, SQLDelete, SQLDDL, SQLGetSegment, SQLPutSegment, SQLExecProcedure,SQLStartTransaction, SQLCommit, SQLRollback,SQLSelectForUpdate, SQLSetGenerator);
TIBTransaction Transaction
To what transaction does this query belong?
Public, read-only: PISC_TR_HANDLE TRHandle
A pointer to the transaction handle.
Methods
Constructor: Create (AOwner: TComponent)
Create an instance of a TIBDynamicSQL
.
Destructor: Destroy
Free up all resources associated with this instance.
Procedure: BatchInput (InputObject: TIBBatchInputStream)
< BatchInput
executes the parameterized query in
SQL for all input in the referenced InputObject.
Procedure: BatchOutput (OutputObject: TIBBatchOutputStream)
< BatchOutput
outputs the select query in SQL to
the referenced OutputObject.
Procedure: CheckClosed
Procedure: CheckOpen
Procedure: CheckValidStatement
Raise exceptions for the following possible conditions: The query is not closed, the query is not open, or the query does not have a valid statement.
Procedure: Close
Close the query.
Function: TIBXSQLDA Current
Function: TIBXSQLDA Next
Return a IBDAC extended SQL descriptor for the current record, or the next
record. Next
returns nil
if there are no records left in the
result set.
Procedure: ExecQuery
Execute the query in SQL.
Procedure: FreeHandle
Free up the InterBase resources associated with the query. In other words, "unprepare" the query.
Procedure: Prepare
Prepare the query for execution.
Events
Published Event: TNotifyEvent OnSQLChanging
When the SQL query is being modified, kick off an event. If an exception is raised in this event, then the SQL is not changed.
TIBExternalFile
The TIBExternal abstract class. It is the base class for Extrenal File related components.
Properties
Public: TIBXSQLDA Columns
Public: String Filename
Public: TIBXSQLDA Params
Methods
Procedure: ReadyFile
Function: Boolean Move
TIBExternalFileInput
Methods
Function: Boolean ReadParameters
TIBExternalFileOutput
Methods
Function: Boolean WriteColumns
TIBInputDelimitedFile
Property: Boolean AutoDetect
< AutoDetect tells IBDAC to try to figure out if the file is a tab-crlf delimited file or if it is a pipe-tilde delimited file.
Property: TIBDelimitedFormat InputFormat
< InputFormat tells IBDAC what format to expect in the
delimited file. The possible values are fdfTabs
or
fdfPipes
. If AutoDetect is set to True
,
this property is ignored.
Property: Boolean SkipTitles
< SkipTitles tells IBDAC if it should treat the first record of a delimited file as titles. Obviously, field titles are not useful in batch inputs, so this feature allows you to skip them.
TIBOutputDelimitedFile
Property: TIBDelimitedFormat OutputFormat
This property indicates what format (tab-crlf or pipe-tilde) should be used for outputting the delimited file.
Property: Boolean OutputTitles
This property indicates if the developer wishes to output the field titles at the top of the file.
TIBInputRawFile
TIBOutputRawFile
TIBBlobStream
Properties:
property Handle: TISC_BLOB_HANDLE read FHandle;
property BlobID: TISC_QUAD read FBlobID write SetBlobID;
property BlobMaxSegmentSize: Long read FBlobMaxSegmentSize;
property BlobNumSegments: Long read FBlobNumSegments;
property BlobSize: Long read FBlobSize;
property BlobType: Short read FBlobType;
property Database: TIBDatabase read GetDatabase write SetDatabase;
property DBHandle: PISC_DB_HANDLE read GetDBHandle;
property Mode: TBlobStreamMode read FMode write SetMode;
property Transaction: TIBTransaction read GetTransaction write SetTransaction;
property TRHandle: PISC_TR_HANDLE read GetTRHandle;
Methods:
constructor Create;
destructor Destroy; override;
function Call(ErrCode: ISC_STATUS; RaiseError: Boolean): ISC_STATUS;
procedure CheckReadable;
procedure CheckWritable;
procedure Finalize;
procedure LoadFromFile(Filename: String);
procedure LoadFromStream(Stream: TStream);
function Read(var Buffer; Count: Longint): Longint; override;
procedure SaveToFile(Filename: String);
procedure SaveToStream(Stream: TStream);
function Seek(Offset: Longint; Origin: Word): Longint; override;
procedure SetSize(NewSize: Long); override;
procedure Truncate;
function Write(const Buffer; Count: Longint): Longint; override;
TIBCustomDataSet
Properties:
TIBTransaction Transaction
Under what transaction does this query execute?
Public, read-only: PISC_TR_HANDLE TRHandle
A pointer to the InterBase transaction handle.
TIBDataSet
Properties:
TStrings DeleteSQL
TStrings InsertSQL
TStrings RefreshSQL
TStrings SelectSQL
TStrings UpdateSQL
The SelectSQL is the primary SQL property that should be used for executing queries. The rest of the queries are intended to allow the developer to make a query delete-able (DeleteSQL), insert-able (InsertSQL), row-level-refresh-able (RefreshSQL), and updatable (UpdateSQL).
Public, read-only: TIBXSQLDA Params
This property allows the developer to specify values for a parameterized query.
Public, read-only: Boolean Prepared
Have the set of data set queries been prepared?
Public, read-only: TIBDynamicSQL FQDelete
Public, read-only: TIBDynamicSQL QInsert
Public, read-only: TIBDynamicSQL QRefresh
Public, read-only: TIBDynamicSQL QSelect
Public, read-only: TIBDynamicSQL QUpdate
These properties give the developer direct access to the associated
TIBDynamicSQL
s that underly the TIBDataSet
.
Public, read-only: TIBSQLTypes StatementType
This returns the statement type of the QSelect query.
Methods
Procedure: ExternalFileInput (InputObject: TIBExternalFileInput)
Procedure: ExternalFileOutput (OutputObject: TIBExternalFileOutput)
Execute a File input/output routine on the given
Input(Output)Object
. In a TIBCustomDataSet
, the File
input/output routines operate against the QSelect query.
Procedure: CheckDatasetClosed
Procedure: CheckDatasetOpen
Raise an exception if the data set is open or closed, respectively.
Procedure: Prepare
Prepare the data set to be opened.
Events
Published Event: TNotifyEvent DatabaseDisconnecting
Published Event: TNotifyEvent DatabaseDisconnected
These events fire when a database is about to be disconnected and after a database has been disconnected, respectively.
Published Event: TNotifyEvent DatabaseFree
This event is fired when a Database component is freed from memory.
Published Event: TNotifyEvent TransactionEnding
Published Event: TNotifyEvent TransactionEnded
These events are fired when a transaction is about to end and after a transaction has ended, respectively.
Published Event: TNotifyEvent TransactionFree
This event is fired when a transaction is freed from memory.
TIBDBInfo
Public, read-only: Long Allocation
See isc_info_allocation
in the InterBase API Guide.
Public, read-only: Long BaseLevel
See isc_info_base_level
in the InterBase API Guide.
Public, read-only: String DBFileName
See isc_info_db_id
in the InterBase API Guide.
Public, read-only: String DBSiteName
See isc_info_db_id
in the InterBase API Guide.
Public, read-only: Long DBImplementationNo
See isc_info_implementation
in the InterBase API Guide.
Public, read-only: Long DBImplementationClass
See isc_info_implementation
in the InterBase API Guide.
ublic, read-only: Long NoReserve
See isc_info_no_reserve
in the InterBase API Guide
Public, read-only: Long ODSMinorVersion
See isc_info_ods_minor_version
in the InterBase API Guide
Public, read-only: Long ODSMajorVersion
See isc_info_ods_version
in the InterBase API Guide
Public, read-only: Long PageSize
See isc_info_page_size
Public, read-only: String Version
See isc_info_info_version
in the InterBase API Guide
Public, read-only: Long CurrentMemory
See isc_info_current_memory
in the InterBase API Guide
Public, read-only: Long ForcedWrites
See isc_info_forced_writes
in the InterBase API Guide
Public, read-only: Long MaxMemory
See isc_info_max_memory
in the InterBase API Guide
Public, read-only: Long NumBuffers
See isc_info_num_buffers
in the InterBase API Guide
Public, read-only: Long SweepInterval
See isc_info_sweep_interval
in the InterBase API Guide
Public, read-only: TStringList UserNames
See isc_info_user_names
in the InterBase API Guide
Public, read-only: Long Fetches
See isc_info_fetches
in the InterBase API Guide
Public, read-only: Long Marks
See isc_info_marks
in the InterBase API Guide
Public, read-only: Long Reads
See isc_info_reads
in the InterBase API Guide
Public, read-only: Long Writes
See isc_info_writes
in the InterBase API Guide
Public, read-only: Long BackoutCount
See isc_info_backout_count
in the InterBase API Guide
Public, read-only: Long DeleteCount
See isc_info_delete_count
in the InterBase API Guide
Public, read-only: Long ExpungeCount
See isc_info_expunge_count
in the InterBase API Guide
Public, read-only: Long InsertCount
See isc_info_insert_count
in the InterBase API Guide
Public, read-only: Long PurgeCount
See isc_info_purge_count
in the InterBase API Guide
Public, read-only: Long ReadIdxCount
See isc_info_read_idx_count
in the InterBase API Guide
Public, read-only: Long ReadSeqCount
See isc_info_read_seq_count
in the InterBase API Guide
Public, read-only: Long UpdateCount
See isc_info_update_count
in the InterBase API Guide
Public, read-only: Long LogFile
See isc_info_log_file
in the InterBase API Guide
Public, read-only: String CurLogFileName
See isc_info_cur_logfile_name
in the InterBase API Guide
Public, read-only: Long CurLogPartitionOffset
See isc_info_cur_log_part_offset
in the InterBase API Guide
Public, read-only: Long NumWALBuffers
See isc_info_num_wal_buffers
in the InterBase API Guide
Public, read-only: Long WALBufferSize
See isc_info_wal_buffer_size
in the InterBase API Guide
Public, read-only: Long WALCheckpointLength
See isc_info_wal_ckpt_length
in the InterBase API Guide
Public, read-only: Long WALCurCheckpointInterval
See isc_info_wal_cur_ckpt_interval
in the InterBase API Guide
Public, read-only: String WALPrvCheckpointFilename
See isc_info_wal_prv_ckpt_fname
in the InterBase API Guide
Public, read-only: Long WALPrvCheckpointPartOffset
See isc_info_wal_prv_ckpt_poffset
in the InterBase API Guide
Public, read-only: Long WALGroupCommitWaitUSecs
See isc_info_wal_grpc_wait_usecs
in the InterBase API Guide
Public, read-only: Long WALNumIO
See isc_info_wal_num_id
in the InterBase API Guide
Public, read-only: Long WALAverageIOSize
See isc_info_wal_avg_io_size
in the InterBase API Guide
Public, read-only: Long WALNumCommits
See isc_info_wal_num_commits
in the InterBase API Guide
Public, read-only: Long WALAverageGroupCommitSize
See isc_info_wal_avg_grpc_size
in the InterBase API Guide