4 获取数据域和索引信息
在取得了数据表信息后,应使用TTable对象访问该数据表的具体信息。对应函数如下:
以下是引用片段:
procedure TDataSet.GetFieldNames(List: TStrings);
procedure TTable.GetIndexNames(List: TStrings);
GetFieldNames用来取得数据表中的各个域名,GetIndexNames用来取得数据表中的各个索引名。
另外,可以进一步使用TDataset和TTable中的两个属性TDataSet.FieldDefs.Items[] 和 TTable.IndexDefs.Items[]来访问具体的数据域信息和索引信息。它们分别是由TFieldDef和TIndexDef组成的数组。
TFieldDef描述如下:

TIndexDef描述如下:

TFieldType定义如下:
以下是引用片段:
TFieldType = (ftUnknown, ftString, ftSmallint, ftInteger, ftWord, ftBoolean,
ftFloat,ftCurrency, ftBCD, ftDate, ftTime, ftDateTime, ftBytes, ftVarBytes,
ftAutoInc,ftBlob, ftMemo, ftGraphic, ftFmtMemo, ftParadoxOle, ftDBaseOle,
ftTypedBinary,ftCursor);
TIndexOptions定义如下:
以下是引用片段:
TIndexOptions = set of (ixPrimary, ixUnique, ixDescending, ixExpression, ixCaseInsensitive);
它们的具体意义可以参见Delphi帮助。