home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-01-31 | 53.3 KB | 1,924 lines |
- This documentation was written using Borland's MicroStar word
- processor.
-
- THIS SOFTWARE IS PROTECTED BY A COPYRIGHT DULY REGISTERED WITH THE
- U.S. COPYRIGHT OFFICE. PIRACY WILL NOT GO UNPUNISHED (IN THIS LIFE OR
- THE NEXT.)
-
- (****************************************)
- (* TPDB 3.14 *)
- (* Turbo Pascal Tools for dBASE *)
- (* *)
- (* Turbo Pascal 6.0 *)
- (* Object - Oriented Database Toolbox *)
- (* Utilizing dBASE Compatible Data *)
- (* Files *)
- (* *)
- (* Copyright 1990 *)
- (* Brian Corll *)
- (* and Ten B.C. Micro Systems *)
- (* All Rights Reserved *)
- (* dBASE, dBASE III, and dBASE *)
- (* III Plus are registered *)
- (* trademarks of Ashton-Tate Corp. *)
- (* *)
- (* Turbo Pascal is a registered *)
- (* trademark of Borland Int. Corp. *)
- (* *)
- (* Version 3.14 January,1991 *)
- (* *)
- (****************************************)
- (* Portions copyright 1984,1990 by *)
- (* Borland International Corp. *)
- (****************************************)
-
-
- TPDB is a toolbox of Turbo Pascal 6.0 units which allow
- you to access, index, search, read and write database
- files that were created with dBASE III or III Plus, using
- 75+ Turbo Pascal procedures and functions written
- specifically for these purposes, and implementing
- object-oriented techniques. This toolbox supports multiple
- data files and associated indexes (NOT dBASE INDEXES !)
- limited only by available memory and file handles allowed
- by DOS. Index keys can be up to 254 characters, and can be
- composed of multiple fields or expressions which evaluate
- to a string not longer than 254 characters.
-
- ************************************************************
- * Technical Support *
- ************************************************************
- * *
- *Questions/comments can be left for me on the InterLink or*
- *FidoNet Pascal or dBASE conferences. On FidoNet, I am a*
- *point, 1:270/111.3 *
- * *
- ************************************************************
- *My CompuServe ID is 73067,3310. *
- ************************************************************
-
- This program is being distributed under the Shareware
- concept.
-
- If you like this program and use it, a registration fee of
- $ 19.95 is required for non-profit users. Commercial users
- MUST register for a one-time, royalty-free registration
- fee of $ 29.95. Registered users will receive source code
- for TPDB.tpu, TPDBDATE.tpu, TPDBScrn.tpu, TPDBStr.tpu, and
- TPDBSort.tpu. See the file REGISTER.FRM. Registration also
- includes free technical support, within the limitations of
- my time and resources.
-
- NOTA BENE: This registration fee is intended to cover my
- personal time and expense in developing, documenting,
- distributing, and supporting this toolbox, and does not
- constitute the sale of the code contained therein.
-
-
- Write to:
-
- SoftIron
- Brian Corll
- 1002 East Simpson Street
- Mechanicsburg,PA 17055
-
- Make checks payable to Brian Corll.
-
- DISCLAIMER
-
- This program is provided "as is" without warranty of any
- kind, either express or implied, included but not limited
- to the implied warranty of merchantability and fitness for
- a specific purpose. The entire risk as to the quality and
- performance of this program is with you.
-
- In no event will the author be liable to you for any
- damages, including any lost profits, lost savings or other
- incidental or consequential damages arising out of the use
- of or inability to use this program.
-
- That said, please be assured that I have spent many long
- hours trying to make this toolbox the best it can be, and
- I'm working to make it even better !
-
- (**********************************)
- (* Interface Listing for TPDB.pas *)
- (**********************************)
-
-
- Unit TPDB;
-
- {This version is Version 3.14 January, 1991}
-
-
- (***********************************)
- (* Object -Oriented *)
- (* Turbo Pascal 6.0 Unit *)
- (* for Accessing dBASE III *)
- (* files. *)
- (* Copyright 1990 *)
- (* Brian Corll *)
- (* All Rights Reserved *)
- (* dBASE is a registered *)
- (* trademark of Ashton-Tate, Inc. *)
- (* Version 3.14 January,1991 *)
- (***********************************)
- (* Portions Copyright 1984,1990 *)
- (* Borland International Corp. *)
- (***********************************)
-
-
- INTERFACE
-
- Uses CRT,Dos,TPDBINDX,TPDBDate,TPDBScrn,TPDBStr;
-
-
- (******************************)
- (* Global VARiables *)
- (******************************)
-
- CONST
-
- (**************************************************************************)
- MaxInds = 10; {Maximum number of indexes per file. Change this as needed.}
- (**************************************************************************)
-
- AutoWrap : Boolean = FALSE;
- {Set this to TRUE to enable wrapping of field input.}
-
- { These are screen editing control keys:
- CursorDown = ^X;
- CursorEND = ^F;
- CursorHome = ^A;
- CursorLeft = ^S;
- CursorRight = ^D;
- CursorUp = ^E;
- DelKey = ^G;
- Escape = ^[;
- ExtKey : Boolean = FALSE;
- PageDown = ^C;
- PageUp = ^R;
- Return = ^M;
- TabKey = #9;}
-
- { These constants determine whether or not index keys are unique:
- NoDuplicates = 0;
- Duplicates = 1;}
-
- Filler : Char = #32; {This is the character displayed for blank
- portion of fields during editing and display.}
-
- {Numeric processing minimum and maximum values
- MaxLong = 2147483647;
- MaxReal = 3.4E37;
- MinLong = -2147483647;
- MinReal = 1.5E-45;}
-
-
-
- UpperCase : Boolean = FALSE; {Turns upper case conversion ON/OFF
- during screen input.}
-
- {Date format constants}
- {Used by SetDateFormat procedure}
- French = 1; {dd/mm/yy}
- German = 2; {dd.mm.yy}
- Italian = 3; {dd-mm-yy}
- American = 4; {mm/dd/yy}
- British = 5; {dd/mm/yy}
- Ansi = 99;{yy.mm.dd}
-
-
-
- Type
- Str2 = String[2];
- Str4 = String[4];
- Str5 = String[5];
- Str6 = String[6];
- Str8 = String[8];
- Str10 = String[10];
- Str15 = String[15];
- Str20 = String[20];
- Str30 = String[30];
- Str60 = String[60];
- Str80 = String[80];
- Str132 = String[132];
- Str254 = String[254];
- CharSet = Set of Char;
- ByteSet = Set of Byte;
-
- FileName = String[66];
- DBRecPtr = ^DBType;
- DBType = Array[1..4000] of Char; (* dBASE record buffer *)
-
- DBHeader = RECORD (* dBASE file header *)
- DBType : Byte;
- Year : Byte;
- Month : Byte;
- Day : Byte;
- RecCount : LongInt;
- Location : Integer;
- RecordLen : Integer;
- Reserved : Array[1..20] of Byte;
- Terminator : Char;
- END;
-
- DBField = Record (* DBF field descriptors *)
- FieldName : Array[1..11] of Char;
- FieldType : Byte;
- FieldAddress : LongInt;
- FieldLen : Byte;
- FieldDec : Byte;
- Reserved : Array[1..14] of Char;
- END;
-
- HeadPtr = ^DBHeader;
- PosPtr = ^DBEditArray;
- FieldPtr = ^FieldArray;
- DBEditArray = Array[1..2,1..128] of Integer;
- FieldArray = Array[1..128] of DBField;
-
- DBIndex = RECORD (* Index file control record *)
- Ndx : IndexFile;
- NdxID : BYTE;
- NdxName : FileName;
- Open : BOOLEAN;
- END;
-
- NdxArray = ARRAY[1..MaxInds] OF DBIndex;
- NdxPtr = ^NdxArray;
-
- (*****************************************************************************)
- (* Database File Object Declaration *)
- (*****************************************************************************)
-
- DataObject = ^DBF;
-
- DBF = OBJECT {The main, and only, object.}
- DBFName : FileName;
- DBFile : File;
- Header : HeadPtr;
- Fields : FieldPtr;
- Positions : ^DBEditArray;
- DBFOpen : BOOLEAN;
- IndsOpen : BOOLEAN;
- Indexes : NdxPtr;
- DBRecord : ^DBType;
- DBRecNum : LONGINT;
- TotalRecs : LONGINT;
- NumFields : BYTE;
- MAlloc : BOOLEAN;
- Start,Stop : INTEGER;
- FUNCTION Add(Field1,Field2 : Byte):string;VIRTUAL;
- PROCEDURE AddDBKey(NdxID : BYTE;KeyStr : DBKey);VIRTUAL;
- PROCEDURE AddDBRec;VIRTUAL;
- FUNCTION Allocated : BOOLEAN;
- PROCEDURE AppendBlank;VIRTUAL;
- PROCEDURE BailOut;VIRTUAL;
- FUNCTION BinSearch(FieldNo : BYTE;
- Position : Integer;SearchKey : DBKey) : LONGINT;
- FUNCTION BOF : Boolean;VIRTUAL;
- PROCEDURE CloseDBIndex(NdxID : BYTE);VIRTUAL;
- PROCEDURE DBReset;VIRTUAL;
- PROCEDURE DelDBKey(KeyStr : DBKey;NdxID : BYTE);VIRTUAL;
- FUNCTION Deleted : Boolean;VIRTUAL;
- PROCEDURE Display;VIRTUAL;
- FUNCTION Divide(Field1,Field2 : Byte):string;VIRTUAL;
- DESTRUCTOR Done;VIRTUAL;
- FUNCTION DBEOF : BOOLEAN;VIRTUAL;
- FUNCTION Field(FNo : Byte) : string;VIRTUAL;
- PROCEDURE FillRecs(NumRecs : LongInt);VIRTUAL;
- PROCEDURE Find(NdxID : BYTE;SearchStr : string);VIRTUAL;
- PROCEDURE FlushDB;VIRTUAL;
- PROCEDURE Get(FNo,X,Y : Byte);VIRTUAL;
- PROCEDURE GetDBRec(RecordNumber : LongInt);VIRTUAL;
- FUNCTION GetField(RecordNo : LongInt;FNo : Byte) : String;VIRTUAL;
- PROCEDURE GoBottom;VIRTUAL;
- PROCEDURE GoTop;VIRTUAL;
- FUNCTION IIF(BoolVAR : Boolean;IfTRUE,IfFALSE : String) : String;VIRTUAL;
- PROCEDURE IndexOn(NdxID : BYTE;NdxName : FileName;
- NdxField : BYTE;DupFlag : BYTE);
- CONSTRUCTOR Init(DBName : FileName);
- FUNCTION LastRec : LONGINT;
- FUNCTION Locate(FieldNo : BYTE;SearchStr : String) : BOOLEAN;
- PROCEDURE LookUp(SearchStr : string;NdxID : BYTE);VIRTUAL;
- PROCEDURE MakeDBIndex(NdxID : BYTE;DBIndexName : FileName;KeyLen,Status : Integer);VIRTUAL;
- PROCEDURE Mark;VIRTUAL;
- FUNCTION Mul(Field1,Field2 : Byte):string;VIRTUAL;
- PROCEDURE NextDBKey(NdxID : BYTE;KeyStr : DBKey);VIRTUAL;
- PROCEDURE NewDBRec;VIRTUAL;
- PROCEDURE NextRec;VIRTUAL;
- PROCEDURE OpenDBIndex(NdxID : BYTE;DBIndexName : FileName;KeyLen,Status : Integer);VIRTUAL;
- PROCEDURE Pack;VIRTUAL;
- PROCEDURE PrevDBKey(NdxID : BYTE;KeyStr : DBKey);VIRTUAL;
- PROCEDURE PrevRec;VIRTUAL;
- PROCEDURE PutDBRec(RecordNumber : LongInt);VIRTUAL;
- PROCEDURE ReadDBHeader;VIRTUAL;
- PROCEDURE Recall;VIRTUAL;
- FUNCTION RecCount : LONGINT;VIRTUAL;
- FUNCTION RecNo : LONGINT;VIRTUAL;
- PROCEDURE Repl(FNo : Byte;InStr : string);VIRTUAL;
- PROCEDURE ReplEach(FNo : Byte;InStr : String);VIRTUAL;
- PROCEDURE Save;VIRTUAL;
- PROCEDURE Say(FNo,Row,Col : Byte);VIRTUAL;
- PROCEDURE ShowStatus;VIRTUAL;
- PROCEDURE Skip;VIRTUAL;
- FUNCTION Sub(Field1,Field2 : Byte) : string;VIRTUAL;
- FUNCTION Sum(FNo : Byte) : Real;VIRTUAL;
- PROCEDURE WriteDBHeader;VIRTUAL;
- PROCEDURE Zap;VIRTUAL;
- END;
-
- (****************************************************************************)
- (* END Object Declaration *)
- (****************************************************************************)
-
- Const
-
- Up : CharSet = [CursorUp];
- Down : CharSet = [CursorDown,Return];
- Next : CharSet = [Escape];
-
- VAR
- FilesOpen : BYTE;
- UCKey : BOOLEAN;
- ErrCode : INTEGER;
- Found : BOOLEAN;
- Ch,BC : CHAR;
- Normal,Reverse : BYTE;
- Decimals : Byte;
- TempFile : File;
- K : Byte;
- NumLen : Byte;
- Y,M,D,DW : WORD;
- FromPack : BOOLEAN;
- DateFormat : BYTE;
-
- (**********************************)
- (* PROCEDUREs and FUNCTIONs *)
- (**********************************)
-
- PROCEDURE Beep;
- {Sound a couple of tones.}
-
- FUNCTION BoolToStr(Param : Byte;IfTRUE,IfFALSE : Char): String;
-
-
- PROCEDURE CheckScreen(VAR CurrPos:Byte;BC:Char;Up,Down:CharSet;Low,High:Byte);
- {Used in full screen editing.}
-
- PROCEDURE CopyFile(Source,Dest : FileName);
-
- PROCEDURE FlashFill(Row,Col,Rows,Cols,Attr : Byte;Ch : Char);
- {Fill a region of the screen with a specified color and character.}
-
- FUNCTION GetBoolean(VAR Param:Byte;IfTRUE,IfFALSE:Char;X,Y:Byte):Char;
-
- FUNCTION GetByte(VAR Param:Byte;LowLim,UpLim,Len,X,Y:Byte):Char;
-
- FUNCTION GetInteger(VAR Param:Integer;LowLim,UpLim:Integer;Len,X,Y:Byte):Char;
- {Input an integer.}
-
- FUNCTION GetLongInt(VAR Param:LongInt;LowLim,UpLim:LongInt;Len,X,Y:Byte):Char;
- {Input a long integer.}
-
- FUNCTION GetReal(VAR Param : Real; LowLim, UpLim : Real; Len, X, Y : Word) : Char;
- {Input a real number.}
-
- FUNCTION GetString(VAR Param : String; Len, X, Y : Byte) : Char;
- {Input a string.}
-
- FUNCTION Input(VAR S:String;Term:CharSet;L,X,Y:Byte;VAR BC:Char):String;
-
- FUNCTION IntToStr(Number : LongInt): String;
-
- FUNCTION Max(N1,N2 : Integer) : Integer;
-
- FUNCTION Min(N1,N2 : Integer) : Integer;
-
- PROCEDURE Prompt(Row,Col : Byte;PromptStr : Str80);
- {Display a prompt at a specified row and column.}
-
- FUNCTION ReadChar : Char;
-
- PROCEDURE ReadKB (VAR ExtKey: Boolean; VAR Ch: Char);
-
- FUNCTION RealToStr(Number : Real): String;
-
- PROCEDURE SetDateFormat(Format : BYTE);
-
- PROCEDURE SetDBColor(FG,BG : Byte);
- {Set initial foreground and background colors.}
-
- PROCEDURE Wait;
- {Wait for a key press and display a message.}
-
- (************************************************************)
- (* Documentation for Procedures and Functions in TPDB.tpu *)
- (************************************************************)
-
- Add function
-
- Function
-
- Adds two numeric fields
-
- Syntax
-
- Add(Field1,Field2 : Byte);
-
- Remarks
-
- Field1 and Field2 are the order numbers of the
- respective fields as they appear in the .DBF
- structure.
-
- *************************
-
- AddDBKey procedure
-
- Function Adds a key string to the index currently in
- use.
-
- Syntax
- AddDBKey(NdxID : BYTE;KeyStr : DBKey);
-
- Remarks
-
- KeyStr is any string not longer than 254
- characters. A field must be converted to a
- string by using the Field function
- (q.v.).
-
- NdxID is the index ID number.
-
- Restrictions
-
- Length(KeyStr) must be in the range of 1..254
- characters. All expressions must evaluate to
- a single string not more than 254 characters
- in length.
-
-
- *************************
-
- AddDBRec procedure
-
- Function
-
- Adds a new record to the .DBF file in use.
-
- Syntax
-
- AddDBRec;
-
- Remarks
-
- A new record must first be created with a call
- to the NewDBRec procedure.
-
- ************************
-
- AppendBlank procedure
-
- Function
-
- Appends a new blank record to the current
- database file.
-
- Syntax
-
- AppendBlank;
-
- ***********************
-
- BinSearch function
-
- Function
-
- Performs a binary search on a sorted
- database, searching for s specified key
- string in a specified field, starting from
- a specific position within the field.
- Syntax
-
- BinSearch(FieldNo : BYTE;Position : Integer;
- SearchKey : DBKey) : LONGINT;
-
- ***********************
-
- BlockCursor procedure
-
- Function
-
- Turns on a block cursor.
-
- Syntax
-
- BlockCursor;
-
- ************************
-
- BOF function
-
- Function
-
- Returns beginning of file status of a .DBF
- file.
-
- Syntax
-
- BOF
-
- Result Type
-
- Boolean
-
-
-
- ************************
-
- CalcDate function
-
- Function
-
- Add or subtract days,months, or years from two
- dates.
-
- Syntax
-
- CalcDate(InDate:DateStr;Days,Months,Years:
- integer): DateStr;
-
- *************************
-
- CDOW function
-
- Function
-
- Returns character day of week - i.e.
- 'Monday','Tuesday',etc.
-
- Syntax
-
- CDOW(InDate : DateStr): DayStr;
-
- *************************
-
- CMonth function
-
- Function
-
- Returns character month - i.e. 'March'
-
- Syntax
-
- CMonth(InDate : DateStr) : Str9;
-
- *************************
-
- ChAttr procedure
-
- Function
-
- Changes the display attribute of a
- specified number of characters on a
- specified line.
-
- Syntax
-
- ChAttr(Number : Word; Row, Col, Attr : Word);
-
- Remarks
-
- This procedure is contained in ATTR.obj.
-
- **************************
-
- ChAllAttr procedure
-
- Function
-
- Changes the display attribute of a
- specified screen block.
-
-
- Syntax
-
- ChAllAttr(Row,Col,Rows,Cols,Attr : Word);
-
- **************************
-
- CheckScreen procedure
-
- Function
-
- Checks the current field being edited against
- minimum and maximum limits of fields
- displayed.
- K
- Syntax
-
- CheckScreen(VarCurrPos:Byte;BC:Char;Up,Down:CharSet;
- Low,High:Byte);
-
- Remarks
-
- CurrPos is the number of the field currently
- being edited in the editing loop (see DEMO.pas
- for an example).
-
- BC is the terminating character when field
- editing has been completed.
-
- Up and Down are the character sets which
- contain the terminating characters which allow
- you to move from one field to another, up or
- down. In TPDB, they are declred as constants,
- as follows:
-
- Up : CharSet = [CursorUp]; Down :
- CharSet = [CursorDown,Return];
-
-
- Low and High are the low and high numbers of
- the displayed fields.
-
- ************************
-
- CloseDBFile procedure
-
- Function
-
- Closes the currently open .DBF file.
-
- Syntax
-
- CloseDBFile;
-
- Remarks
-
- This procedure is error-checked.
-
- ************************
-
- CloseDBIndex procedure
-
- Function
-
- Closes the index currently in use.
-
- Syntax
-
- CloseDBIndex(NdxID : BYTE);
-
- Remarks
-
- NdxID is a number assigned to the index. This
- procedure is error-checked.
-
- ************************
-
- CompDates function
-
- Function
-
- Compares two dates and calculates the number
- of days between them.
-
- Syntax
-
- CompDates(Date1,Date2 : DateStr):Word;
-
- *************************
-
- CTOD function
-
- Function
-
- Converts a .DBF compatible date field to a
- word date type for date arithmetic.
-
- Syntax
-
- CTOD(InDate: DateStr) : DateType;
-
- *************************
-
- CursorOn and CursorOff procedures
-
- Function
-
- Turn cursor on and off
-
- Syntax
-
- CursorOn; CursorOff;
-
- Externally declared in Flash.obj.
-
- *************************
-
-
- DBReset procedure
-
- Function
-
- Resets a .DBF file, moving the file pointer to
- record 1.
-
- Syntax
-
- DBReset;
-
- Remarks
-
- This procedure is error-checked.
-
- ************************
-
- DelDBKey procedure
-
- Function
-
- Deletes a key string in the index currently in
- use.
-
- Syntax
-
- DelDBKey(KeyStr : DBKey;NdxID : BYTE);
-
- Remarks
-
- See documentation for AddDBKey procedure.
-
-
-
- *************************
-
-
- Deleted function
-
- Function
-
- Returns True if the curent record has been
- marked for deletion, False if it has not been
- marked.
-
- Syntax
-
- Deleted : boolean;
-
-
- ************************
-
- Display procedure
-
- Function
-
- Displays the current record in a partially
- formatted manner.
-
- Syntax
-
- Display;
-
- Remarks
-
- Date fields are formatted as MM/DD/YY.
-
- *************************
-
- Divide function
-
- Function
-
- Divides field1 BY field2
-
- Syntax
-
- Divide(Field1,Field2 : Byte):string;
-
- Remarks
-
- Field1 and Field2 are the order numbers of the
- respective fields as they appear in the .DBF
- structure.
-
- *************************
-
- Done DESTRUCTOR
-
- This destructor MUST be called when closing a database
- file. Calling this procedure closes all associated indexes
- at the same time.
-
- Syntax
- VAR
- Example : DataObject;
-
- DISPOSE(Example^,Done);
-
-
- *************************
-
- DTOC function
-
- Function
-
- Converts a word date type to a string
- compatible with .DBF date fields.
-
- Syntax
-
- DTOC(Julian: DateType) : DateStr;
-
- *************************
-
- EOF function
-
- Function
-
- Returns end-of-file status of a .DBF file.
-
- Syntax
-
- EOF
-
- Return Type
-
- Boolean
-
- ************************
-
- Field function
-
- Function
-
- Returns the string value of a specified field
- in a specified record in a .DBF file.
-
- Syntax
-
- Field(FNo : Byte) : string;
-
- Remarks
-
- FNo is the number of the field in the .DBF
- file structure. Date fields are not formatted.
-
- ************************
-
- FillRecs procedure
-
- Function
-
- Appends a specified number of blank records to
- a .DBF file.
-
- Syntax
-
- FillRecs(NumRecs : LongInt);
-
- ************************
-
- Find procedure
-
- Function
-
- Searches for a string in the currently open
- index.
-
- Syntax
-
- Find(NdxID : BYTE;SearchStr : string);
-
- Remarks
- NdxID is the ID number assigned to the
- current index. If the string is found, a
- value of True is returned in the global
- boolean variable Found. If the string is not
- found, a value of False is returned in Found.
-
- ************************
-
- Flash procedure
-
- Function
-
- Writes a string at a specified row and column,
- using a specified attribute, by direct video
- access.
-
- Syntax
-
- Flash(Row,Col, Attr:byte; Str : String);
-
- Remarks
-
- When setting attribute, constant folding can
- be used. See color constants in globals
- section.
-
- ************************
-
- FlashC procedure
-
- Function
-
- Writes a centered string at a specified row,
- using a specified attribute, by direct video
- access.
-
- Syntax
-
- FlashC(Row,Attr:Byte;Str : String);
-
- Remarks
-
- See remarks for Flash procedure.
-
- ************************
-
- FlashFill procedure
-
- Function
-
- Fills a specified screen block with a
- specified character and attribute.
-
- Syntax
-
- FlashFill(Row,Col,Rows,Cols,Attr :
- Byte;Ch : Char);
-
- Remarks
-
- See remarks for other Flash procedures.
-
- ************************
-
-
- FlushDB procedure
-
- Function
-
- Flushes records currently in memory to disk
- file.
-
- Syntax
-
- FlushDB;
-
- Remarks
-
- This procedure is error-checked.
-
-
- ************************
-
- FormDate function
-
- Function
-
- Formats a date string as stored in a .DBF file
- in the 'MM/DD/YY' format.
-
- Syntax
-
- FormDate(InDate:DateStr):String;
-
- *************************
-
- Get procedure
-
- Function
-
- Edits a specified field in the .DBF at a
- specified row and column.
-
- Syntax
-
- Get(FieldNumber,Row,Col : Byte);
-
- Remarks
-
- The following editing keys are active:
-
- Left cursor
- Right cursor
- Home
- End
- Backspace
- Delete
- Ctrl-Y (Deletes the entire field.)
-
-
- ************************
-
- GetDBRec procedure
-
- Function
-
- Locates and reads a specified record in a .DBF
- file.
-
- Syntax
-
- GetDBRec(RecordNumber : LongInt);
-
- ************************
-
-
- GetString procedure
-
- Function
-
- Allows screen input of a string, as in a
- search procedure.
-
- Syntax
-
- GetString(Var Parameter : String; Length,
- Row, Col : Byte) : Char;
-
- ************************
-
- GoBottom procedure
-
- Function
-
- Set the file pointer at the end of file.
-
- Syntax
-
- GoBottom;
-
- ************************
-
- GoTop procedure
-
- Function
-
- Sets the file pointer at the beginning of
- file.
-
- Syntax
-
- GoTop;
-
- ************************
-
-
- IIF function
-
- Function
-
- Evaluates a boolean variable and returns a
- string according to the value of the boolean.
-
- Syntax
-
- IIF(BoolVar : Boolean;IfTrue,IfFalse :
- String) : String;
-
- ************************
-
- IndexOn procedure
-
- Function
-
- Builds an index on a specified key field.
-
- Syntax
-
- IndexOn(NdxID : BYTE;NdxName : FileName;
- NdxField : BYTE;DupFlag : BYTE);
-
- Remarks
- NdxID is an ID number assigned to the current
- index. DupFlag may be a constant such as
- Duplicates or NoDuplicates.
-
- ************************
-
- Init CONSTRUCTOR
-
- Function
-
- Initializes a data object and opens the
- associated DBF file.
-
- Syntax
-
- Init(DBName : FileName);
- VAR
- Example : DataObject;
-
- NEW(Example,Init('example.dbf'));
-
- ************************
-
- JustL function
-
- Function
-
- Left justifies a string within a
- specified field length.
-
- Syntax
-
- JustL(InString: String; FieldLen:
- Integer): String;
-
- ************************
-
- LTrim function
-
- Function
-
- Trims leading spaces from a string.
-
- Syntax
-
- LTrim(InStr: String): String;
-
- *************************
-
- Locate procedure
-
- Function
-
- Searches sequentially through a DBF file for a
- specified search string, stopping at the first
- record which matches the search condition.
-
- Syntax
- Locate(FieldNo : BYTE;SearchStr : String) :
- BOOLEAN;
-
- ************************
-
- LookUp procedure
-
- Function
-
- Searches for a key string in an index, and sets
- the record pointer at the record containing the
- closest match.
-
- Syntax
-
- LookUp(SearchStr : string;NdxID: BYTE);
-
- ************************
-
- Lower function
-
- Function
-
- Converts a string to lower case.
-
- Syntax
-
- Lower(InStr: String): String; Externally
- declared in Flash.obj.
-
- *************************
-
- MakeDBIndex procedure
-
- Function
-
- Creates a new index file but does not
- build it.
-
- Syntax
- MakeDBIndex(NdxID : BYTE;DBIndexName :
- FileName;KeyLen,Status : Integer);
-
- Remarks
-
- DBIndexName can be a maximum of 66 chars
- in length and is the full path and name
- of the index file to be created. the key
- field.
-
- KeyLen is the length of the key field.
- Number are stored as strings in .DBF
- files, and can thus be used as keys
- without conversion.
-
- Status is defined as one of two
- constants: NoDuplicates, or Duplicates,
- according to whether or not duplicate
- keys will be allowed in the index.
-
-
- ************************
-
- Mark procedure
-
- Function
-
- Marks the current record for deletion.
-
- Syntax
-
- Mark;
-
-
- ************************
-
- Max function
-
- Function
-
- Determines the maximum of two integers
-
- Syntax
-
- Max(N1,N2 : Integer) : Integer;
-
- *************************
-
- Min function
-
- Function
-
- Determines the minimum of two integers
-
- Syntax
-
- Min(N1,N2 : Integer) : Integer;
-
- *************************
-
- Mon function
-
- Function
-
- Returns numeric value for the month in a
- date.
-
- Syntax
-
- Mon(InDate : DateStr) : Byte;
-
- *************************
-
- Mul function
-
- Function
-
- Multiplies two numeric fields.
-
- Syntax
-
- Mul(Field1,Field2 : Byte):string;
-
- Remarks
-
- Field1 and Field2 are the order numbers
- of the respective fields as they appear
- in the .DBF structure.
-
- *************************
-
- NewDBRec procedure
-
- Function
-
- Creates a new blank record in memory,
- ready for editing.
-
- Syntax
-
- NewDBRec;
-
- ************************
-
- NextDBKey procedure
-
- Function
-
- Moves file record pointer to the record
- number associated with the next key in an
- index.
-
- Syntax
-
- NextDBKey(NdxID : BYTE;KeyStr : DBKey);
-
- Remarks
-
- See documentation for AddDBKey
- procedure.
-
-
- ************************
-
- NextRec procedure
-
- Function
-
- Moves the file pointer to the next
- sequential record in the file.
-
- Syntax
-
- NextRec;
-
- ************************
-
- OpenDBIndex procedure
-
- Function
-
- Opens an index for search and updating.
-
- Syntax
-
- OpenDBIndex(NdxID : BYTE;DBIndexName :
- FileName;KeyLen,Status : Integer);
-
- Remarks
-
- DBIndexName can be a maximum of 66 chars
- in length and is the full path and name
- of the index file to be created. the key
- field.
-
- KeyLen is the length of the key field.
- Number are stored as strings in .DBF
- files, and can thus be used as keys
- without conversion.
-
- Status is defined as one of two
- constants: NoDuplicates, or Duplicates,
- according to whether or not duplicate
- keys will be allowed in the index.
-
-
- ************************
-
- Pack procedure
-
- Function
-
- Packs a .DBF files, removing records
- marked for deletion.
-
- Syntax
-
- Pack;
-
- ************************
-
- PadL function
-
- Function
-
- Pads a string with spaces on the left, to
- a specified field length.
-
- Syntax
-
- PadL(InStr: String; FieldLength:
- Integer): String;
-
- ************************
-
- PadR function
-
- Function
-
- Pads a string with spaces on the right,
- to a specified field length.
-
- Syntax
-
- PadR(InStr: String; FieldLength:
- Integer): String;
-
-
- ************************
-
- PrevDBKey procedure
-
- Function
-
- Moves file pointer to the record number
- corresponding to the previous key in an
- index.
-
- Syntax
-
- PrevDBKey(NdxID : BYTE;KeyStr : DBKey);
-
- Remarks
-
- See documentation for AddDBKey procedure.
-
-
- ************************
-
- PrevRec procedure
-
- Function
-
- Moves the file pointer to the previous
- sequemtial record in the file.
-
- Syntax
-
- PrevRec;
-
- ************************
-
- Prompt procedure
-
- Function
-
- Displays a prompt string at a specified
- row an column, using direct video writes.
-
- Syntax
-
- Prompt(Row,Col : Byte;PromptStr : Str80);
-
- ************************
-
- PutDBRec procedure
-
- Function
-
- Writes the current editing record to a
- specified record number in the .DBF file.
-
- Syntax
-
- PutDBRec(RecordNumber : LongInt);
-
- Remarks
-
- Be sure that the specified record number
- is the same as the one given in the call
- to GetDBRec.
-
- ************************
-
-
- ReadDBHeader procedure
-
- Function
-
- Reads the file header of a .DBF file into
- a buffer.
-
- Syntax
-
- ReadDBHeader;
-
- ************************
-
- Recall procedure
-
- Function
-
- Unmarks a record previously marked for
- deletion.
-
- Syntax
-
- Recall;
-
- ************************
-
- Repl procedure
-
- Function
-
- Replaces a specified field in a record
- with a specified string.
-
- Syntax
-
- Repl(FieldNumber : Byte;ReplStr :
- string);
-
- Remarks
-
- FieldNumber is the number of the field in
- the .DBF file structure. ReplStr is the
- string with which the field is to be
- replaced. When replacing date fields,
- remember that the date string must be in
- the form "19890214".
-
- ************************
-
- ReplEach procedure
-
- Function
-
- Replaces a specified field in each record
- in a .DBF file with a specified string.
-
- Syntax
-
- ReplEach(FieldNumber : Byte;ReplStr :
- String);
-
- Remarks
-
- FieldNumber is the number of the field in
- the .DBF file structure. ReplStr is the
- string with which the field is to be
- replaced. When replacing date fields,
- remember that the date string must be in
- the form "19890214".
-
- ************************
-
- Replicate function
-
- Function
-
- Fills a string with a specified number of
- a specified character.
-
- Syntax
-
- Replicate(Ch : Char;Count : word) :
- String; Externally declared in Flash.obj.
-
- ************************
-
- RTrim function
-
- Function
-
- Trims trailing blanks from a string.
-
- Syntax
-
- RTrim(InStr: String): String;
-
- ************************
-
- Save procedure
-
- Function
-
- Writes the current record to disk.
-
-
- Syntax
-
- Save;
-
- ***********************
-
- Say procedure
-
- Function
-
- Displays a particular field at a
- specified row and column.
-
- Syntax
-
- Say(FieldNumber,Row,Col : Byte);
-
- Remarks
-
- FieldNumber is the position of the field
- in the .DBF file structure.
-
- ************************
-
- SetDBColor
-
- Function
-
- Sets foreground and background color
- before a call to ClrScr.
-
- Syntax
-
- SetDBColor(FG,BG : Byte);
-
- ************************
-
- SetDateFormat procedure
-
- Function
-
- Sets date format to one of the following
- constants:
-
- French = 1; {dd/mm/yy}
- German = 2; {dd.mm.yy}
- Italian = 3; {dd-mm-yy}
- American = 4; {mm/dd/yy}
- British = 5; {dd/mm/yy}
- Ansi = 99;{yy.mm.dd}
-
- Syntax
- SetDateFormat(Format : Byte);
-
- Example
-
- SetDateFormat(Ansi);
-
- ************************
-
- ShowStatus procedure
-
- Function
-
- Displays status of .DBF file, after a
- call to ReadDBHeader.
-
- Syntax
-
- ShowStatus;
-
- ************************
-
- Skip procedure
-
- Function
-
- Skips to the next sequential record in a DBF.
-
- Syntax
-
- Skip;
-
- ************************
-
- SortOn procedure
-
- Function
-
- Sorts a DBF file to another DBF, on a key
- string expression of up to 254 characters
- in length.
-
- See SortDemo.pas and TPDBSort.pas for
- syntax and explanation.
-
- ***********************
-
- Sub function
-
- Function
-
- Subtracts two numeric fields - field2 is
- subtracted FROM field1.
-
- Syntax
-
- Sub(Field1,Field2 : Byte) : string;
-
- Remarks
-
- Field1 and Field2 are the order numbers
- of the respective fields as they appear
- in the .DBF structure.
-
- *************************
-
- Sum function
-
- Function
-
- Sums a numeric field in all records in a
- .DBF file.
-
- Syntax
-
- Sum(FNo : Byte) : Real;
-
-
-
- ************************
-
- TimeNow function
-
- Function
-
- Returns current time in formatted string.
-
- Syntax
-
- TimeNow : TimeStr;
-
- *************************
-
- Today function
-
- Function
-
- Returns current date in .DBF date field
- compatible format.
-
- Syntax
-
- Today : DateStr;
-
- *************************
-
- Upper function
-
- Function
-
- Converts a string to upper case.
-
- Syntax
-
- Upper(InStr: String): String; Externall
- declared in Flash.obj.
-
- ************************
-
- ValidDate function
-
- Checks whether a date is valid, and
- returns True or False.
-
- Syntax
-
- ValidDate(InDate : DateStr): boolean;
-
- *************************
-
- Wait procedure
-
- Function
-
- Displays a prompt, 'Press any key to
- continue...', and waits for a key press.
-
- Syntax
-
- Wait;
-
- ************************
-
- WriteDBHeader procedure
-
- Function
-
- Updates a .DBF file header.
-
- Syntax
-
- WriteDBHeader;
-
-
- ************************
-
- Zap procedure
-
- Function
-
- Deletes all records in a .DBF file.
-
- Syntax
-
- Zap;
-
- Remarks
-
- CAREFUL ! This procedure really does
- remove all records, completely rewriting
- the file.
-
- ************************
-
- (**** Revision History ****)
-
- 2/7/89 - Version 1.0 released
-
- 2/8/89 - Version 1.1 - fixed bug in numeric input
- that caused truncation of integers. Also, recompiled
- in $N-,$E+ state to allow for 8087 emulation on
- non-8087 machines. Fixed range error in array
- indexing.
-
- Renamed unit TPDB10.tpu to TPDB.tpu. Future versions
- will retain this name.
-
- 2/10/89 - Version 1.2 - Modified indexing routines to
- allow for index keys up to 254 characters.
-
- Added boolean variable, UCKey, which allows
- indexes to be created on upper case form of keys.
-
- Added procedures Prompt and Upper.
-
- Added procedures Flash, FlashC, and FlashFill.
-
- Added CheckScreen procedure.
-
- Expanded documentation and added demo files.
-
- Temporarily removed source code from this doc
- file pending further additions and decision on
- which source to include.
-
- 2/14/89 - Version 1.3 - Added TPDB error handler.
-
- Improved documentation.
-
- Fixed bug in Display procedure.
-
- Added Sum and Field functions, NextRec and
- PrevRec procedures.
-
- Added BOF and EOF functions.
-
- Added PrevDBKey and NextDBKey procedures.
-
- Added Repl and ReplEach procedures.
-
- Added FillRecs procedure.
-
-
- 2/22/89 - Version 2.0 - Modified indexing routines to
- allow key expressions which evaluate to a string to
- be passed to the indexing routines.
-
- Improved documentation.
-
- Added new assembler string and video handling
- procedures.
-
- Added source for TPDB.tpu.
-
- Added TPDBDate.tpu - date handling routines, with
- source.
-
- Added TPDBMath.tpu - mathematical functions, with
- source.
-
- Because of significant revisions and additions to the
- original source, released this version as version
- 2.0.
-
- 2/23/89 - Version 2.1 - fixed bug in array indexing
- in Display and Field procedures.
-
- 3/1/89 - Version 2.2 - modified Repl and Field
- procedures to use Move procedure. Added TPDBHigh.pas,
- a unit of high level calls. Documentation for high
- level calls is contained within the source code.
-
- 8/3/89 - Version 3.0 - Converted to object-oriented
- version. The number of DBF files and NDX files per DBF is
- limited now only by the amount of available memory and the
- DOS version in use. Procedures and functions added as
- documented above.
-
- 8/19/89 - Version 3.1 -
-
- - Procedure SetColor changed to SetDBColor to prevent conflicts
- when the Graph unit is used.
-
- - Procedure SetDateFormat was added to allow use of
- foreign date formats.
-
- Supported date formats are as follows:
- CONST
- French = 1; {dd/mm/yy}
- German = 2; {dd.mm.yy}
- Italian = 3; {dd-mm-yy}
- American = 4; {mm/dd/yy}
- British = 5; {dd/mm/yy}
- Ansi = 99;{yy.mm.dd}
-
- - Added procedures ChAttr and ChAllAttr to change
- displayed screen attributes.
-
- - Added TPDBSort.tpu, containing Procedure SortOn.
-
- - Added BinSearch routine, for searching sorted files of
- unique keys.
-
- - Version 3.11 - September, 1989 - moved all string
- handling functions into TPDBStr.pas. Moved most screen
- handling functions into TPDBScrn.pas.
-
- ********************************************************
- End of Documentation - TPDB Version 3.14
- Copyright 1990 Brian Corll
- ********************************************************
-
-
-
-
-