interface
uses
SysUtils, Windows, Classes, DBTables, DbiTypes, DbiProcs, DbiErrs;
function PackDbfTable(DbfTable: TTable): Boolean;
implementation
function PackDbfTable(DbfTable: TTable): Boolean;
var
errResult: DBIResult;
begin
try
{ 如果不是以独占方式,操作失败 }
if (not DbfTable.Exclusive) or (not DbfTable.Active) then
begin
Result := False;
exit;
end;
{ 进行删除操作 }
errResult := DbiPackTable(DbfTable.dbHandle, DbfTable.handle, nil, nil, True);
{ 根据返回结果,返回成功与否的标志 }
Result := errResult = DBIERR_NONE;
except
Result := False;
end;
end;