Class TCtTableEditor (unit uCtDBD)

Inherits from

TObject

This unit contains the TCtTableEditor class. This class is used to restructure existing tables. The basic process is as follows : 1. Register all the fields that you would like your table to have after the restructure 2. Register the table that will be restructured 3. Execute the restructure To create a new table the process is this : 1. Register all the fields that you would like your table to have 2. Create the table Necessary additions to TCtTableEditor : Register indexes. There is no way to implicitly rename a field. If a rename is required is could be done after registering the table but before executing the restructure. This is what would have to happen : 1. Find the field number in the original table 2. Find the field number in the new table 3. pFieldDesc^.iFldNum := original field number 4. pFieldOps^ := crMODIFY

Constructors


constructor Create;

--------------------------------------------------------- TCtTableEditor Used to restructure a table.


Functions

procedure Clear;

Register the fields that are wanted after the restructure.

procedure CreateTable(TblName: String);

Save the table as a new table

destructor Destroy;

Clean up.

function Execute: Boolean;

Setup a table description and restructure the registered table.

procedure RegisterField(FieldName: String; FieldType: TFieldType; Size: Word);

Register the fields that are wanted after the restructure.

procedure RegisterIndex(const IndexName: string; const IndexFields: String; IndexOptions: TIndexOptions);

Register the indexes that are wanted after the restructure.

function RegisterTable(var Table: TTable): Boolean;

Table must be opened exclusively.

Properties

Events

Variables

FFieldDefs : TFieldDefs;


FIndexDefs : TIndexDefs;


FIsPackTable : Boolean;


FKeyFieldCount : Integer;


FTable : TTable;


pFieldDesc : pFLDDesc;


pFieldOps : pCROpType;


pIndexDesc : pIDXDesc;


pIndexOps : pCROpType;



Constructors


constructor Create;

--------------------------------------------------------- TCtTableEditor Used to restructure a table. The basic process is as follows : 1. Register all the fields you want in the table 2. Register the table that you want to restructure 3. Perform the restructure ----------------------------------------------------------


Functions


procedure Clear;

Register the fields that are wanted after the restructure.


procedure CreateTable(TblName: String);

Save the table as a new table


destructor Destroy;

Clean up.


function Execute: Boolean;

Setup a table description and restructure the registered table.


procedure RegisterField(FieldName: String; FieldType: TFieldType; Size: Word);

Register the fields that are wanted after the restructure.


procedure RegisterIndex(const IndexName: string; const IndexFields: String; IndexOptions: TIndexOptions);

Register the indexes that are wanted after the restructure.


function RegisterTable(var Table: TTable): Boolean;

Table must be opened exclusively. Changes necessary to restructure table to reflect the registered structure are determined. Set the Field Ops to restructure a table. FldCount = Number of field in the new table OldFieldDesc = Original field description. NewFieldDesc = New field description. Ops = Field operation to perform.


Properties


Events


Variables


FFieldDefs : TFieldDefs;


FIndexDefs : TIndexDefs;


FIsPackTable : Boolean;


FKeyFieldCount : Integer;


FTable : TTable;


pFieldDesc : pFLDDesc;


pFieldOps : pCROpType;


pIndexDesc : pIDXDesc;


pIndexOps : pCROpType;