home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Black Box 4
/
BlackBox.cdr
/
w3_prog
/
db3tpwdl.arj
/
DB3DLUN.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1991-09-12
|
3KB
|
89 lines
{This unit must be USEd by programs that call procedures in the
db3dll DLL. It contains the declarations and types }
UNIT db3DlUn;
INTERFACE
CONST
MAX_HEADER = 4129; { = maximum length of dBASE III header }
MAX_BYTES_IN_RECORD = 4000; { dBASE III record limit }
MAX_FIELDS_IN_RECORD = 128; { dBASE III field limit }
BYTES_IN_MEMO_RECORD = 512; { dBASE III memo field record size }
{ Valid field types }
ValidTypes : SET OF Char = ['C', 'N', 'L', 'M', 'D'];
{ Special Error codes for .DBF files }
NOT_DB_FILE = $80; { first byte was not a $3 or $83 or a $2 (dBASE II)}
INVALID_FIELD = $81;{ invalid field type was found }
REC_TOO_HIGH = $82; { tried to read a record beyond the correct range }
PARTIAL_READ = $83; { only a partial record was read }
TYPE
_Str64 = STRING[64];
_HeaderType = ARRAY[0..MAX_HEADER] OF Byte;
_FieldDescType = ARRAY[0..31] OF Byte;
_dRec = ^_DataRecord;
_DataRecord = ARRAY[0..MAX_BYTES_IN_RECORD] OF Byte;
_HeaderPrologType = ARRAY[0..31] OF Byte;
_dbfFile = FILE;
_FieldRecord = RECORD
Name : String[10];
Typ : Char;
Len : Byte;
Dec : Byte;
Off : Integer;
END;
_FieldArray = ARRAY[1..MAX_FIELDS_IN_RECORD] OF _FieldRecord;
_dFields = ^_FieldArray;
_MemoRecord = ARRAY[1..BYTES_IN_MEMO_RECORD] OF Byte;
_MemoFile = FILE OF _MemoRecord;
_StatusType = (NotOpen, NotUpdated, Updated);
dbfRecord = RECORD
FileName : String[64];
dFile : _dbfFile;
HeadProlog : _HeaderPrologType;
dStatus : _StatusType;
WithMemo : Boolean;
DateOfUpdate : String[8];
NumRecs : Longint;
HeadLen : Integer;
RecLen : Integer;
NumFields : Integer;
Fields : _dFields;
CurRecord : _dRec;
END;
PROCEDURE GetDbfRecord(VAR D : dbfRecord; RecNum : Longint; VAR dbfError: Integer);
{Gets one record to buffer}
PROCEDURE PutDbfRecord(VAR D : dbfRecord; RecNum : Longint; VAR dbfError: Integer);
{Puts one record in file}
PROCEDURE AppendDbf(VAR D : dbfRecord; VAR dbfError: Integer);
{Appends one record to end of file}
PROCEDURE CloseDbf(VAR D : dbfRecord; VAR dbfError: Integer);
{Closes a database}
PROCEDURE OpenDbf(VAR D : dbfRecord; VAR dbfError: Integer);
{Opens a databse}
PROCEDURE CreateDbf(VAR D: dbfRecord; filename: _Str64; numfields: Integer;
fldarrayptr : _dFields; VAR dbfError: Integer);
{
Call CreateDbf with the full pathname of the file that you want
to create (filename), the number of fields in a record (numfields),
and a pointer to an array of _FieldRecord (fldarrayptr). The procedure
will initialize all the data structures in the dbfRecord (D).
dbfError must be an integer variable declared in the calling
unit. On return it will hold any error code.
}
IMPLEMENTATION
PROCEDURE GetDbfRecord; external 'DB3DLL' index 1;
PROCEDURE PutDbfRecord; external 'DB3DLL' index 2;
PROCEDURE AppendDbf; external 'DB3DLL' index 3;
PROCEDURE CloseDbf; external 'DB3DLL' index 4;
PROCEDURE OpenDbf; external 'DB3DLL' index 5;
PROCEDURE CreateDbf; external 'DB3DLL' index 6;
end.