Class TAscii2DB (unit DBcvt)

Inherits from

TComponent

Constructors


constructor Create(Aowner: Tcomponent);

records updated

****************************************************************************}



Functions

destructor Destroy;

of create} {

procedure Execute;

of destroy} {

function GetRecordCount:LongInt;

of aborttranfer} {

procedure StopExecute;

of GetRecordCount} {

function GetFixedRecord(var List: TList; var f: File): LongInt;

Protected declarations

of GetRecord} {


function GetRecord(var List: TList; var f: File): LongInt;

***************************************************************************** Gets n fields from the specified file and returns then in a TList the entire record is also returned in pRecord (global) - File must be opened before calling.

procedure AbortTransfer(Sender: TObject);

of execute} {

procedure SetAsciiFile(value: TFileName);

of setEndOfRecord} {

procedure SetEndOfRecord(value: char);

****************************************************************************}

procedure SetErrorFile(value: TFileName);

of setAsciiFile} {

procedure SetFieldList(value: TStrings);

of StopExecute} {

procedure SetFixedWidth(value: boolean);

****************************************************************************}

procedure SetMaxFieldSize(value: LongInt);

****************************************************************************}

procedure SetMaxRecordErrors(value: longInt);

of setErrorFile} {

procedure SetNamesFirst(value: boolean);

of setRecordLimit} {

procedure SetRecordLimit(value: LongInt);

of setfieldlist} {

Properties

property AbortCaption : string

Published declarations

property AllowComments : boolean


property AnnotateErrorFile : boolean


property AsciiFile : TFileName


property DateFormat : TDBcvtDateFormat


property DateSeparat : char


property DecimalSeparat : char


property Delimiter : char


property Destination : TTable


property EndOfRecord : char


property ErrorFile : TFileName


property Escapes : TDBcvtEscapes


property FieldList : TStrings


property FixedWidth : boolean


property MaxFieldSize : LongInt


property MaxRecordErrors : LongInt


property Mode : TDBcvtMode


property NamesFirst : boolean


property NotifyCount : LongInt


property RecordLimit : LongInt


property Separator : char


property ShowCaption : string


property ShowDlg : boolean


property TimeSeparat : char


property WriteEnable : boolean


Events

event OnNotifyCount : TNotifyEvent


event OnParse : TParseEvent


event OnPrePost : TPrePostEvent


Variables

AbortedCount : LongInt;

Public declarations

AppendedCount : longInt;

record aborted by user

Busy : boolean;

record appended

ConversionErrors : longInt;

busy

EmptyCount : longInt;

records with conversion errors

ErrorCode : TDBcvtError;

empty strings

ErrorField : longInt;

last line read from file

ErrorLine : longInt;

cause of failure

FieldCountErrors : longInt;

last field read from file

KeyViolationErrors : LongInt;

records with miscount of fields

LineCount : longInt;

records with key violations

MemoErrors : longInt;

lines in ascii file

ParsedCount : longInt;

records with memo errors

RecordErrorCount : longInt;

lined read from file, except empty lines

UpdatedCount : longInt;

count of records with errors

FAbortCaption : string;


FAllowComments : boolean;


FAnnotateErrorFile : boolean;

Private declarations

FAsciiFile : TFileName;


FDateFormat : TDBcvtDateFormat;


FDateSeparat : char;


FDecimalSeparat : char;


FDelimiter : char;


FDestination : TTable;


FEndOfRecord : char;


FErrorFile : TFileName;


FEscapes : TDBcvtEscapes;


FFieldList : TStrings;


FFixedWidth : boolean;


FMaxFieldSize : LongInt;


FMaxRecordErrors : longInt;


FMode : TDBcvtMode;


FNamesFirst : boolean;


FNotifyCount : LongInt;


FOnNotifyCount : TNotifyEvent;


FOnParse : TParseEvent;


FOnPrePost : TPrePostEvent;


FRecordLimit : longInt;


FSeparator : char;


FShowCaption : string;


FShowDlg : boolean;


FTimeSeparat : char;


FWriteEnable : boolean;


OldActive : boolean;


sField : string;


sFieldCount : LongInt;


sQuoteEnd : LongInt;


sRecord : string;



Constructors


constructor Create(Aowner: Tcomponent);

records updated

****************************************************************************}


Functions


destructor Destroy;

