![]() |
|
![]() |
//*
// DBLoad - Loading and unloading data in various formats.
//
// LoadDef =
// record
// relation : array [0 .. 7] of char; -- name of relation
// field : array [0 .. 7] of char; -- name of field
// repeat : cardinal; -- field repeat number 1 .. n
// startIndex : cardinal; -- field start position (1 .. n)
// end;
//
// * Note two important things about the LoadDef record.
//
// 1) The StartIndex field is only used by the SDF Format routine.
// For all other formats this can be initially set to 0. -- any values in this field.
//
// 2) There is a special case for the relation and field name.
// Setting BOTH of these names to the value 'NULL' will cause this
// field to be skipped. This is to be used during the load routines.
// The reason for this is that sometimes you will not want to load
// every field that occurs in the input data files. Specifying the
// special 'NULL' value will allow you to skip over this field
// during the loading process to the next field.
//
// As an example we will assume that in input file in dBaseIII format
// contains four fields. Field1 is the SSN, Field2 is the LastName,
// Field3 is the FirstName and Field4 is the MiddleInitial. In order
// to load only the name fields you must be able to skip loading the
// SSN field. To do this you would define the following array of
// LoadDef information :
//
// .
// .
// .
//
// FieldList : array [0 .. 3] of DBLoad.LoadDef;
// .
// .
// .
//
//
// begin
// FieldList[0].relation := 'NULL ';
// FieldList[0].field := 'NULL ';
// FieldList[0].repeat := 1;
// FieldList[0].startIndex := 0;
//
// FieldList[1].relation := 'R1 ';
// FieldList[1].field := 'LastName';
// FieldList[1].repeat := 1;
// FieldList[1].startIndex := 0;
//
// FieldList[2].relation := 'R1 ';
// FieldList[2].field := 'FirstNam';
// FieldList[2].repeat := 1;
// FieldList[2].startIndex := 0;
//
// FieldList[3].relation := 'R1 ';
// FieldList[3].field := 'MiddleIn';
// FieldList[3].repeat := 1;
// FieldList[3].startIndex := 0;
//
type
LoadProc = procedure
(var ContinueOn : boolean); stdcall;
//*
// LoadProc - Allows check of memory records and halting process.
//
//
// LoadProc allows the user to do any operations necessary on the
// data in the memory records after they have been loaded with data
// from the relations during an unload and with data from the
// file during the load routines. During load routines this procedure
// should do a WriteRecord. During the unload routines this procedure
// should do a ReadRecord.
//
// CALLING SEQUENCE -
//
// LoadProc (ContinueOn)
//
// EXIT -
//
// ContinueOn : boolean
// Set to False if no further processing is desired.
// Set to True if more data is to be read from the file.
//
QuickProc = procedure
(var line : array of char;
var accept : boolean;
var ContinueOn : boolean); stdcall;
//*
// QuickProc - Allows user intervention during quick load.
//
//
// This procedure allows intervention prior to each record being loaded
// into the database.
//
// CALLING SEQUENCE -
//
// LoadProc (line, accept, ContinueOn)
//
// ENTRY -
//
// line : array of char
// The line that has just been read that is to be used to load field
// values from. This line may be changed to include revised values
// if desired.
//
// EXIT -
//
// accept : boolean
// The load program should accept the line (True), or reject and move
// to the next line without loading this line (False).
//
// ContinueOn : boolean
// Set to False if no further processing is desired.
// Set to True if more data is to be read from the file.
//
LoadDef = packed record
Relation : array [0 .. 7] of char; // name of field's relation
Field : array [0 .. 7] of char; // name of field
RepeatVal : cardinal; // field repeat number 1 .. n
startIndex : cardinal; // starts at position (1 .. n)
end;
procedure LoadDBaseIIIFormat
(const FileName : array of char;
var FieldTable : array of LoadDef;
const NumFields : cardinal;
const FormatProc : LoadProc); stdcall;
exports LoadDBaseIIIFormat name 'DBLoad_LoadDBaseIIIFormat';
//*
// LoadDBaseIIIFormat - Load from a file which is in DBase III Format.
//
//
// LoadDBaseIIIFormat loads the data from a DBaseIII file into the relations
// and fields that were defined in the FieldTable. The fields will be
// expected to be in the same order that they were defined.
//
// CALLING SEQUENCE -
//
// LoadDBaseIIIFormat (FileName, FieldTable, NumFields)
//
// ENTRY -
//
// FileName : array of char
// Name of the DBaseIII file to load from.
//
// FieldTable : array of LoadDef
// Array of Relation-Field names to load.
//
// NumFields : cardinal
// Number of Relation-Field names in the FieldTable array.
//
// EXAMPLE -
//
// See bottom of .DEF file
//
procedure LoadDelimitedFormat
(const FileName : array of char;
var FieldTable : array of LoadDef;
const NumFields : cardinal;
const FieldDelimiter : char;
const AlphaDelimiter : char;
const HasHeaderRow : boolean;
const FormatProc : LoadProc); stdcall;
exports LoadDelimitedFormat name 'DBLoad_LoadDelimitedFormat';
//*
// LoadDelimitedForat - Load from a file which is in Delimited.
//
//
// LoadDelimitedFormat loads the data from a Delimited file into the relations and
// fields that were defined in the FieldTable. The fields will be
// expected to be in the same order that they were defined.
//
// CALLING SEQUENCE -
//
// LoadDelimitedFormat (FileName, FieldTable, NumFields,
// FieldDelimiter, AlphaDelimiter, FormatProc)
//
// ENTRY -
//
// FileName : array of char
// Name of the Delimited file to load from.
//
// FieldTable : array of LoadDef
// Array of Relation-Field names to load.
//
// NumFields : cardinal
// Number of Relation-Field names in the FieldTable array.
//
// FieldDelimiter : char
// The character to use between the field values
//
// AlphaDelimiter : char
// The character to use around an alpha field value
//
// HasHeaderRow : boolean
// The first line of the data file is a header row of the field names.
//
// FormatProc : LoadProc
// procedure to modify memory records, read and write records.
//
// EXAMPLE -
//
// See bottom of .DEF file
//
procedure LoadDIFFormat
(const FileName : array of char;
var FieldTable : array of LoadDef;
const NumFields : cardinal;
const FormatProc : LoadProc); stdcall;
exports LoadDIFFormat name 'DBLoad_LoadDIFFormat';
//*
// LoadDIFFormat - Load from a file which is in DIF format.
//
//
// LoadDIFFormat loads the data from a DIF file into the relations and
// fields that were defined in the FieldTable. The fields will be
// expected to be in the same order that they were defined.
//
// CALLING SEQUENCE -
//
// LoadDIFFormat (FileName, FieldTable, NumFields, FormatProc)
//
// ENTRY -
//
// FileName : array of char
// Name of the DIF file to load from.
//
// FieldTable : array of LoadDef
// Array of Relation-Field names to load.
//
// NumFields : cardinal
// Number of Relation-Field names in the FieldTable array.
//
// FormatProc : LoadProc
// procedure to modify memory records, read and write records.
//
// EXAMPLE -
//
// See bottom of .DEF file
//
procedure LoadSDFFormat
(const FileName : array of char;
var FieldTable : array of LoadDef;
const NumFields : cardinal;
const FormatProc : LoadProc); overload; stdcall;
exports LoadSDFFormat (const FileName : array of char;
var FieldTable : array of LoadDef;
const NumFields : cardinal;
const FormatProc : LoadProc) name 'DBLoad_LoadSDFFormat';
//*
// LoadSDFFormat - Load from a file which is in Standard Data Format.
//
//
// LoadSDFFormat loads the data from a SDF file into the relations and
// fields that were defined in the FieldTable. The fields will be
// expected to be in the same order that they were defined.
//
// CALLING SEQUENCE -
//
// LoadSDFFormat (FileName, FieldTable, NumFields, FormatProc)
//
// ENTRY -
//
// FileName : array of char
// Name of the SDF file to load from.
//
// FieldTable : array of LoadDef
// Array of Relation-Field names to load.
//
// NumFields : cardinal
// Number of Relation-Field names in the FieldTable array.
//
// FormatProc : LoadProc
// procedure to modify memory records, read and write records.
//
// EXAMPLE -
//
// See bottom of .DEF file
//
procedure LoadSDFFormat
(const FileName : string;
var FieldTable : array of LoadDef;
const NumFields : cardinal;
const FormatProc : LoadProc); overload; stdcall;
exports LoadSDFFormat (const FileName : string;
var FieldTable : array of LoadDef;
const NumFields : cardinal;
const FormatProc : LoadProc) name 'DBLoad_STRLoadSDFFormat';
//*
// STRLoadSDFFormat - See documentation of LoadSDFFormat.
//
procedure LoadSDIFormat
(const FileName : array of char;
var FieldTable : array of LoadDef;
const NumFields : cardinal;
const FormatProc : LoadProc); stdcall;
exports LoadSDIFormat name 'DBLoad_LoadSDIFormat';
//*
// LoadSDIFormat - Load from a file which is in SDI format.
//
//
// LoadSDIFormat loads the data from a SDI file into the relations and
// fields that were defined in the FieldTable. The fields will be
// expected to be in the same order that they were defined.
//
// CALLING SEQUENCE -
//
// LoadSDIFormat (FileName, FieldTable, NumFields)
//
// ENTRY -
//
// FileName : array of char
// Name of the SDI file to load from.
//
// FieldTable : array of DBLoad.LoadDef
// Array of Relation-Field names to load.
//
// NumFields : cardinal
// Number of Relation-Field names in the FieldTable array.
//
// EXAMPLE -
//
// See bottom of .DEF file
//
procedure UnloadDBaseIIIFormat
(const FileName : array of char;
var FieldTable : array of LoadDef;
const NumFields : cardinal;
const FormatProc : LoadProc); stdcall;
exports UnloadDBaseIIIFormat name 'DBLoad_UnloadDBaseIIIFormat';
//*
// UnloadDBaseIIIFormat - Unload to a file which is in DBase III Format.
//
//
// UnloadDBaseIIIFormat unloads the data from the relations into a file
// in DBaseIII format using the relations and fields that were defined
// in the FieldTable. The fields will be dumped in the same order that
// they were defined.
//
// CALLING SEQUENCE -
//
// UnloadDBaseIIIFormat (FileName, FieldTable, NumFields, FormatProc)
//
// ENTRY -
//
// FileName : array of char
// Name of the DBaseIII file to unload to.
//
// FieldTable : array of LoadDef
// Array of Relation-Field names to load.
//
// NumFields : cardinal
// Number of Relation-Field names in the FieldTable array.
//
// EXAMPLE -
//
// See bottom of .ADS file
//
procedure UnloadDelimitedFormat
(const FileName : array of char;
var FieldTable : array of LoadDef;
const NumFields : cardinal;
const FieldDelimiter : char;
const AlphaDelimiter : char;
const IncludeHeaderRow : boolean;
const FormatProc : LoadProc); stdcall;
exports UnloadDelimitedFormat name 'DBLoad_UnloadDelimitedFormat';
//*
// UnLoadDelimitedFormat - UnLoad to a file which is in Delimited format.
//
//
// UnLoadDelimitedFormat unloads the data from the database to a file
// which is in a Delimited format using the relations and fields
// that were defined in the FieldTable. The fields will be unloaded
// in the same order as they were defined.
//
// CALLING SEQUENCE -
//
// UnLoadDelimitedFormat (FileName, FieldTable, NumFields,
// FieldDelimiter, AlphaDelimiter, FormatProc)
//
// ENTRY -
//
// FileName : array of char
// Name of the DIF file to unload to.
//
// FieldTable : array of LoadDef
// Array of Relation-Field names to unload.
//
// NumFields : cardinal
// Number of Relation-Field names in the FieldTable array.
//
// FieldDelimiter : char
// The character to use between the field values
//
// AlphaDelimiter : char
// The character to use around an alpha field value
//
// IncludeHeaderRow : boolean
// The first line of the data file will be a header row of the field names.
//
// FormatProc : LoadProc
// procedure to modify memory records, read and write records.
//
// EXAMPLE -
//
// See bottom of .DEF file
//
procedure UnloadDIFFormat
(const FileName : array of char;
const Title : array of char;
var FieldTable : array of LoadDef;
const NumFields : cardinal;
const FormatProc : LoadProc); stdcall;
exports UnloadDIFFormat name 'DBLoad_UnloadDIFFormat';
//*
// UnLoadDIFFormat - UnLoad to a file in DIF format.
//
//
// UnLoadDIFFormat unloads the data from the database to a file
// which is in a DIF format using the relations and fields
// that were defined in the FieldTable. The fields will be unloaded
// in the same order as they were defined.
//
// CALLING SEQUENCE -
//
// UnLoadDIFFormat (FileName, Title, FieldTable, NumFields, FormatProc)
//
// ENTRY -
//
// FileName : array of char
// Name of the DIF file to unload to.
//
// Title : array of char
// The title to be put in the DIF file.
//
// FieldTable : array of LoadDef
// Array of Relation-Field names to unload.
//
// NumFields : cardinal
// Number of Relation-Field names in the FieldTable array.
//
// FormatProc : LoadProc
// procedure to modify memory records, read and write records.
//
// EXAMPLE -
//
// See bottom of .DEF file
//
procedure UnloadSDFFormat
(const FileName : array of char;
var FieldTable : array of LoadDef;
const NumFields : cardinal;
const FormatProc : LoadProc); stdcall;
exports UnloadSDFFormat name 'DBLoad_UnloadSDFFormat';
//*
// UnLoadSDFFormat - UnLoad to a file which is in SDF format.
//
//
// UnLoadSDFFormat unloads the data from the database to a file
// which is in a SDF format using the relations and fields
// that were defined in the FieldTable. The fields will be unloaded
// in the same order as they were defined.
//
// CALLING SEQUENCE -
//
// UnLoadSDFFormat (FileName, FieldTable, NumFields, FormatProc)
//
// ENTRY -
//
// FileName : array of char
// Name of the DIF file to unload to.
//
// FieldTable : array of LoadDef
// Array of Relation-Field names to unload.
//
// NumFields : cardinal
// Number of Relation-Field names in the FieldTable array.
//
// FormatProc : LoadProc
// procedure to modify memory records, read and write records.
//
// EXAMPLE -
//
// See bottom of .DEF file
//
procedure UnloadSDIFormat
(const FileName : array of char;
var FieldTable : array of LoadDef;
const NumFields : cardinal;
const FormatProc : LoadProc); stdcall;
exports UnloadSDIFormat name 'DBLoad_UnloadSDIFormat';
//*
// UnLoadSDIFormat - UnLoad to a file in SDI format.
//
//
// UnLoadSDIFormat unloads the data from the database to a file
// which is in a SDI format using the relations and fields
// that were defined in the FieldTable. The fields will be unloaded
// in the same order as they were defined.
//
// CALLING SEQUENCE -
//
// UnLoadSDIFormat (FileName, FieldTable, NumFields)
//
// ENTRY -
//
// FileName : array of char
// Name of the SDI file to unload to.
//
// FieldTable : array of char
// Array of Relation-Field names to unload.
//
// NumFields : cardinal
// Number of Relation-Field names in the FieldTable array.
//
// EXAMPLE -
//
// See bottom of .DEF file
//
procedure QuickLoadSDF
(const FileName : array of char;
var FieldTable : array of LoadDef;
const NumFields : cardinal;
const FormatProc : QuickProc); stdcall;
exports QuickLoadSDF name 'DBLoad_QuickLoadSDF';
//*
// QuickLoadSDB - A highly optimized load from an SDF format file.
//
//
// This procedure performs a highly optimized load using various Sage
// procedures such as ProcessAdd. An index must be rebuilt afterwards
// by the calling program using Sage.RebuildIndex. The 'FormatProc'
// for this procedure is different than the standard load format, giving
// a view of the line to be loaded and allowing modification or rejection
// of that line as well as the standard discontinuance of the process.
//
// It is assumed that all of the relations that are involved in this
// process are already open when this procedure is called.
//
// CALLING SEQUENCE -
//
// QuickLoadSDF (FileName, FieldTable, NumFields, FormatProc)
//
// ENTRY -
//
// FileName : array of char
// Name of the SDF file to load from.
//
// FieldTable : array of LoadDef
// Array of Relation-Field names to load.
//
// NumFields : cardinal
// Number of Relation-Field names in the FieldTable array.
//
// FormatProc : QuickProc
// Procedure that allows the modification or rejection of the input
// line, or discontinuance of the process.
//
procedure UnloadDumpFormat
(const DataDumpFile : array of char;
const BlockDumpFile : array of char;
const Path : array of char;
const Relation : array of char;
const KeyField : array of char); overload; stdcall;
exports UnloadDumpFormat (const DataDumpFile : array of char;
const BlockDumpFile : array of char;
const Path : array of char;
const Relation : array of char;
const KeyField : array of char) name 'DBLoad_UnloadDumpFormat';
//*
// UnloadDumpFormat - Dump data to two files in an internal ASCII format.
//
//
// This procedure dumps the data to ascii files. The block data fields
// are dumped to a seperate file.
//
// CALLING SEQUENCE -
//
// UnloadDumpFormat (DataDumpFile, BlockDumpFile, Path,
// Relation, KeyField);
//
// ENTRY -
//
// DataDumpFile : array of char
// Name of the file to get the relation field data.
//
// BlockDumpFile : array of char
// Name of the file to get the block data.
//
// Path : array of char
// Path to the files being dumped.
//
// Relation : array of char
// Name of the relation to read through.
//
// KeyField : array of char
// Name of the key field to use when dumping.
//
procedure UnloadDumpFormat
(const DataDumpFile : string;
const BlockDumpFile : string;
const Path : string;
const Relation : string;
const KeyField : string); overload; stdcall;
exports UnloadDumpFormat (const DataDumpFile : string;
const BlockDumpFile : string;
const Path : string;
const Relation : string;
const KeyField : string) name 'DBLoad_STRUnloadDumpFormat';
//*
// STRUnloadDumpFormat - See documentation of UnloadDumpFormat.
//
procedure LoadDumpFormat
(const DataDumpFile : array of char;
const BlockDumpFile : array of char;
const Path : array of char;
const Relation : array of char;
const KeyField : array of char); overload; stdcall;
exports LoadDumpFormat (const DataDumpFile : array of char;
const BlockDumpFile : array of char;
const Path : array of char;
const Relation : array of char;
const KeyField : array of char) name 'DBLoad_LoadDumpFormat';
//*
// LoadDumpFormat - Load data from two files in an internal ASCII format.
//
//
// This procedure loads the data from ascii files. The block data fields
// were dumped to a seperate file.
//
// CALLING SEQUENCE -
//
// LoadDumpFormat (DataDumpFile, BlockDumpFile, Path,
// Relation, KeyField);
//
// ENTRY -
//
// DataDumpFile : array of char
// Name of the file containing the relation field data.
//
// BlockDumpFile : array of char
// Name of the file containing the block data.
//
// Path : array of char
// Path to the files being loaded.
//
// Relation : array of char
// Name of the relation to add data to.
//
// KeyField : array of char
// Name of the key field to use loading.
//
procedure LoadDumpFormat
(const DataDumpFile : string;
const BlockDumpFile : string;
const Path : string;
const Relation : string;
const KeyField : string); overload; stdcall;
exports LoadDumpFormat (const DataDumpFile : string;
const BlockDumpFile : string;
const Path : string;
const Relation : string;
const KeyField : string) name 'DBLoad_STRLoadDumpFormat';
//*
// STRLoadDumpFormat - See documentation of LoadDumpFormat.
//
Send mail to
warren.merrill@inl.gov
with questions or comments about this web site.
Copyright © 1989-2006 Battelle Energy Alliance