Board index » delphi » Using DbiDoRestructure to Pack PX files - HELP

Using DbiDoRestructure to Pack PX files - HELP

Hello everybody,

Can someone send me an example of using DbiDoRestructure only for
packing paradox tables.

Thanks
David Gurevitz g...@centroin.com.br

 

Re:Using DbiDoRestructure to Pack PX files - HELP


Quote
g...@centroin.com.br (dbDelphi) wrote:
>Hello everybody,
>Can someone send me an example of using DbiDoRestructure only for
>packing paradox tables.

The following procedure will pack a paradox table

DatabaseName : name of the database ( path or alias )
TableName    : name of the table , without !! extension
Password     : name of the password if the table is password protected

example: PackTable('dbdemos','customer','');

A t t e n t i o n : only works with paradox tables , the table must be
closed and you need exclusive access to it.

uses dbiProcs,dbiTypes,db,sysutils;

procedure PackTable(DataBaseName,TableName,Password:string);
var Database    : TDatabase;
    TblDesc     : CRTBLDesc;

begin
  { get Database handle }
  Database:=Session.OpenDataBase(DataBaseName);
  fillchar(TblDesc,sizeof(TblDesc),0);
  with TblDesc do begin
    strpcopy(szTblName,TableName);
    strcopy(szTblType,szParadox);
    bPack:=true; { pack table }
    if Password<>'' then begin
      { if password spezified add to Session }
      bProtected:=true;
      strpcopy(szPassword,Password);
      Session.AddPassword(Password);
    end;
  end;
  Check(dbiDoRestructure(
    Database.Handle,1,@TblDesc,nil,nil,nil,false));
end;

Maybe I could help you

  Torsten

// Torsten Kuphal (kup...@rzaix340.rz.uni-leipzig.de) \\

Re:Using DbiDoRestructure to Pack PX files - HELP


My understanding is that Paradox tables don't need repacking like DBase
tables since the space of deleted records is reclaimed immediately.
However if you very many records at one time and dont intend to replace
them very soon and you need the disk space temporarily a simple copy will
do the trick.  I think removing and replacing the index will also do.
--
Ben
Arrow Software

Torsten Kuphal <kup...@rzaix340.rz.uni-leipzig.de> wrote in article
<5469j0$...@speedy.rz.uni-leipzig.de>...

Quote
> g...@centroin.com.br (dbDelphi) wrote:

> >Hello everybody,

> >Can someone send me an example of using DbiDoRestructure only for
> >packing paradox tables.

> The following procedure will pack a paradox table

> DatabaseName : name of the database ( path or alias )
> TableName    : name of the table , without !! extension
> Password     : name of the password if the table is password protected

> example: PackTable('dbdemos','customer','');

> A t t e n t i o n : only works with paradox tables , the table must be
> closed and you need exclusive access to it.

> uses dbiProcs,dbiTypes,db,sysutils;

> procedure PackTable(DataBaseName,TableName,Password:string);
> var Database    : TDatabase;
>     TblDesc     : CRTBLDesc;

> begin
>   { get Database handle }
>   Database:=Session.OpenDataBase(DataBaseName);
>   fillchar(TblDesc,sizeof(TblDesc),0);
>   with TblDesc do begin
>     strpcopy(szTblName,TableName);
>     strcopy(szTblType,szParadox);
>     bPack:=true; { pack table }
>     if Password<>'' then begin
>       { if password spezified add to Session }
>       bProtected:=true;
>       strpcopy(szPassword,Password);
>       Session.AddPassword(Password);
>     end;
>   end;
>   Check(dbiDoRestructure(
>     Database.Handle,1,@TblDesc,nil,nil,nil,false));
> end;

> Maybe I could help you

>   Torsten

> // Torsten Kuphal (kup...@rzaix340.rz.uni-leipzig.de) \\

Other Threads