...pack a Table?
Author: Bernhard Angerer
function dgPackParadoxTable(Tbl: TTable; Db: TDatabase): DBIResult;
{ Packs a Paradox table by calling the BDE DbiDoRestructure
function. The TTable passed as the first parameter must
be closed. The TDatabase passed as the second parameter
must be connected. }
var
  TblDesc: CRTblDesc;
begin
  Result := DBIERR_NA;
  FillChar(TblDesc, SizeOf(CRTblDesc), 0);
  StrPCopy(TblDesc.szTblName, Tbl.TableName);
  TblDesc.bPack := True;
  Result        := DbiDoRestructure(Db.Handle, 1, @TblDesc, nil, nil, nil, False);
end;
function dgPackDbaseTable(Tbl: TTable): DBIResult;
{ Pack a dBASE table by calling DbiPackTable. The table
passed as a parameter will be opened if it isn't open. }
begin
  Result := DBIERR_NA;
  if Tbl.Active = False then
    Tbl.Open;
  Result := DbiPackTable(Tbl.DBHandle, Tbl.Handle,
    nil, nil, True);
end;
printed from
  www.swissdelphicenter.ch
  developers knowledge base