> Question, I have a paradox table thats 3mb in size, but currently has no
> records, how do I optimize/compress/shrink (or other suitable term) this
> table so thats its like only 3-4 k?

procedure TFrmDBAdmin.PackThem(const AliasPath,TblName :String);
var
  TblDesc: CRTblDesc;
  hDb: hDbiDb;
  TablePath: array[0..dbiMaxPathLen] of char;
  Cntr :Integer;
begin
    FillChar(TblDesc, SizeOf(CRTblDesc), 0);
    StrPCopy(TablePath,AliasPath);
    with TblDesc do begin
      StrPCopy(szTblName, TblName);
      StrCopy(szTblType, szParadox);
      bPack := True;
    end;
    hDb := nil;
    DbiOpenDatabase(nil, 'STANDARD', dbiReadWrite, dbiOpenExcl, nil,
      0, nil, nil, hDb);
    DbiSetDirectory(hDb, TablePath);
    DbiDoRestructure(hDb, 1, @TblDesc, nil, nil, nil, FALSE);
    DbiCloseDatabase(hDb);
end;

PS. Warning I think this packing removes any Security features and possibly secondary 
indexes.
PPS. Includes DBIProcs and DBITypes (These may be superceded in newer versions of 
Delphi)

--
Aaron Scott-Boddendijk
Jump Productions
(07) 838-3371 Voice
(07) 838-3372 Fax


---------------------------------------------------------------------------
  New Zealand Delphi Users group - Database List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz

Reply via email to