Delphi Examples: DbiOpenIndexList

<< Click to Display Table of Contents >>

Navigation:  »No topics above this level«

Delphi Examples: DbiOpenIndexList

Return to chapter overview

Return a list of indexes on a specific table.

This example uses the following input:

 fDbiOpenIndexList(DBASEANIMALS, IndexList);

 

The procedure is:

procedure fDbiOpenIndexList(Tbl: TTable; var IndexList: TStringList);

var

 TmpCursor: hdbicur;

 rslt: dbiResult;

 IndexDesc: IDXDesc;

begin

 Check(DbiOpenIndexList(Tbl.dbhandle, PChar(Tbl.TableName), nil, TmpCursor));

 IndexList.Clear;

repeat

   rslt:= DbiGetNextRecord(TmpCursor, dbiNOLOCK, @IndexDesc, nil);

  if (rslt <> DBIERR_EOF) then begin

     IndexList.Add(StrPas(IndexDesc.szName))

  end;

until (rslt <> DBIERR_NONE);

 Check(DbiCloseCursor(TmpCursor));

end;