|
<< Click to Display Table of Contents >> Delphi Examples: DbiOpenVchkList |
![]() ![]()
|
Create a table containing information about validity checks for fields within the specified table:
Returns information about validity checks for fields in the dataset specified in the Tbl parameter. The information is appended to the string list object specified in the VchkList parameter.
This example uses the following input:
fDbiOpenVchkList(OrdersTable, ListBox1.Items);
The procedure is:
procedure fDbiOpenVchkList(Tbl: TTable; var VCheckList: TStrings);
var
TmpCursor: hdbicur;
VCheck: VCHKDesc;
rslt: dbiResult;
begin
Check(DbiOpenVchkList(Tbl.DbHandle, PChar(Tbl.TableName), nil, TmpCursor));
Check(DbiSetToBegin(TmpCursor));
VCheckList.Clear;
repeat
rslt := DbiGetNextRecord(TmpCursor, dbiNOLOCK, @VCheck, nil);
if (rslt <> DBIERR_EOF) then begin
VCheckList.Add('Field Number: ' + IntToStr(VCheck.ifldNum));
if VCheck.bRequired then
VCheckList.Add('Field is required: TRUE')
else
VCheckList.Add('Field is required: FALSE');
if VCheck.bHasMinVal then
VCheckList.Add('Has Minimum Value: TRUE')
else
VCheckList.Add('Has Minimum Value: FALSE');
if VCheck.bHasMaxVal then
VCheckList.Add('Has Maximum Value: TRUE')
else
VCheckList.Add('Has Maximum Value: FALSE');
if VCheck.bHasDefVal then
VCheckList.Add('Has Default Value: TRUE')
else
VCheckList.Add('Has Default Value: FALSE');
end;
until (rslt <> DBIERR_NONE);
Check(DbiCloseCursor(TmpCursor));
end;