home *** CD-ROM | disk | FTP | other *** search
-
- TBTREE13 Copyright (c) 1988 Dean H. Farwell II
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- TBTREE13
-
- ( Turbo BTree version 1.3 )
-
- Quick Reference Guide
-
- Copyright (c) 1988 Dean H. Farwell II
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 1
-
-
-
- TBTREE13 Copyright (c) 1988 Dean H. Farwell II
-
-
- This reference guide is intended to simplify use of TBTREE13. It
- provides a listing of some of the procedures, functions, data types
- and constants available to the user. It is limited to those which are
- required by the user to use TBTREE. I have specifically excluded
- those items which I use internally between units but are of little
- value to you or those which could be used in other applications but
- are not necessary to use with TBTREE. You can still use them by
- referring to the particular unit in which they reside. This was done
- to simplify the learning process for the user and to give guidance
- concering which routines the user should reasonably be involved with.
-
- This guide is not intended to fully document the included items,
- especially the procedures and functions. The source code for the
- units contains much more indepth documentation. This guide is only
- meant to provide a place to turn when a quick refresher is required.
-
-
- Constants
- ---------
- MAXDATASIZE
- MAXDATASIZE = 65520;
- - maximum size for a data record (logical record)
- - LOGICAL unit
-
- MAXVALSIZE
- - MAXVALSIZE = 494;
- - Maximum size of an index entry
- - BTREE unit
-
- Types
- -----
-
- BufferSizeType
- - BufferSizeType = 0 .. MAXWORD;
- - Used for number of pages in buffer
- - PAGE unit
-
- Condition
- - Condition = (EX, (* Exists *)
- LT, (* Less Than *)
- LE, (* Less Than Or Equal To *)
- EQ, (* Equal To *)
- NE, (* Not Equal To *)
- GE, (* Greater Than Or Equal To *)
- GT); (* Greater Than *)
- - Used to specify selection criteria
- - NUMBERS unit
-
- DataSizeRange
- - DataSizeRange = 1 .. MAXDATASIZE;
- - Range for size of a logical record
- - LOGICAL unit
-
-
-
-
-
-
-
- 2
-
-
-
- TBTREE13 Copyright (c) 1988 Dean H. Farwell II
-
-
- LrList
- - LrList = record
- fName : FnString;
- currPage : PrNumber;
- current : LrNumber;
- count : LrNumber;
- case Boolean of
- TRUE : (lrArray : LogicalRecordsArray);
- FALSE : (page : SinglePage);
- end;
- - Type used for logical record lists. Never manipulate any of the
- fields directly. Only declare a variable of this type and use
- it as a parameter for the various routines supplied
- - LRECLIST unit
-
- SortFieldList
- - SortFieldList = ^SortField;
- - Used to form a linked list containing info about sort fields
- - SORT unit
-
- SortFieldPosition
- - SortFieldPosition = DataSizeRange;
- - Position of sort field (in bytes) within the data record
- - SORT unit
-
- StringCondition
- - StringCondition = (ST, (* String Starts With Substring *)
- CO, (* String Contains Substring *)
- EN); (* String Ends With Substring *)
- - Used to specify partial string match criteria
- - NUMBERS unit
-
- ValueType
- - ValueType = (INVALIDVALUE,
- BYTEVALUE,
- SHORTINTVALUE,
- INTEGERVALUE,
- LONGINTVALUE,
- WORDVALUE,
- STRINGVALUE,
- REALVALUE,
- SINGLEVALUE,
- DOUBLEVALUE,
- EXTENDEDVALUE,
- COMPVALUE);
- - Data types supported by TBTREE
- - COMPARE unit
-
- VSizeType = 1 .. MAXVALSIZE;
- - Size range for index entries
- - BTREE unit
-
-
- Procedures
- ----------
-
-
-
-
- 3
-
-
-
- TBTREE13 Copyright (c) 1988 Dean H. Farwell II
-
-
- AddFieldToSortList
- - procedure AddFieldToSortList(var sPtr : SortFieldList;
- pos : SortFieldPosition;
- vType : ValueType);
- - Used to add one sort field to a sort field list
- - SORT unit
-
- AddToLrList
- - procedure AddToLrList(lrNum : LrNumber;
- var lrLst : LrList);
- - Add a record to a logical record list (not normally needed
- except internally)
- - LRECLIST unit
-
- AppendTextFile
- - procedure AppendTextFile(fName : FnString;
- var fId : Text);
- - Checks open file buffer to see if file is open. If not it
- opens file and adds it to the buffer. In either case it returns
- the file id. It opens the file for appending.
- - FILEBUFF unit
-
- CreateFile
- - procedure CreateFile(var fName : FnString;
- fType : FileTypes);
- - Creates a file of the type specified. Appends the correct file
- extension
- - FILES unit
-
- CreateIndex
- - procedure CreateIndex(var iFName : FnString;
- valSize : VSizeType;
- dataFName : FnString;
- valType : ValueType);
- - Create a new index
- - BTREE unit
-
- CloseAllFiles
- - procedure CloseAllFiles;
- - Close all files which are open and in the open file buffer
- - FILEBUFF unit
-
- CloseFile
- - procedure CloseFile(fName : FnString);
- - Close a file and delete its entry from the open files buffer
- - FILEBUFF unit
-
- CreateLrList
- - procedure CreateLrList(var lrLst : LrList);
- - Create a logical record list
- - LRECLIST unit
-
- DeleteFile
- - procedure DeleteFile(fName : FnString);
- - Deletes the given file and performs some necessary cleanup.
- Users should only delete DATA or INDEX files!!
- - FILES unit
-
-
- 4
-
-
-
- TBTREE13 Copyright (c) 1988 Dean H. Farwell II
-
-
- DeleteFromLrList
- - procedure DeleteFromLrList(var lrLst : LrList);
- - Delete one entry from a logical record list
- - LRECLIST unit
-
- DeleteRecord
- - procedure DeleteRecord(fName : FnString;
- rNum : RecordNumber);
- - Delete the given logical or physical record. You should only
- be using this for DATA files
- - FILES unit
-
- DeleteValueFromBTree
- - procedure DeleteValueFromBTree(iFName : FnString;
- lrNum : LrNumber;
- var paramValue);
- - Delete a value and associated logical record number from index
- - BTREE unit
-
- DestroyLrList
- - procedure DestroyLrList(var lrLst : LrList);
- - Destroys a logical record list and performs necessary cleanup
- - LRECLIST unit
-
- DestroySortList
- - procedure DestroySortList(var sPtr : SortFieldList);
- - Deletes all entries from a sort field list returning the heap
- space
- - SORT unit
-
- Difference
- - procedure Difference(lrLst1 : LrList;
- lrLst2 : LrList;
- var lrLst3 : LrList);
- - Creates list containing logical record numbers in list one
- but not in list two
- - SETOPS unit
-
- FixFileName
- - procedure FixFileName(var fName : FnString;
- fType : FileTypes);
- - Strips off any extension and appends the extension appropriate
- for the given file type
- - FILES unit
-
- GetALogicalRecord
- - procedure GetALogicalRecord(fName : FnString;
- lrNum : LrNumber;
- var destination;
- size : DataSizeRange);
- - Get the specified logical record and place it in destination
- - LOGICAL unit
-
-
-
-
-
-
-
- 5
-
-
-
- TBTREE13 Copyright (c) 1988 Dean H. Farwell II
-
-
- GetRangeFromBTree
- - procedure GetRangeFromBTree(iFName : FnString;
- var paramValue1;
- cond1 : Condition;
- var paramValue2;
- cond2 : Condition;
- var lrLst : LrList);
- - Create a list which contains all logical record numbers with
- values which meet both conditions (fall within the given range)
- - BTREE unit
-
- GetSubstringFromBTree
- - procedure GetSubstringFromBTree(iFName : FnString;
- var paramValue;
- cond : StringCondition;
- var lrLst : LrList);
- - Create a list which contains all logical record numbers with
- values which meet the given string condition
- - BTREE unit
-
- GetValidLogicalRecords
- - procedure GetValidLogicalRecords(fName : FnString;
- var lrLst : LrList);
- - Returns a list of all logical records for a given file. Allows
- retrievals without use of an index.
- - LOGICAL unit
-
- GetValuesFromBTree
- - procedure GetValuesFromBTree(iFName : FnString;
- var paramValue;
- cond : Condition;
- var lrLst : LrList);
- - Create list which contains all logical record numbers which
- meet the given condition.
- - BTREE unit
-
- InsertValueInBTree
- - procedure InsertValueInBTree(iFName : FnString;
- lrNum : LRNumber;
- var paramValue);
- - Insert a value and associated logical record number in an index
- - BTREE unit
-
- Intersection
- - procedure Intersection(lrLst1 : LrList;
- lrLst2 : LrList;
- var lrLst3 : LrList);
- - Creates list containing logical record numbers in both lists
- - SETOPS unit
-
- NumberOfBTreeLevels
- - function NumberOfBTreeLevels(iFName : FnString) : Byte;
- - Return the number of levels for the given index
-
-
-
-
-
-
- 6
-
-
-
- TBTREE13 Copyright (c) 1988 Dean H. Farwell II
-
-
- OpenTextFile
- - procedure OpenTextFile(fName : FnString;
- var fId : Text);
- - Checks open file buffer to see if file is open. If not it
- opens file and adds it to the buffer. In either case it returns
- the file id
- - FILEBUFF unit
-
- OpenUntypedFile
- - procedure OpenUntypedFile(fName : FnString;
- var fId : File;
- recSize : Word);
- - Checks open file buffer to see if file is open. If not it
- opens file and adds it to the buffer. In either case it returns
- the file id
- - FILEBUFF unit
-
- PrintBufferStats
- - procedure PrintBufferStats;
- - Prints buffer usage statistics to the printer
- - PAGE unit
-
- PrintPageBuffer
- - procedure PrintPageBuffer;
- - Prints entire page buffer to printer
- - PAGE unit
-
- ReleaseAllPages
- - procedure ReleaseAllPages(fName : FnString);
- - Releases all pages for a given file. Frees up buffer space.
- Does not write them to disk automatically. VERY DANGEROUS. Do
- not use unless you fully understand what the routine does!
- - PAGE unit
-
- ReleasePage
- - procedure ReleasePage(fName : FnString;
- prNum : PrNumber);
- - Releases given page for a given file. Frees up buffer space.
- Does not write it to disk automatically. VERY DANGEROUS. Do
- not use unless you fully understand what the routine does!
- - PAGE unit
-
- RewriteTextFile
- - procedure RewriteTextFile(fName : FnString;
- var fId : Text);
- - Rewrites a text file and returns the file id. Adds file to
- files open buffer
- - FILEBUFF unit
-
- RewriteUntypedFile
- - procedure RewriteUntypedFile(fName : FnString;
- var fId: File;
- recSize : Word);
- - Rewrites an untyped file and returns the file id. Adds file to
- files open buffer
- - FILEBUFF unit
-
-
-
- 7
-
-
-
- TBTREE13 Copyright (c) 1988 Dean H. Farwell II
-
-
- SetMaxOpenFiles
- - procedure SetMaxOpenFiles(n : OpenFileRange);
- - Sets maximum number of files to be open at one time (open in
- the open file buffer)
- - FILEBUFF unit
-
- SortList
- - procedure SortList(var lrLst : LrList;
- fName : FnString;
- sPtr : SortFieldList;
- size : DataSizeRange);
- - Sorts a logical record list in ascending order using the
- sort field list
- - SORT unit
-
-
- StoreALogicalRecord
- - procedure StoreALogicalRecord(fName : FnString;
- lrNum : LrNumber;
- var source;
- size : DataSizeRange);
- - Stores a logical record in the given data file. Used when the
- associated logical record number is known
- - LOGICAL unit
-
- Union
- - procedure Union(lrLst1 : LrList;
- lrLst2 : LrList;
- var lrLst3 : LrList);
- - Creates list containing logical record numbers in either list
- - SETOPS unit
-
- WriteBufferToDisk
- - procedure WriteBufferToDisk(fName : FnString);
- - Writes all dirty buffer pages for a particular file to the
- disk. Done prior to terminating program
- - PAGE unit
-
- WriteEntireBufferToDisk
- - procedure WriteEntireBufferToDisk;
- - Writes all dirty buffer pages to the disk. Done prior to
- terminating program
- - PAGE unit
-
-
- Functions
- ---------
-
-
- CheckImmediateDiskWrite
- - function CheckImmediateDiskWrite : Boolean;
- - Returns true if pages will be immediately written to disk.
- Allows you to check it at any time.
- - PAGE unit
-
-
-
-
-
- 8
-
-
-
- TBTREE13 Copyright (c) 1988 Dean H. Farwell II
-
-
- CheckMaxBufferPages
- - function CheckMaxBufferPages : BufferSizeType;
- - Returns maximum buffer pages allowed
- - PAGE unit
-
- CheckPagesInUse
- - function CheckPagesInUse : BufferSizeType;
- - Returns number of pages currently in use
- - PAGE unit
-
- FindLargestLr
- - function FindLargestLr(lrLst : LrList) : LrNumber;
- - returns the largest logical record in a list. Probably not
- useful except internally
- - LRECLIST unit
-
- FindLrInList
- - function FindLrInList(lr : LrNumber;
- lrLst : LrList) : Boolean;
- - Returns true if the given logical record resides in the logical
- record list
- - LRECLIST unit
-
- GetCountLr
- - function GetCountLr(lrLst : LrList) : LrNumber;
- - Returns the number of entries in the logical record list
- - LRECLIST unit
-
- GetCurrLr
- - function GetCurrLr(lrLst : LrList) : LrNumber;
- - Returns the logical record number corresponding to the current
- cursor position. The cursor position is not changed.
- - LRECLIST unit
-
- GetFirstLr
- - function GetFirstLr(var lrLst : LrList) : LrNumber;
- - Set cursor to front of list and return the first logical record
- number in the list
- - LRECLIST unit
-
- GetLastLr
- - function GetLastLr(var lrLst : LrList) : LrNumber;
- - Set cursor to end of list and return the last logical record
- number in the list
- - LRECLIST unit
-
- GetNextLr
- - function GetNextLr(var lrLst : LrList) : LrNumber;
- - Moves the cursor forward and returns the corresponding logical
- record number
- - LRECLIST unit
-
- GetNumberOpenFiles
- - function GetNumberOpenFiles : OpenFileRange;
- - Returns the number of files which are presently open
- - FILEBUFF unit
-
-
-
- 9
-
-
-
- TBTREE13 Copyright (c) 1988 Dean H. Farwell II
-
-
- GetPrevLr
- - function GetPrevLr(var lrLst : LrList) : LrNumber;
- - Moves the cursor backward and returns the corresponding logical
- record number
- - LRECLIST unit
-
- LastUsedRecord
- - function LastUsedRecord(fName : FnString) : RecordNumber;
- - Returns the last logical or physical record in use. If not
- records are in use 0 will be returned
- - FILES unit
-
- RecordUsed
- - function RecordUsed(fName : FnString;
- rNum : RecordNumber) : Boolean;
- - Checks to see if a given record is in use. Probably not useful
- except for internally.
- - FILES unit
-
- SetImmediateDiskWrite
- - procedure SetImmediateDiskWrite(x : Boolean);
- - Used to set whether dirty pages are immediately written to
- disk. Will degrade performance.
- - PAGE unit
-
- SetMaxBufferPages
- - procedure SetMaxBufferPages(n : BufferSizeType);
- - Used to set the maximum buffer pages to use. Can be done
- dynamically even if more pages than the new maximum are in use
- - PAGE unit
-
- StoreNewLogicalRecord
- - function StoreNewLogicalRecord(fName : FnString;
- var source;
- size : DataSizeRange) : LrNumber;
- - Stores a new logical record in a data file. Used when the
- logical record number is not known since this routine returns
- the logical record number after the store takes place. You
- would not use this for an update.
- - LOGICAL unit
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 10
-
-
-