home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-01-04 | 54.4 KB | 1,435 lines |
-
-
- ObjectBase Users Guide Page 1
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- ************************************************************
- * *
- * --<<< ObjectBase >>>-- *
- * *
- * The Object Oriented Data Base Management Tool Box for *
- * Turbo Pascal version 5.5. *
- * *
- * COPYRIGHT NOTICE *
- * *
- * MMGR.EXE, MMGR.PAS, ObjectBase ToolBox and *
- * DBObjects ToolBox and the documentation *
- * included are (c) 1990 Thomas W. Harden, *
- * all rights reserved. *
- * *
- * ObjectBase and DBObjects ToolBoxes are *
- * Shareware products and are made available *
- * to the programmer to test and use for *
- * evaluation purposes only. They may not be *
- * circulated in any incomplete or modified *
- * form, nor sold for profit, without the *
- * express written consent of the author. *
- * *
- ************************************************************
-
-
- ObjectBase Users Guide Page 2
-
-
-
- SHAREWARE NOTICE:
-
- ObjectBase and DBObjects ToolBoxes are Shareware products and are
- made available to the programmer to test and use for evaluation
- purposes only. Should you find them useful, register your use
- with Harden Consulting so update information and future product
- offerings can be made available to you. To register your use of
- the above mentioned products, send check or money order for
- $79.95 payable to Thomas W. Harden or Harden Consulting and the
- form found at the end of this documentation. When Registration
- is received you will receive the latest version of ObjectBase
- (See specifications section for current enhancements), full
- documentation plus announcements of upgrades will be mailed to
- you with special pricing made available to registered owners.
-
-
-
- DISCLAIMER:
-
- You undertake the use of MMGR.EXE, OopBase.TPU and DBObjt.TPU at
- your own risk. The Author and Harden Consulting accept no
- liability for any damages resulting from its use or misuse.
- Problem reports and suggestions are appreciated; include a
- self-addressed, stamped return envelope for a reply if desired.
-
-
- ObjectBase Users Guide Page 3
-
-
-
-
-
- TABLE OF CONTENTS
- ---------------------------------------------------
-
- Shareware Notice ............................. 2
-
- Disclaimer ................................... 2
-
- Table of Contents ............................ 3
-
- Introduction ................................. 4
-
- System Requirements .......................... 5
-
- Specifications ............................... 5
-
- Overview ..................................... 6
-
- Reference Section ............................ 11
-
- Constants ................................. 11
-
- Types ..................................... 11
-
- Objects ................................... 13
-
- The DB Object ............................. 14
-
- Object Methods ......................... 14
-
- Other Objects ............................. 27
-
- Registration & Order Form .................... 31
-
-
- ObjectBase Users Guide Page 4
-
-
-
- INTRODUCTION
- ---------------------------------------
-
- ObjectBase and DBObjects are a comprehensive set of Data Base
- management Tools, written in Turbo Pascal 5.5 to speed up the
- developement of complex data base applications.
-
- ObjectBase is an Object Oriented Relational Data Base Management
- system that allows the programmer to spend his time and intellect
- on the application requirements and not the tedius manipulation
- of the data files and the records involved. ObjectBase is
- designed to relieve the programmer of worrying about the updating
- of appropriate indexes and manipulating the complicated relations
- that can sometimes be encountered in data base system design and
- implementation.
-
- DBObjects is an Object Oriented file management system that
- contains the parent objects and the low level methods for
- datafile and indexfile maintenance.
-
- Both are Compiled Units using Borland's Turbo Pascal 5.5.
-
- As helpful as ObjectBase is, it will not do everything for you.
- It is assumed that proper design has been implemented and that
- the data structures are in 3rd Normal Form. If this is true,
- then ObjectBase should make accessing the Data Structures easy
- and efficient.
-
- In its present form Object Base points to a memory location
- passed to it when LoadIndexFile is performed for its index keys.
- This means that the key value that you want to use must be: 1) a
- string variable and 2) be a field in the record that is
- associated with that index.
-
-
- ObjectBase Users Guide Page 5
-
-
-
- SYSTEM REQUIREMENTS
- ------------------------------------------------
- Computer - IBM PC or compatible.
- Operating System - MS-DOS 2.X or later.
- Language - Turbo Pascal 5.5 or Later.
-
-
- SPECIFICATIONS
- ------------------------------------------------------
- Number of Open Files ...................... 15 *
- Number of Fields .......................... unlimited
- Maximum size of record .................... 1024 bytes
- Maximum number of records per file ........ 100 *
- Number of relationships ................... limited by
- computer memory
-
- * This version is intentionally limited in its capacity.
-
- The DB Object contained with this UNIT is not
- extensible. The version supplied upon registration has
- several changes.
-
- Number of Open Files ...................... Limited by
- CONFIG.SYS
- FILES = n
- 7 < n < 255
- Number of records per file ................ 2.14x10^9
- Object is extendable.
- With MS-DOS 3.x ........................... NetWork
- Ready
-
-
- ObjectBase Users Guide Page 6
-
-
-
- OVERVIEW
- ---------------------------------------
-
- ObjectBase was designed to increase the productivity of
- programmers in implementation of complex data base
- applications. The concept of Object Oriented Programming is
- particularly suited to this genre of developement. By
- defining the database as an Object with all the knowledge
- built in to manipulate the data following the relational
- model, the programmer is relieved of much of the tedium
- normally associated with maintaining the integrity of the
- files and their associated indexes. Also the system allows
- for the easy setup of relationships between the different
- data files giving the database as a whole the relational
- integrity required by serious database systems.
-
- ObjectBase provides the programmer much of the functionality
- of a Data Base Management System, i.e. dBase, with the
- flexibility and speed of Pascal.
-
- ObjectBase consists of two related Units: OopBase.TPU and
- DBObjt.TPU. The DBObjt Unit is a set of low level Data File
- management Objects. It handles the basic housekeeping chores
- for datafiles and the index files or any untyped file that
- uses fixed length records. OopBase defines the more
- inteligent DFile Object that is aware of how it is indexed
- and manages the basic handling of an indexed data file. The
- primary object for ObjectBase, is the DB object. This the
- object that the programmer will deal with on a regular basis.
- It is aware of all the information required to manage the
- database without the programmer being required to deal with
- the low level tedium of being sure all the indexes are
- updated, etc.
-
- The DB object is informed of the data and index files that
- will be included in its data base. As state earlier, the
- data and index files are also Objects that have been informed
- of the source of their data and have been given the know how
- to be self maintaining. What I mean by this is the Index
- File Object is aware of the spot in system memory where its
- Key value is located and knows what to do with it. The Data
- File Object knows which indexes are associated with the data
- file and also knows where its data buffer is located. The DB
- Object knows which Data Files belong to the DataBase and how
- they relate to each other. By endowing the DB Object with
- this knowledge, it can now handle most of the maintenance
- chores with which the programmer normally has to contend.
-
-
- ObjectBase Users Guide Page 7
-
-
-
- For instance, when a record is edited, before putting the
- record back in the database the datafile checks to see if
- their has been a change in its data buffer if so it then
- stores the modified copy of the record over the old copy and
- calls on its indexes to do the same. They in turn compare
- the current values of their databuffer with the data that was
- originally present and will update their index structure
- accordingly. What this means to the programmer is that he is
- no longer required to deal with the tedium of insuring that
- all files have been updated.
-
- The relational aspects are also handled by the DB Object.
- Once informed of the relationships required for a particular
- application or procedure a call to associate will fill the
- various record buffers with related data. If the
- relationship is a one to many relationship you can use next
- association to step through the related records. It makes
- the associations appear to be a circular Queue.
-
- What all this means is that much of the functionality (and
- even more) of DBMS systems is provided with the ability to
- control the environment and interface to the user with the
- power of Turbo Pascal.
-
- The normal sequence of code required to use ObjectBase is:
-
- 1) Declare a variable of type DB.
-
- Example: var DataBase : DB;
-
- 2) Initialize the DB variable.
-
- Example: DataBase.Init;
-
- 3) Load the Data Files into the variable.
-
- Example: DataBase.LoadDataFile(New(DFilePtr,
- Init('COMPANY.DAT','C:\MMGR\',SizeOf(Company),
- @Company)));
-
- 4) Load the Index Files into the variable.
-
- Example: DataBase.LoadIndexFile(New(IFilePtr,
- Init('COMPCODE.NDX','C:\MMGR\',
- SizeOf(Company.Code), @Company.Code),
- 'COMPANY.DAT'));
-
- 5) Open the Data Base Variable.
-
- Example: DataBase.Open;
-
- 6) Load the Relationships between the files into the
- variable for the various applications encountered in
- the target application.
-
-
-
- ObjectBase Users Guide Page 8
-
-
-
-
- ObjectBase Users Guide Page 9
-
-
- Example: DataBase.LoadRelation('COMPANY.DAT',
- 'CONTACTS.DAT',
- 'CONTCMPCD.NDX',
- @Company.Code);
- Example: DataBase.ClearRelations;
-
- 7) Perform the Required Manipulations of the data files
- based on the demands of the application.
-
- Examples: DataBase.Find(aString);
- DataBase.Search(aString);
- DataBase.Next;
- DataBase.Prev;
- DataBase.Add;
- DataBase.Delete;
- DataBase.Associate('COMPANY.DAT');
- DataBase.NextAssoc('COMPANY.DAT');
-
- 8) Tell the Object that you are Done with it.
-
- Example: DataBase.Done;
-
- What ObjectBase does:
-
- Once the datafile is loaded into DB variable, the record
- variable representing the data stored in that specific data
- file is known to the DB Object and when a request is made for
- a different record, DB performs the required updates to the
- current record and its indexes and then performs the
- requested action and loads the record variable with the
- associated data. If the application requires the use of
- multiple data files, then relations should be loaded. Once
- loaded a message to associate will align the files properly
- and provide the appropriate data to the application. This is
- demonstrated in the Pascal Code for MMGR.EXE included in this
- package. Once all the Data and Indexes are loaded into the
- DB Object the progam can SwitchTo any of the DataFiles to
- make that the primary Data File and SwitchIndex's to any
- loaded index so that the order of the records will reflect
- the order desired.
-
- An alternative method would be to declare each data file and
- index file as variables of the types DFile and IndexFile,
- Init(ialize) these objects and load the IndexFile Pointers
- into the DFile Object. Once this is done, several DB objects
- may be declared with the required set of files and relations
- utilized in different areas of the program by loading
- pointers to the DFile objects into each instance of the DB
- object and loading the relations required for each instance
- of the DB object. Each section that has a different
- perspective on the Data would have its own Data base to work
- with and would further enhance the integrety and security of
- the datafiles because each instance of DB would have access
- only to the data required to perform its function. Also,
- switching between the different applications would be
- facilitated.
-
-
- ObjectBase Users Guide Page 10
-
-
-
- Note:
- If after the program has been in use for a while, and a
- modification is required that would add a new index, all you
- have to do is add the LoadIndexFile command for that index
- and the next time the program runs it will create the new
- index and build it automatically.
-
- See the README.DOC file for the name of the files containing
- the annotated code for MMGR.EXE.
-
-
-
- ObjectBase Users Guide Page 11
-
-
-
- REFERENCE SECTION
- ---------------------------------------
-
- The following section is broken up into categories based on the
- identifier Class. Constants, Types, Objects (a kind of Type),
- Variables and Global Functions. The various identifiers are
- described as to their use within the scope of the toolboxes
- and how to put them to work for you in your next database
- developement project.
-
- ------------ TYPED CONSTANTS -------------
-
- Constant Name Value Description Unit Name
- ---------------------------------------------------------------
- NoDups = 0 May be used to tell the DBObjt
- index file object that
- duplicate keys are not
- allowed.
- DupsOK = 1 May be used to tell the DBObjt
- index file object that
- duplicate keys are
- allowed.
-
- --------------- TYPES ---------------
-
- Type Name Type Description Unit Name
- ---------------------------------------------------------------
- FPointer = Integer Used for Record Number DBObjt
- References.
- FName = String[12] The type that should be DBObjt
- used to present FileNames
- to either Unit.
- PName = String[64] The type that should be DBObjt
- used to pass PathNames to
- either Unit.
- FStat = (Opened,Closed) Type used to tell the DBObjt
- whether a file object has
- been opened or closed.
- IFilePtr = ^IndexFile Memory Pointer to IndexFile ObjtBase
- object.
- IFPtr = ^IFNode Memory Pointer to IFNode ObjtBase
- Record.
- IFNode = Record Record used by the DFile ObjtBase
- IFP : IFilePtr Object to maintain it's
- NextNode : IFPtr IndexFiles. It represents a
- node in a linked list
- structure.
- DFilePtr = ^DFile Memory Pointer to DFile ObjtBase
- Object.
- RelNodePtr = ^RelNode Memory Pointer to RelNode ObjtBase
- Record.
-
-
- ObjectBase Users Guide Page 12
-
-
- RelNode = Record Record used by DB Object to ObjtBase
- PFName administer the Relational
- IFName aspects of ObjectBase. It
- RFName : FName represents a node in a
- Key : Pointer Linked list structure.
- NextRel: RelNodePtr
- DFPtr = ^DFNode Memory Pointer to DFNode ObjtBase
- Record.
- DFNode = Record Record used by DB Object to ObjtBase
- DF : DFilePtr keep track of the DataFiles
- NextNode: DFPtr associated with the
- DataBase. Represents a node
- in a linked list.
-
-
- ObjectBase Users Guide Page 13
-
-
-
- -------------- OBJECTS --------------
-
- A Word about objects:
-
- This is not intended to be a lesson in object oriented
- programming but rather a description of how OOP concepts
- affect the use of ObjectBase.
-
- An Object in TP 5.5 is similar to a Class in C++. It is
- used as a Data Variable that encompasses not only the data
- that is required by the nature of its use but also the
- knowledge of how to perform actions on itself. The data
- variables are similar to record fields and are handled
- accordingly. The Procedures and functions involved are
- known as methods in the OOP world. One of the properties
- of Objects is that they may pass on their knowledge to
- other objects via extensibility. When an object is
- declared it may reference another object and will inherit
- all the data and methods contained in that object.
-
- ObjectBase has two Base Object types: OopFile and DB.
-
- DB is the data management object that in effect handles the
- functions of ObjectBase. All dialog between the
- application and the data base is done through DB.
-
- OopFile implements the most basic and low level routines
- for file handling, i.e.- Open, flushing, closing of file
- handles; reading and writing to disk files; B+tree index
- maintenance.
-
- The heiarchy is graphically represented as:
-
- +- DB --------------------------------+
- | +- DFile(DataFile(OopFile)) ----+ |
- | | | |
- | | IndexFile(DataFile(OopFile)) | |
- | | | |
- | +-------------------------------+ |
- +-------------------------------------+
-
- -------------------------------------------------
-
-
- ObjectBase Users Guide Page 14
-
-
-
- OBJECT DESCRIPTIONS
- ---------------------------------------------------------------
- Name : DB
-
- Unit : ObjtBase
-
- In the following descriptions it is assumed that a variable
- declaration exists in the program:
-
- Var DataBase : DB;
-
-
- The following is a list of the methods belonging to the DB
- object. They are available to the progammer via calls to the
- variable you declare as Type DB. You should limit your access to
- the methods belonging to The DB Object. The methods are listed
- in alphabetical order below. Any thing that normally needs to be
- done with a data management system is available through the DB
- object.
-
- METHOD REFERENCES
-
- *****************************************************************
-
- Method Name : ACTIVEKEY
-
- Unit Declaration : Function ActiveKey : string
-
- Description : Returns the String value that the current
- record is indexed by based on the Active
- Index file.
-
- Input : None
-
- OutPut : KeyString
-
- Usage : OldKey := DataBase.ActiveKey;
-
-
-
- ObjectBase Users Guide Page 15
-
-
- *****************************************************************
-
- Method Name : ADD
-
- Unit Declaration : Procedure Add
-
- Description : Adds a record to the current primary file.
- The record will contain the data that resides
- in the buffer whose pointer was passed to the
- DFile Object when it was initialized in the
- LoadDataFile message. Indexes that have
- loaded as referencing the primary file will
- add the keys that reside in the buffers
- passed to them during LoadIndexFile message.
-
- Input : None
-
- OutPut : None
-
- Usage : DataBase.Add;
-
- *****************************************************************
-
- Method Name : ASSOCIATE
-
- Unit Declaration : Procedure Associate(F:FName)
-
- Description : Aligns Record pointers based on the
- relations that were loaded with
- LoadRelations message from the reference
- FileName down to the last relation
- loaded. If No relation is found then
- the data buffer of the related file is
- blanked so nothing will show if that
- record is shown.
-
- Input : ParentDataFileName - Starts associtating
- at this point in the relationship chain.
-
- OutPut : None
-
- Usage : DataBase.Associate('COMPANY.DAT');
-
- Alternative Usage : DataBase.Associate(CompanyData^.FileName)
-
-
-
- ObjectBase Users Guide Page 16
-
-
- *****************************************************************
-
- Method Name : BLANKRECORD
-
- Unit Declaration : Procedure BlankRecord
-
- Description : Initializes the Data Buffer for the currently
- active DataFile. This is used to provide a
- blank record in which new data can be added
- to the primary currently active datafile.
-
- Input : None
-
- OutPut : None
-
- Usage : DataBase.BlankRecord;
-
- *****************************************************************
-
- Method Name : BOTTOM
-
- Unit Declaration : Procedure bottom
-
- Description : Returns the Last record in DataFile relative
- to the Selected Index.
-
- Input : None
-
- OutPut : None
-
- Usage : DataBase.Bottom;
-
- *****************************************************************
-
- Method Name : CLEAR
-
- Unit Declaration : Procedure Clear
-
- Description : Any time a DataFile is to be sequentially
- accessed Clear should be called. This points
- all internal pointers to the first logical
- record in the active datafile.
-
- Input : None
-
- OutPut : None
-
- Usage : DataBase.Clear;
-
-
-
- ObjectBase Users Guide Page 17
-
-
- *****************************************************************
-
- Method Name : CLEARRELATIONS
-
- Unit Declaration : Procedure ClearRelations
-
- Description : Removes relationships that were previously
- loaded using LoadRelation so a new set of
- relations can be loaded or when independent
- access to the datafiles is required.
-
- Input : None
-
- OutPut : None
-
- Usage : DataBase.ClearRelations;
-
- *****************************************************************
-
- Method Name : CLOSE
-
- Unit Declaration : Procedure Close
-
- Description : Close all Files associated with the DB
- Object.
-
- Input : None
-
- OutPut : None
-
- Usage : DataBase.Close;
-
- *****************************************************************
-
- Method Name : DELREC
-
- Unit Declaration : Procedure DelRec
-
- Description : Deletes the Record that is currently in the
- Data Buffer for the currently selected
- datafile. Record is permanently deleted.
-
- Input : None
-
- OutPut : None
-
- Usage : DataBase.DelRec;
-
-
-
- ObjectBase Users Guide Page 18
-
-
- *****************************************************************
-
- Method Name : DONE
-
- Unit Declaration : Destructor Done
-
- Description : Release the dynamic data storage areas set up
- by Init and other interactions with a DB
- Object. Should be called at the conclusion of
- the a session with a DB type.
-
- Input : None
-
- OutPut : None
-
- Usage : DataBase.Done;
-
- *****************************************************************
-
- Method Name : EMPTY
-
- Unit Declaration : Function Empty : Boolean
-
- Description : Returns TRUE if there are viable records
- stored in the active datafile.
-
- Input : None
-
- OutPut : True / False
-
- Usage : IF NOT DataBase.Empty THEN Customer.edit;
-
- *****************************************************************
-
- Method Name : EOFILE
-
- Unit Declaration : Function EOFile: Boolean
-
- Description : Returns TRUE if the most recent data file
- movement took the record pointer to the end
- of either the active index file or the actual
- datafile if their are no active indexes.
-
- Input : None
-
- OutPut : True/False
-
- Usage : DataBase.EOFile;
-
-
-
- ObjectBase Users Guide Page 19
-
-
- *****************************************************************
-
- Method Name : FILEEXISTS
-
- Unit Declaration : Function FileExists(Name : FName): Boolean
-
- Description : Returns TRUE if File referenced by Name has
- been loaded into DataBase with LoadDataFile
- method. Use of this function can prevent
- crashes if an attempt is made to access an
- unknown FileName.
-
- Input : DataFileName
-
- OutPut : True/False
-
- Usage : DataBase.FileExists('COMPANY.DAT');
-
- *****************************************************************
-
- Method Name : FIND
-
- Unit Declaration : Procedure Find(S:string)
-
- Description : Finds an exact match to the KeyString if
- exists. Otherwise no action is taken.
-
- Input : Search String
-
- OutPut : None
-
- Usage : DataBase.Find(KeyString);
-
- *****************************************************************
-
- Method Name : GET
-
- Unit Declaration : Procedure Get
-
- Description : Loads the record that is currently being
- pointed to by the DB Object. Not normally
- required by application programer since
- pointer movements automaticly retrieve the
- the record and put it into the buffer passed
- to the DB Object when the LoadDataFile
- message was sent.
-
- Input : None
-
- OutPut : None
-
- Usage : DataBase.Get;
-
-
-
- ObjectBase Users Guide Page 20
-
-
- *****************************************************************
-
- Method Name : INIT
-
- Unit Declaration : Constructor Init
-
- Description : Initializes the data structures used by the
- DB object. Must be called by main program
- for each instance of Type DB.
-
- Input : None
-
- OutPut : None
-
- Usage : DataBase.Init;
-
- *****************************************************************
-
- Method Name : LASTCODE
-
- Unit Declaration : Function LastCode(I : FName): String
-
- Description : Returns the last indexed string in the
- current datafiles active index. This is used
- if your system is generating internal access
- codes for individual records. It allows the
- creation of sequential codes without
- duplications.
-
- Input : IndexFileName - Searches this index for
- the last key in index.
-
- OutPut : LastCode - The Last Code found in
- IndexFileName.
-
- Usage : Company.code := NextCode(DataBase.LastCode(
- 'COMPANY.DAT'));
- Alternative Usage : Company.code :=
- NextCode(DataBase.LastCode(
- CompanyData^.FileName));
-
-
-
- ObjectBase Users Guide Page 21
-
-
- *****************************************************************
-
- Method Name : LOADDATAFILE
-
- Unit Declaration : Procedure LoadDataFile(D:DFilePtr)
-
- Description : Tells the DB Object the location of the
- DFile object and initializes the DFile
- object with information about the
- DataFile and the location of the data
- buffer to use for its I/O.
-
- Input : DFilePtr - Pointer variable to DFile
- Object. In the example below New's
- extended capability of returning a
- pointer and the ability to call an
- Objects constructor is put to use.
- Dfile's Constructor requires the
- following: DataFile Name, the size of
- the Data record, a pointer to that
- record buffer.
-
- OutPut : None
-
- Usage : DataBase.LoadDataFile(new(DfilePtr,
- init('COMPANY.DAT',Sizeof(Company),
- @Company)));
-
- Alternative usage : VAR CompanyData : DFilePtr;
-
- new(CompanyData, Init('COMPANY.DAT',
- SizeOf(Company), @Company));
- DataBase.LoadDataFile(CompanyData);
-
-
-
- ObjectBase Users Guide Page 22
-
-
- *****************************************************************
-
- Method Name : LOADINDEXFILE
-
- Unit Declaration : Procedure LoadIndexFile(D:IFilePtr; DF : Fname)
-
- Description : Initializes the IndexFile Object and Passes
- a pointer to the DB Object so that it is
- aware of which DataFile to associate it with.
-
- Input : IFilePtr - (See LoadDataFile). Nodups or
- DupsOk inform the IndexFile whether to
- allow duplicate keys when a key is added
- to an index.
- The DataFile Name that the index is
- associated with.
-
- OutPut : None
-
- Usage : DataBase.LoadIndexFile(new(IFilePtr,
- Init('COMPCODE.NDX',SizeOf(Company.Code),
- @Company.code,NoDups)),'COMPANY.DAT');
-
- Alternative usage : VAR CompSysNdx : IFilePtr;
-
- New(CompSysNdx, Init('COMPCODE.NDX',
- SizeOf(Company.Code), @Company.Code,
- NoDups));
- DataBase.LoadIndexFile(CompSysNdx,
- CompanyData^.FileName);
-
- *****************************************************************
-
- Method Name : LOADRELATION
-
- Unit Declaration : Procedure LoadRelation(ParentFile,NewData,
- NewIndex : FName;
- NewKey : pointer)
-
- Description : Informs the DB Object of the relation between
- one datafile and another.
-
- Input : ParentDataFileName
- ChildDataFileName
- Linking IndexFileName
- Pointer to Key field in Parents Data
- buffer.
-
- OutPut : None
-
- Usage : DataBase.LoadRelation('COMPANY.DAT',
- 'CONTACT.DAT','CONTCPCD.NDX',@Company.code);
-
-
-
- ObjectBase Users Guide Page 23
-
-
- *****************************************************************
-
- Method Name : NEXT
-
- Unit Declaration : Procedure Next
-
- Description : Returns the next record ordered by the
- currently active index for the currently
- active DataFile. If the current record is
- the last record in the index then the first
- record is returned in the Data Buffer.
-
- Input : None
-
- OutPut : None
-
- Usage : DataBase.Next;
-
- *****************************************************************
-
- Method Name : NEXTASSOC
-
- Unit Declaration : Procedure NextAssoc(F: FName)
-
- Description : Increments the next datafile record pointer
- down the relation chain from F. If no
- additional relations exist the first
- association available is made.
-
- Input : ParentDataFileName - Starts associtating
- at this point in the relationship chain.
- The next file down the chain is
- incremented and then associated with
- files that follow.
-
- OutPut : None
-
- Usage : DataBase.NextAssoc('COMPANY.DAT');
-
- Alternative Usage : DataBase.NextAssoc(CompanyData^.FileName)
-
-
-
- ObjectBase Users Guide Page 24
-
-
- *****************************************************************
-
- Method Name : OPEN
-
- Unit Declaration : Procedure Open
-
- Description : Opens all Files loaded into the DB Object and
- prepares them for processing. The record
- that is returned is the first physical record
- in the DataFile.
-
- Input : None
-
- OutPut : None
-
- Usage : DataBase.Open;
-
- *****************************************************************
-
- Method Name : PREV
-
- Unit Declaration : Procedure Prev
-
- Description : Returns the record that is located just
- before the current record in the selected
- DataFile as ordered by the selected index.
- If it is the first record then the last
- record is returned.
-
- Input : None
-
- OutPut : None
-
- Usage : DataBase.Prev;
-
- *****************************************************************
-
- Method Name : PUT
-
- Unit Declaration : Procedure Put
-
- Description : Used to return a modified record to the
- DataFile. When Put is called all indexes
- associated with this DataFile check to see if
- their key has been modified, if so they
- update themselves.
-
- Input : None
-
- OutPut : None
-
- Usage : DataBase.Put;
-
-
-
- ObjectBase Users Guide Page 25
-
-
- *****************************************************************
-
- Method Name : SAVE
-
- Unit Declaration : Procedure Save
-
- Description : Writes all files to disk and then resets
- pointers to the records that were active
- when command was given.
-
- Input : None
-
- OutPut : None
-
- Usage : DataBase.Save
-
- *****************************************************************
-
- Method Name : SEARCH
-
- Unit Declaration : Procedure Search(S:String)
-
- Description : Searches the currently active IndexFile of
- the currently active dataFile and Finds the
- First record that is equal to or greater than
- the KeyString passed to it.
-
- Input : Search String
-
- OutPut : None
-
- Usage : DataBase.Search(KeyString);
-
- *****************************************************************
-
- Method Name : SETINDEX
-
- Unit Declaration : Procedure SetIndex(I : Fname)
-
- Description : Used to change the active index for the
- current DataFile.
-
- Input : IndexFileName - The name of the index
- file that you want to be controling the
- ordering of the records.
-
- OutPut : None
-
- Usage : DataBase.SetIndex('COMPCODE.NDX');
-
- Alternative Usage : DataBase.SetIndex(CompSysNdx.FileName);
-
-
-
- ObjectBase Users Guide Page 26
-
-
- *****************************************************************
-
- Method Name : SWITCH
-
- Unit Declaration : Procedure Switch(N:integer)
-
- Description : Switchs the active DataFile to the DataFile
- loaded in the n'th position with the
- LoadDataFile method.
-
- Input : FileNumber - represents the file load
- in the FileNumber Position.
-
- OutPut : None
-
- Usage : DataBase.Switch(2);
-
- *****************************************************************
-
- Method Name : SWITCHTO
-
- Unit Declaration : Procedure SwitchTo(F:FName)
-
- Description : Used to change the primary DataFile. The
- DataFile referenced by F will be the datafile
- that is adjusted when a call to Next, add,
- etc. is made.
-
- Input : DataFileName - Makes DataFileName the
- primary Data File.
-
- OutPut : None
-
- Usage : DataBase.SwitchTo('PERSONS.DAT');
-
- Alternative Usage : DataBase.SwitchTo(CompanyData^.FileName);
-
- *****************************************************************
-
- Method Name : TOP
-
- Unit Declaration : Procedure top
-
- Description : Returns the first record in DataFile relative
- to the selected Index.
-
- Input : None
-
- OutPut : None
-
- Usage : DataBase.Top;
-
- *****************************************************************
-
-
- ObjectBase Users Guide Page 27
-
-
-
- The following is a listing of the other objects contained within
- the UNITs supplied they are not fully documented because you
- should not need to access these objects directly since the DB
- Object does that for you. You may use these as you wish but by
- doing so you are circumventing what DB does for you.
-
- Name : OopFile
-
- Unit : DBObjt
-
- Description :
- OopFile is a Base File Object that implements the basic
- methods associated with Disc File operations. The basic file
- type that is utilized by the OopFile Object is the Turbo
- Pascal untyped File Type.
-
- Method List:
-
- Constructor Init(NewFileName: FName; NewPath: PName;
- RecordSize: integer)
- Destructor Done;VIRTUAL
- Procedure Create;VIRTUAL
- Procedure Open;VIRTUAL
- Procedure Close;VIRTUAL
- Procedure Seek(Pos: FPointer)
- Procedure Read(Buffer: Pointer; NoBytes:FPointer)
- Procedure Write(Buffer: Pointer; NoBytes:FPointer)
- Procedure Append(Buffer: Pointer; NoBytes:FPointer)
- Procedure Flush
- Procedure Erase
- Procedure ReName(NewName : FName)
- Procedure CopyTo(NewName : FName; NewPath: PName)
- Procedure Truncate
- Procedure Split(NewName: FName; NewPath: PName)
- Function EOF: Boolean
- Function Position: FPointer
- Function FileName: FName
- Function FilePath: PName
- Function FileSize: FPointer
-
-
-
- ObjectBase Users Guide Page 28
-
-
- ---------------------------------------------------------------
- Name : DataFile
-
- Unit : DBObjt
-
- Parent : OopFile
-
- Description:
- DataFile is a child object of OopFile and knows how to
- maintain itself as far as adding and deleting records
- getting and putting specific records, etc. It is the
- parent of both the IndexFile Object and the Dfile
- Object.
-
- Method List:
-
- constructor Init(NewName:FName; NewPath:PName;
- RecordSize :fPointer)
- Destructor Done; virtual
- Procedure Create;Virtual
- Procedure Open;Virtual
- Procedure Close;Virtual
- Procedure GetRec(RecNo: FPointer; Buff:pointer)
- Procedure PutRec(RecNo: FPointer; Buff:Pointer)
- Procedure NewRec(var RecNo: FPointer)
- Procedure AddRec(var RecNo: FPointer; Buff:Pointer)
- Procedure DeleteRec(RecNo: FPointer)
- Function UsedRecs:FPointer
- Function FileLen:Fpointer
-
-
-
- ObjectBase Users Guide Page 29
-
-
- ---------------------------------------------------------------
- Name : IndexFile
-
- Unit : DBObjt
-
- Parent : DataFile
-
- Description :
- IndexFile is a datafile object that maintains a B+Tree
- index. The index keys must be strings and are limited to
- 50 characters in length. It can maintain an index of
- either unique keys or recurring keys. Key points to a
- memory location that the index will use as its value
- when passed a DataReference number.
-
- Method List:
-
- Constructor Init(NewFile : FName; NewPath: PName;
- NewKeysize:integer;
- NewData : Pointer; Dupsallowed:integer)
- Destructor Done;virtual
- Procedure Create;Virtual
- Procedure Open;Virtual
- Procedure Close;Virtual
- Procedure ClearKey
- Procedure NextKey(var ProcDataRef: FPointer)
- Procedure Nextkeystr(Var ProcDataRef: FPointer
- Var ProcKey)
- Procedure PrevKey(var ProcDataRef: FPointer)
- Procedure PrevKeyStr(var ProcDataRef: FPointer;
- Var ProcKey)
- Procedure FindKey(Var ProcDataRef: FPointer; Var ProcKey)
- Procedure SearchKey(Var ProcDataRef: FPointer; Var ProcKey)
- Procedure AddKey(Var ProcDataRef: FPointer)
- Procedure DelK(Var ProcdataRef: Fpointer)
- Procedure Top(var ProcDataRef: FPointer)
- Procedure Bottom(Var ProcDataRef: FPointer)
- Procedure savekey
- Procedure Destroy
- Function LastKey:string
- Function CheckKey:boolean
- Function ActiveKey: String
- Function EOIndex(RecNo:FPointer): Boolean
-
-
-
- ObjectBase Users Guide Page 30
-
-
- ---------------------------------------------------------------
- Name : DFile
-
- Unit : ObjtBase
-
- Parent : DataFile
-
- Description:
- DFile is a DataFile Object but is utilized by DB to
- maintain not only the data records but also the index
- maintenance chores.
-
- Method List:
-
- Constructor Init(F:Fname; Pth:PName; S : integer; P :Pointer)
- Destructor Done;Virtual
- Procedure Open;Virtual
- Procedure Create;Virtual
- Procedure Close;Virtual
- Procedure save
- Function IndexFileName : FName
- Procedure Next
- Procedure Prev
- Procedure Top
- Procedure Bottom
- Procedure LoadIndexFile(I :IFilePtr)
- Procedure Add
- Procedure DelR
- Procedure Get
- Procedure Put
- Procedure Find(S: String)
- Procedure Search(S:string)
- Procedure BlankRecord
- Procedure Clear
- Procedure SetIndex(i:fname)
- Procedure SetKeys
- Procedure CheckKeys
- Procedure reindex
- Function lastcode(I : FName): string
- Function ActiveKey : string
- Function EOFile: boolean
-
-
-
- ObjectBase Users Guide Page 31
-
-
- ---------------------------------------------------------------
- GLOBAL VARIABLES
-
- IOstatus : INTEGER
- OK : Boolean
- FErrorCode : word
-
- GLOBAL FUNCTIONS
-
- Function NextCode(PrevCodeStr: String; L : integer): string
- Function Space(i : integer): string
- Function UpCaseStr(s:String):String
- Function Timestamp: LongInt
-
-
- ObjectBase Users Guide Page 32
-
-
- ORDER and REGESTRATION FORM
-
- Please return this form with your order or registration fee.
-
- Name:______________________________________________________
- last first mi
-
- Company:___________________________________________________
-
- Address:___________________________________________________
-
- ___________________________________________________
-
- City:_____________________________ St:______ Zip:__________
-
- Phone:(______)______-______________
-
- **** License Agreement ***************************************
-
- I would like to register the use of the ObjectBase Developers Toolbox
- for use with Turbo Pascal v5.5. In doing so I agree to abide by the
- copyright laws of the United States. I may use ObjectBase to develope
- applications for sale or use to/by use of others without royalties but
- I will not provide ObjectBase to other individuals or Companies for
- their use in developement without express written consent of the
- Author or his representative. Furthermore I will not alter the
- contents of the afore mentioned Software nor remove any Copyright
- notices contained within it.
-
- Signature:___________________________________ Date: ____________
-
- Description Price Qty Inclosed
- ----------------------------------------------------------------
- ObjectBase Developers ToolBox ...@79.95 ea ____ _________
-
- ObjectInterFace Dvlprs TlBx .....@79.95 ea ____ _________
-
- SubTotal ................................... _________
-
- Tax (if New York state resident) @ 7% _________
-
- Total Inclosed (Check or MoneyOrder)........ _________
-
- Disk Size Required [_] 3.5" [_] 5.25" (Check one)
-
- Product shipped at no charge within Continental United States.
- No COD's accepted.
-
- Return this form with Check or Money Order to:
-
- Thomas W. Harden
- Harden Consulting
- 48 Red Post Crescent
- Fairport, NY 14450