Pack

<< Click to Display Table of Contents >>

Navigation:  Apollo VCL Components > Apollo VCL Component Reference > TApolloTable > TApolloTable Methods >

Pack

Declaration

procedure Pack;

Description

Removes all records marked for deletion from a table. When records are deleted with Delete (or, when using SpeedMode and ApolloDelete), they are only logically deleted by flagging a hidden delete field. To physically remove the records from the table, it is necessary to pack the file.

 

When the table has been reorganized, all active orders are reindexed.

 

TApolloTable packs memo files as well (i.e., the memo file will only contain memos for the records remaining in the table). If packing FPT or SMT memos, the memo block size may changed from the default 64 by setting the new block size before packing with SetMemoBlockSize. The packed memo file will use the new block size.

 

The progress of the pack operation may be visually monitored if a gauge hook has been set with SetGaugeHook.

image\tip.gif The table must be opened in Exclusive mode in order to perform a Pack operation.

Delphi Example

procedure Form1.Button1Click(Sender: TObject);

var

 iRet: Integer; 

begin

 with ApTbl do 

 begin 

         // Very Important!

         Exclusive := True;  

         Open; 

         iRet := IndexOpen( 'c:\Apollo\cust1.ntx' ); 

         iRet := IndexOpen( 'c:\Apollo\cust2.ntx' ); 

         iRet := IndexOpen( 'c:\Apollo\cust3.ntx' ); 

         SetGaugeHook( Form1.Handle ); 

         // Global variable

         GaugeFiles := 3;  

         Pack;

         SetGaugeHook( 0 ); 

         Close; 

 end; 

end;

C++Builder Example

void __fastcall TForm1::Button1Click(TObject *Sender)

{

int iRet; 

 // Very Important!

ApTbl->Exclusive = true;

ApTbl->Open(); 

iRet = ApTbl->IndexOpen( "c:\\Apollo\\cust1.ntx" ); 

iRet = ApTbl->IndexOpen( "c:\\Apollo\\cust2.ntx" ); 

iRet = IndexOpen( "c:\\Apollo\\cust3.ntx" ); 

ApTbl->SetGaugeHook( int( Form1->Handle )); 

 // Global variable

GaugeFiles = 3;  

 ApTbl->Pack();

ApTbl->SetGaugeHook( 0 ); 

ApTbl->Close(); 

}

See Also

ApolloDelete, Deleted, Recall, Reindex, SetGaugeHook, Zap