TTdbTable

Index
TurboDB Components
    TTdbDataSet
    TTdbTable
    TTdbBatchMove
Turbo Database
    Overview
    Colum Data Types
    Queries
    Operators and Functions
    Working with Indexes
    Automatic Linking
    Working with Link and Relation Fields
    Shared Tables
    Table Locks
    Data Security
TurboDB Tools
    TurboDB Workbench
    TurboDB Data Exchange
    dataWeb Builder
    Visua Data Publisher
Frequently Asked Questions

[prev][next]

Enables you to access a TurboDB database table, to browse the table, to edit insert and delete records, to filter records, to locate specific records, to view records in an order defined by an index and to see records linked to the current record in a master table.

You can use the TTdbTable class very much as you are used to with TTable. You may link datasources to it and view the table content in all sorts of database aware controls like TDbEdit, TDbGrid a.s.o. Yet there are some points to consider:

Properties

TTdbTable.DatabaseName
Specifies the name of the database associated with this dataset.
property DatabaseName: string;
Use DatabaseName to specify the name of the database to associate with this dataset component. DatabaseName should match the name of a database component used in the application. You may also use a folder name like k:\turbodb\databases\db1 as the database name. In this case, all TurboDB tables in the folder are reachable via this DatabaseName.
Note: Attempting to set DatabaseName when a database already associated with this component is open raises an exception.

TTdbTable.Exclusive
Enables an application to gain sole access to a TurboDB table.
property Exclusive: Boolean;
Use Exclusive to prevent other applications from accessing a TurboDB table while it is open in this application. Before opening the table, set Exclusive to True. A table must be closed before changing the Exclusive property.
When Exclusive is True, then when the application successfully opens the table, no other application can access it. If the table for which the application has requested exclusive access is already in use by another application, an exception is raised. To handle such exceptions, wrap the code that opens the table in a try..except block.
Do not set Exclusive to True at design time if you also set the Active property to True at design time. In this case an exception is raised at start-up because the table is already in use by the IDE.

TTdbTable.IndexDefs
Contains information about the indexes for a table.
property IndexDefs: TIndexDefs;
IndexDefs is a collection of index definitions, each of which describes an available index for the table.
Note: The index definitions in IndexDefs may not always reflect the current indexes available for a table. Before examining IndexDefs, call its Update method to refresh the list.

TTdbTable.IndexFiles
Indicates the TurboDB index files available for the table.
property IndexFiles: TStrings;
Use IndexFiles to see what indexes are defined for the TurboDB table. Index files are added to and removed from this list with TTdbTable.AddIndex and TTdbTable.DeleteIndex.
Note: This property is obsolete. Use IndexDefs to determine the available indexes.

TTdbTable.IndexName
Indicates the name of the currently used index.
property IndexName: string;
Set IndexName to show the records of the table in the order defined by the index. Use one of items in the IndexFiles property. Setting IndexName to an empty string shows the records in the natural order, that is the order the records are stored in in the table file.
Note: The IndexName must be given including the extension .id, .inr or .ind.

TTdbTable.Key
Contains the key for decrypting an encrypted table.
property Key: LongWord;
Set the Key before opening the table, if it is encrypted. Encrypted tables also have a password, so you must the Password when you set the Key. If either the Password or the Key is missing or incorrect, the table won't open and raise an exception. Note: Don't forget the key of your table. There is no way to get it back and all the content of your table is lost.
Note: Don't save your form with the key property set to the correct value. There are tools to find the value of Key in your application. The Key property should be used only at run-time. It shows up in the Object Inspector only for easier testing.

TTdbTable.MasterSource
References the master data source for a master-detail view.
property MasterSource: TDataSource;
Use MasterSource to specify the name of the data source component whose DataSet property identifies a dataset to use as a master table in establishing a detail-master relationship between this table and another one. Each time the current record in the master table changes, the new values in those fields are used to select corresponding records in this table for display. Note: At design time choose an available data source from the MasterSource property’s drop-down list in the Object Inspector. TurboDB links the records of the detail table automatically to the records of the master data source by Automatic Linking. It uses the link and relation fields between master and detail table for this task. For this reason there is no property like MasterFields in TTdbTable.

TTdbTable.Password
Specifies the password used to open the table.
property Password: String;
Set Password before opening a protected table. If the table is encrypted you must also set Key. If Password or Key have the wrong value, an exception is raised when opening the table. Note: Do not save a form with Password and/or Key set. The values can be read by certain tools in the executable file.

TTdbTable.TableName
Indicates the name of the database table that this component encapsulates.
property TableName: TFileName;
Use TableName to specify the name of the database table this component encapsulates. To set TableName to a meaningful value, the DatabaseName property should already be set. Note: To set TableName, the Active property must be False.

Methods

TTdbTable.AddIndex
Creates a new index for the table.
procedure AddIndex(const Name, Fields: String; Options: TIndexOptions, const DescFields: String='');
Call AddIndex to create an index the table. An index can be used to show the records in a given order or to search faster for certain records.
Name is the file name of the new index, e.g. MyTableByName. The file of the new index will be called MyTableByName.ind.
Fields is the list of tables column to use for the index separated by semi-colons.
Options is a set of index options. The options applicable for TurboDB indexes are:

DescFields is a list of fields in Fields that are to be sorted in descending order.
Remarks This method is equivalent to TTable.AddIndex.

TTdbTable.DeleteIndex
Deletes an index of the table.
procedure DeleteIndex(const Name: string);
Call DeleteIndex to remove an index from the table and erase its file. Name is the file name of the index including the extension. It is identical to the corresponding item in IndexFiles. Remark TTdbTable.DeleteIndex is equivalent to TTable.DeleteIndex.

TTdbTable.DeleteTable
Deletes a database table.
procedure DeleteTable;
Use DeleteTable to erase the database table and all corresponding files.
Note: The data contained in the table cannot be recovered.

TTdbTable.EmptyTable
Clears all records in the table.
procedure EmptyTable;
Use EmptyTable to delete all records from the table.
Note: The records deleted cannot be recovered.
Remark TTdbTable.EmptyTable is equivalent to TTable.EmptyTable.

Events

Derived from TTdbDataSet.

[prev][next]

Last updated on 11/19/2000. Copyright (c) 2000 by dataWeb GmbH, Aicha, Germany. Turbo Database and TurboDB Components are products by dataWeb - the manufacturers of RAD tools for the Web. Please send your hints, questions and comments to Peter Pohmann.