TCB4Database Info

A TCB4Table can work in cooperation with a TCB4Database. It handles connections to the Server in a C/S configurations and provides an easy way to change between different database directories. It is comparable to the TDatabase of Delphi.

In Delphi/C++Builder 5 and higher and in Kylix, TCB4Database is a descendant of TCustomConnection. For an explanation of the properties and methods of TCB4Database see the BDE's TDatabase.


Compatible with TDatabase

procedure Close;
procedure Commit;
procedure
Open;
procedure Rollback;
procedure StartTransaction;

property InTransaction: Boolean
property Connected: Boolean;
property DatabaseName: string;
property DataSetCount:Integer;
property DataSets[Index: Integer]: TDataSet
property LoginPrompt: Boolean;
property OnAfterConnect;
property OnAfterDisconnect;
property OnBeforeConnect;
property OnBeforeDisconnect;
property OnLogin: TDatabaseLoginEvent;

Different from TDatabase

property CBCODE4: CODE4;
property Params: TStrings; - Extra params: 'SERVER NAME', 'PROCESS ID' and 'DesignTablePath';

Extra in TDatabase

property ConnectionTimeout: Integer; - Specifies amount of time to attempt a connection (corresponds to Codebase code4timeout).
property DatabaseType: TCB4DatabaseType; - Returnes on runtime the type of the CodeBase DLL that's being used. Values are: dtCB4Unknown, dtCB4Foxpro, dtCB4Clipper, dtCB4dBase
property MemoExprSize: Integer; - Size of Memo that can be used in expressions (code4memSizeMemoExpr).
property RaisedError: Integer; - Last raised codebase error code for this database.

property AutoDatabaseName: Boolean; - Indicates whether or not a unique databasename is automatically generated for this database. More info. Default=False
property IndexPath: string; - Path for index files
property TablePath: string; - Path for table files
property LockAttempts: SmallInt; - Number of lock attempts (code4lockAttempts). Default=-1 (Attempt for ever)
property LockDelay: Word; - Wait time (measured in 100ths of a second) between lock attempts (code4lockDelay). Default=100 (1 second)


AutoDatabaseName

From version 2.0 on, a new property is added to TCB4Database: AutoDatabaseName. Normally each TCB4Database needs to have a unique name. But in a multithreaded environment this can give problems if you have multiple instances of the same form or datamodule using a TCB4Database with the same name. If you set this property to true, CB4 Tables will generate a unique Databasename for this database. This means that you can't set the DatabaseName yourself anymore. And that you might need to connect your tables to your database using the Database property instead of the DatabaseName property. This is equal to the way, for example, ADO connects tables to databases.

© MMV Tiriss