of create} {


procedure Execute;

of destroy} {


function GetRecordCount:LongInt;

of aborttranfer} {


procedure StopExecute;

of GetRecordCount} {


function GetFixedRecord(var List: TList; var f: File): LongInt;

Protected declarations

of GetRecord} {


function GetRecord(var List: TList; var f: File): LongInt;

***************************************************************************** Gets n fields from the specified file and returns then in a TList the entire record is also returned in pRecord (global) - File must be opened before calling. - File pointer left pointing to next character. - Escaped characters (if enabled) are processed inside and out of delimiters. - All characters inside delimiter are literal except: a) = b) FEscapes (if enabled) - Outside of delimiters, , , and <#26> are not allowed unless escaped. - Delimiter are only allowed inside a delimiter pair if the are pair too. - Comment lines are ignored (begin with ;) - Comment line must terminate it a . - Blank and comment lines return a 0 count. - <#26> (eof) is treated as end of file except inside quotes - If List is nil, nothing will be saved but the field count will be valid - If an error occurs, -1 will be reported, field count will be 0 - If there are more fields found, extra fields are lost and the result will indicate number found. - If there are less fields found, extra fields not cleared result will indicate number found. If List is empty (not nil) then a count of records will be return and pRecord will be filled. *) {


procedure AbortTransfer(Sender: TObject);

of execute} {


procedure SetAsciiFile(value: TFileName);

of setEndOfRecord} {


procedure SetEndOfRecord(value: char);

****************************************************************************}


procedure SetErrorFile(value: TFileName);

of setAsciiFile} {


procedure SetFieldList(value: TStrings);

of StopExecute} {


procedure SetFixedWidth(value: boolean);

****************************************************************************}


procedure SetMaxFieldSize(value: LongInt);

****************************************************************************}


procedure SetMaxRecordErrors(value: longInt);

of setErrorFile} {


procedure SetNamesFirst(value: boolean);

of setRecordLimit} {


procedure SetRecordLimit(value: LongInt);

of setfieldlist} {


Properties


property AbortCaption : string

Published declarations


property AllowComments : boolean


property AnnotateErrorFile : boolean


property AsciiFile : TFileName


property DateFormat : TDBcvtDateFormat


property DateSeparat : char


property DecimalSeparat : char


property Delimiter : char


property Destination : TTable


property EndOfRecord : char


property ErrorFile : TFileName


property Escapes : TDBcvtEscapes


property FieldList : TStrings


property FixedWidth : boolean


property MaxFieldSize : LongInt


property MaxRecordErrors : LongInt


property Mode : TDBcvtMode


property NamesFirst : boolean


property NotifyCount : LongInt


property RecordLimit : LongInt


property Separator : char


property ShowCaption : string


property ShowDlg : boolean


property TimeSeparat : char


property WriteEnable : boolean


Events


event OnNotifyCount : TNotifyEvent


event OnParse : TParseEvent


event OnPrePost : TPrePostEvent


Variables


AbortedCount : LongInt;

Public declarations


AppendedCount : longInt;

record aborted by user


Busy : boolean;

record appended


ConversionErrors : longInt;

busy


EmptyCount : longInt;

records with conversion errors


ErrorCode : TDBcvtError;

empty strings


ErrorField : longInt;

last line read from file


ErrorLine : longInt;

cause of failure


FieldCountErrors : longInt;

last field read from file


KeyViolationErrors : LongInt;

records with miscount of fields


LineCount : longInt;

records with key violations


MemoErrors : longInt;

lines in ascii file


ParsedCount : longInt;

records with memo errors


RecordErrorCount : longInt;

lined read from file, except empty lines


UpdatedCount : longInt;

count of records with errors


FAbortCaption : string;


FAllowComments : boolean;


FAnnotateErrorFile : boolean;

Private declarations


FAsciiFile : TFileName;


FDateFormat : TDBcvtDateFormat;


FDateSeparat : char;


FDecimalSeparat : char;


FDelimiter : char;


FDestination : TTable;


FEndOfRecord : char;


FErrorFile : TFileName;


FEscapes : TDBcvtEscapes;


FFieldList : TStrings;


FFixedWidth : boolean;


FMaxFieldSize : LongInt;


FMaxRecordErrors : longInt;


FMode : TDBcvtMode;


FNamesFirst : boolean;


FNotifyCount : LongInt;


FOnNotifyCount : TNotifyEvent;


FOnParse : TParseEvent;


FOnPrePost : TPrePostEvent;


FRecordLimit : longInt;


FSeparator : char;


FShowCaption : string;


FShowDlg : boolean;


FTimeSeparat : char;


FWriteEnable : boolean;


OldActive : boolean;


sField : string;


sFieldCount : LongInt;


sQuoteEnd : LongInt;


sRecord : string;