FairCom Corporation


VCL/CLX Component Reference
The c-tree Plus Data Access Components are composed of six components: TCtSession, TCtDatabase, TCtTable, TCtField, TCtIndex, and TCtSegment. Only the first three of the six components are found in the component palette. Click here to see a visual depiction of the VCL class hierarchy.
TCtComponent: The equivalent of the Borland TComponent. The session and database components are derived from this component.
Public properties:
Error: This property indicates which error occurred with the component.
Handle: The c-tree Plus handle for the component.
LockMode: This read-only property indicates the lock mode for the session wide lock.
UserTag: A user tag is a user defined tag that can be used for storing an addi- tional integer value or it can be typecast to any 32-bit value such as a reference or a pointer.
Methods:
Create: The constructor for the TCtComponent component.
Destroy: The destructor for the TCtComponent component. Do not call Destroy directly. The object has to be destroyed with the inherited (TObject) Free() method.
AbortTransaction: Abort the current transaction.
BeginTransaction: Start a new transaction.
ClearError: Clear the error code.
CommitTransaction: Commit the current transaction.
GetLockMode: Retrieve the current session-wide lock mode.
IsLockActive: Verify the lock state, returning true if session wide locks are enabled.
IsTransActive: Verify the transaction state, if active or not.
Lock: Enable session lock.
RestoreSavePoint: Restore a transaction save point, given by ASavePoint.
SetSavePoint: Establish a transaction save point.
Unlock: Release all locks acquired by Lock.
TCtSession Component: The equivalent of BDE the TSession component; it encapsulates the properties and methods of the c-tree Plus session layer. TCt- Session is a derivation of TComponent with the following added properties and methods.
Published Properties:
Active: Boolean property that indicates if a session is active or not.
AutoCreate: Boolean property that, when set to True, automatically creates the session dictionary if it doesn't yet exist.
Bufs: The number of index file buffers.
DBufs: The number of data file buffers.
Directory: Indicates the location of the session dictionary file.
Fils: An initial block of file structures.
Password: The user password.
Sect: The number of node sectors.
Server: The server name.
SessionType: The session type being allocated or created.
User: The user name.
Userprof: The user profile mask.
Public Properties:
Databases: List of the database names associated with the session.
DatabaseCount: The number of databases in a session.
Methods:
Create: The constructor for the TCtSession component.
Destroy: The destructor for the TCtSession component.
CreateSession: Create a session dictionary.
DisconnectAll: Disconnect all databases from the session.
Logon: Logon to a session.
Logout: Logout from a session.
Events:
OnActive: This event is called after a session logon or a session logout is exe- cuted successfully.
OnCreate: This event is called when the Active Property from the Component is set to True if the session dictionary does not exist and the AutoCreate Property is set to True.
OnLogon: This event is called before the session logon is executed.
OnLogout: This event is called before the session logout is executed.
TCtDatabase Component: The equivalent of the BDE TDatabase component. TCtDatabase encapsulates the property and methods of the c-tree Plus data- base layer. TCtDatabase is a derivation of TComponent with the following added properties and methods:
Published Properties:
Active: Indicates if a database is connected to a session.
AutoCreate: Boolean property that, when set to True, automatically creates the database dictionary if it doesn't yet exist.
Database: Database name.
Directory: Directory path where the database dictionary file is to be found.
Session: This property is used to assign the database to a session.
Public Properties:
TableCount: Number of tables in the database.
Tables: List of tables that belong to the database.
Methods:
Create: The TCtDatabase component constructor.
Destroy: The TCtDatabase component destructor.
AddDatabase: Add an existing database to the session.
CloseAll: Close all open tables associated with this database.
Connect: Connect the database to a session.
CreateDatabase: Create a new database for this session.
DeleteDatabase: Drop a database from a session and delete the database dic- tionary file from disk.
Disconnect: Disconnects the database from a session.
DropDatabase: Drop a database from a session.
Events:
OnActive: Called after a successful connect or disconnect.
OnConnect: Called just before a database is connected to a session.
OnCreate: Called to modify the database properties before the database dictio- nary is created when the Active and AutoCreate Properties of the Component are set to True and the database dictionary does not exist.
OnDisconnect: This event is called just before a database is disconnected from a session.
TCtDataSet: The equivalent of the Borland TdataSet component. The TCtTable component is derived from this component.
Public Properties:
ActiveRecord: This read-only property represents the record handle.
CreateMode: This property sets the table creation mode.
Database: Set this property with the database component associated with this TCtDataSet before any other TCtDataSet operation.
DefaultIndex: This property indicates which index number to use as the default index.
Directory: Set the TCtDataSet directory location.
Exclusive: Set this property to indicate if a table is to be open with exclusive access.
Groupid: Set this property with the table group id.
hDatabase: Retrieve the Database handle for this TCtDataSet component.
hSession: Retrieve the Session handle for this TCtDataSet component.
hTable: Retrieve the Table handle for this TCtDataSet component.
Password: Set this property with the table password.
Permanent: Use this property to indicate if a table is to be open in PERMANENT or VIRTUAL mode.
Permission: Set the permission mask for the table.
Position: Retrieve the current record offset.
Session: Retrieve the Session object for the given Database.
Table: Set this property with the table name before activating (opening) the table.
Methods:
Create: The constructor for the TCtDataSet component.
Destroy: The destructor for the TCtDataSet component.
CreateBlobStream: Return a TBlobStream object for reading or writing the data in a specified blob field.
GetFieldData: Retrieve the current value of a field into a buffer.
TCtTable Component: This component is the equivalent of the BDE TTable com- ponent. TCtTable encapsulates the property and methods of the c-tree Plus table and record layers. TCtTable is a descendant of TCtDataSet. The following methods, property and events were implemented:
Published Properties:
Active: Indicate if a table is open or not.
CreateMode: This property sets the table creation mode.
Database: Set this property with the database component this table should be associated with.
DefaultIndex: This property indicates which index number should be used as the default index.
Directory: Sets the table directory location.
Exclusive: Use this property to indicate if a table is to be open with exclusive access or not.
Filter: Filter is used to specify a dataset filter.
Filtered: Indicate if a filter is active for a record set.
Groupid: Set this property with the table group id.
Password: Set this property with the table password.
Permanent: Use this property to indicate if a table is to be open in PERMANENT or VIRTUAL mode.
Permission: Set the permission mask for the table.
Table: Set this property with the table name before activating (opening) the table.
Public Properties:
Error: This property indicates the error occurred with the component.
FieldCount: Number of fields.
Fields: List of table fields.
IndexCount: Number of indexes.
Indexes: List of table indexes.
LockMode: This read-only property indicates the lock mode for the session wide lock.
Recbyt: This read-only property indicates if the table has a recbyt index. RECBYT index is an index based on the byte offset (recbyt) of the record being indexed.
Rowid: This read-only property indicates if the table has a rowid index. A rowid index holds the auto increment value generated by c-tree every time a new record is added to the table. This field is read-only and acts as a unique record identifier.
UserTag: Indicate the user tag. A user tag is a user defined tag that can be used for storing an additional integer value or it can be typecast to any 32-bit value such as a reference or a pointer.
Methods:
Create: The constructor for the TCtTable component.
Destroy: The destructor for the TCtTable component.
AbortTransaction: Abort the current transaction.
AddField: Add a new field to a table.
AddIndex: Add a new index to the table.
AddSegment: Add index segment.
AddTable: Add an existing table to the database.
AlterTable: Commit the table field, index or index segment changes.
BeginTransaction: Start a new transaction.
ClearError: Clear the error code.
CommitTransaction: Commit the current transaction.
CreateTable: Create a new table.
DeleteField: Delete a table field.
DeleteIndex: Delete index from table.
DeleteSegment: Delete an index segment.
DeleteTable: Drop a table from a database and delete the table data and index files.
DropTable: Drop a table from a database.
GetField: Retrieve a field object.
GetIndex: Retrieve an index object.
GetLockMode: Retrieve the current lock mode.
GetSegment: Retrieve an index segment object from table.
InsertField: Insert a new field into a table. Inserted fields may be placed any- where in the table.
InsertSegment: Insert a new segment into a table.
IsLockActive: Verify the lock state, returning true if session wide locks are enabled.
IsTransActive: Verify the transaction state, if active or not.
Lock: Enable session lock.
Notification: Overload the default notification event handler.
ResetAll: Reset all record buffers associated with the table.
RestoreSavePoint: Restore a transaction save point, given by ASavePoint.
SetSavePoint: Establish a transaction save point.
Unlock: Release all locks acquired by Lock.
UnlockTable: Unlock all locked records in a table.
UpdateCreateMode: UpdateCreateMode changes critical file mode attributes such as the level of transaction control.
Events:
AfterCancel: Write an AfterCancel event handler to take specific action after an application cancels changes to the active record.
AfterClose: Write an AfterClose event handler to take specific action immedi- ately after an application closes a dataset.
AfterDelete: Write an AfterDelete event handler to take specific action immedi- ately after an application deletes the active record in a dataset.
AfterEdit: Write an AfterEdit event handler to take specific action immediately after dataset enters edit mode.
AfterInsert: Write an AfterInsert event handler to take specific action immedi- ately after an application inserts a record.
AfterOpen: Write an AfterOpen event handler to take specific action immediately after an application opens the dataset.
AfterPost: Write an AfterPost event handler to take specific action immediately after an application posts a change to the active record.
AfterScroll: Write an AfterScroll event handler to take specific action immedi- ately after an application scrolls to another record as a result of a call to the First, Last, MoveBy, Next, Prior, FindKey, FindFirst, FindNext, FindLast, FindP- rior, and Locate methods.
BeforeCancel: Write a BeforeCancel event to take specific action before an application carries out a request to cancel changes.
BeforeClose: Write a BeforeClose event to take specific action before an appli- cation closes a dataset.
BeforeDelete: Write a BeforeDelete event handler to take specific action before an application deletes the active record.
BeforeEdit: Write a BeforeEdit event handler to take specific action before an application enables editing of the active record.
BeforeInsert: Write a BeforeInsert event handler to take specific action before an application inserts or appends a new record.
BeforeOpen: Write a BeforeOpen event handler to take specific action before an application opens a dataset for viewing or editing.
BeforePost: Write a BeforePost event handler to take specific action before an application posts dataset changes to the database.
BeforeScroll: Write a BeforeScroll event handler to take specific action immedi- ately before an application scrolls to another record as a result of a call to the First, Last, MoveBy, Next, Prior, FindKey, FindFirst, FindNext, FindLast, FindP- rior, and Locate methods.
TCtBlobStream Class: This class is a descendant of Borland TBlobStream class and it is used to implement support for TDataSeb blob fields. The following properties and methods were implemented:
Methods:
Create: The constructor for the TCtBlobStream component.
Destroy: The destructor for the TCtBlobStream component.
Read: This is an abstract method responsible for reading from the stream.
Seek: Move to a specified position in the streamed resource.
Write: This is a virtual method for writing to the stream.
TCtObject: The equivalent of the Borland TObject. The record class is derived from this object.
TCtObject Class: The equivalent of the Borland TObject. The record class is derived from this object.
Public Properties:
Error: This property indicates the error occurred with the component.
Handle: The c-tree Plus handle for the object.
LockMode: This read-only property indicates the lock mode for the session wide lock.
UserTag: Indicates the user tag, a user defined tag that stores an integer value or can be typecast to any 32-bit value, such as a reference or a pointer.
Methods:
Create: The constructor for the TCtObject object.
Destroy: The destructor for the TCtObject object.
AbortTransaction: Abort the current transaction.
BeginTransaction: Start a new transaction.
ClearError: Clear the error code.
CommitTransaction: Commit the current transaction.
GetLockMode: Retrieve the current session-wide lock mode.
IsLockActive: Verify the lock state, returning true if session wide locks are enabled.
IsTransActive: Verify the transaction state.
Lock: Enable session lock.
RestoreSavePoint: Restore a transaction save point, given by ASavePoint.
SetSavePoint: Establish a transaction save point.
Unlock: Release all locks acquired by Lock.
TCtRecord Class: This class encapsulates the c-tree Plus record management functions. TCtRecord is a descendant of TObject and the following properties were implemented:
Public Properties:
Active: Read the contents of this property to check if the record buffer has been cleared by a call to the Clear() method.
DefaultIndex: Use this property to read or to change the current default index.
Edited: Use this property to check if a record buffer was modified by one of the SetFieldAs method.
FieldCount: Use this read only property to obtain the number of fields in the table.
Offset: Use this property to retrieve or set the record offset.
RecordCount: Use this read only property to obtain the number of records in the table.
RecordLength: Use this read only property to obtain the length in bytes of the current record.
RecordSize: Use this read only property to obtain the allocated size in bytes of the current record.
Methods:
Create: The constructor for the TCtRecord component.
Destroy: The destructor for the TCtRecord component.
Allocate: Allocate a new record buffer. AOwner must be a TCtTable object.
Clear: Clear and initialize the record buffer.
Delete: Delete the current record.
Duplicate: Duplicate the current record buffer.
FieldLength: Retrieve the actual field length.
FieldNumber: Retrieve the number of the field given the field name.
FieldSize: Retrieve the declared field size.
Find: Find a record.
FindRowid: Find a record based on its rowid.
First: Locate the first record of a table.
GetFieldAsBigint: Retrieve the field data as an Int64 (64 bit) value.
GetFieldAsBinary: Retrieve the field data as a binary value.
GetFieldAsBoolean: Retrieve the field data as boolean value.
GetFieldAsCurrency: Retrieve the field data as a CTCURRENCY (64 bit) value.
GetFieldAsDate: Retrieve the field data as a TDate value.
GetFieldAsDateTime: Retrieve the field data as a TDateTime value.
GetFieldAsFloat: Retrieve the field data as floating point value.
GetFieldAsSigned: Retrieve the field data as a signed integer value.
GetFieldAsString: Retrieve the field data as a string value.
GetFieldAsTime: Retrieve the field data as a TTime value.
GetFieldAsUnsigned: Retrieve the field data as an unsigned integer value.
GetRecordLock: Retrieve the record lock mode.
GetRowid: Retrieve the record rowid.
IsFieldNull: Determine if the given field is Null.
Last: Locate the last record in a table.
LockRecord: Lock the current record.
Next: Locate the next record in a table.
Prev: Locate the prior record in a table.
Read: Re-read the current record.
RecordSetOff: Turn off a record set operation.
RecordSetOn: Turn on record set operation.
Release: Release all resources associated with a record buffer.
Seek: Locate a record given its record offset address.
SetFieldAsBigint: Update the field data as an Int64 value.
SetFieldAsBinary: Update the field data as a binary value.
SetFieldAsBoolean: Update the field data as a boolean value.