home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-03-27 | 42.5 KB | 1,587 lines |
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- C DataBase Management System (CDB)
-
-
- Version 1.14
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Copyright (C) 1989, 1990, 1991
- by
- Daytris
-
-
-
-
-
- Introduction
-
-
-
-
-
-
-
-
-
- CDB is a complete database development kit designed for C programmers.
-
- CDB is based on both NETWORK and RELATIONAL database models and uses
- a B-TREE/ISAM methodology for key file management. The kit also uses
- the advanced concept of a Data Definition Language (DDL). Using the
- DDL, a developer can design and re-design their database with minimal
- effort and absolutely no code changes.
-
- Libraries are available for both Microsoft and Turbo C under MS-DOS.
- The libraries included in this trial version are compiled for the small
- memory model. Other memory models are available with registration.
- Source code is also available.
-
- There is a version of CDB for UNIX and an MS-Windows release will be
- available early in the second quarter of 1991.
-
- CDB is written entirely in C for portability.
-
- If you have any questions about CDB, please call us at (201) 332-5228
- or send a message to any of the BBS's listed below:
-
- Developers: Daytris
- 81 Bright Street, Suite 1E
- Jersey City, NJ 07302
- (201) 332-5228
-
- CompuServe ID: 72500,1426
- BIX: daytris
- GEnie: t.fearn
-
-
-
- Database Development Files
-
-
-
- These files are contained in the ZIP file CDB114.ZIP:
-
- CDB.DOC This file
- UPDATES.DOC A history of CDB modifications
- MSCCDBS.LIB Microsoft C database development library (small
- model)
- TCCDBS.LIB Turbo C database development library (small model)
- DDLP.EXE Data Definition Language Parser
- DBDLIST.EXE Database Definition (DBD) file display utility
- DBMGR.H Database development header file
- TEST.DDL Example DDL (Data Definition Language) file
- TEST.C Example CDB development file
- * MSCTEST.MAK Microsoft C test.c make file
- * TCTEST.MAK Turbo C test.c make file
-
-
- These files are contained in the ZIP file CDBSRC.ZIP:
- (Received upon registration)
-
- DBMGR.C CDB source files
- DBFIND.C
- DBGET.C
- DBADD.C
- DBUPD.C
- DBDEL.C
- DBCURR.C
- DBPAGE.C
- DBSLOT.C
- DBFILE.C
- DBFUNCS.C
- STDINC.H CDB header files
- DBXTRN.H
- * MSCLIB.MAK Microsoft C CDB library make file
- * TCLIB.MAK Turbo C CDB library make file
-
- MAIN.C DDLP source files
- PARSE.C
- DDLP.C
- ERROR.C
- DDLP.H DDLP header file
- * DDLP.MAK DDLP make file
-
- DBDLIST.C DBDLIST source file
- * DBDLIST.MAK DBDLIST make file
-
-
- * All make files are Unix Make compatible.
-
-
-
- Data Definition Language (DDL)
-
-
- The Data Definition Language is used to define your database. DDLP
- (Data Definition Language Parser) is used to create a .DBD (Database
- Definition) file from the .DDL (Data Definition Language) file. The
- .DBD file is read into memory when the database is opened and is used
- as a map into this particular database. DDLP will also output a C
- header file defining your database records in a standard C format.
-
- This concept allows you to change your database model at will during
- the development cycle of your project without changing one line of
- development code.
-
- A sample DDL (test.ddl) is included in this kit. Notice that the DDL
- is very similar to a C header file. The only differences from a
- standard C header file are the keywords: PREFIX, CONNECT, and KEY.
-
-
- PREFIX
-
- Before we can discuss this prefix, you must first know how the database
- files are created. For each record defined in the DDL, a separate
- data and a separate key file will be created when you add the first
- record of this type. The key file will only be created if you have
- a key field in the record. The data file for the first record in the
- DBD is named XXXX0001.DAT where XXXX is the predefined prefix. The
- key file is named XXXX0001.KEY.
-
- The prefix can be up to 4 characters. This prefix is not required.
- For example, if you choose a prefix of "ABC" as shown in test.ddl, when
- the first record of the first file is added, two files will be created.
- They will be ABC0001.KEY and ABC0001.DAT.
-
- Note: Keep in mind that the first record in the DDL may not correspond
- to the file name XXXX0001.XXX. This is because DDLP rearranges
- the records in alphabetic order when it creates the DBD. So the
- XXXX0001.XXX file will correspond to the alphabetically lowest
- record value in the DDL.
-
-
- CONNECT
-
- This keyword allows you to make connections between records without
- physically storing keys in each record to connect them.
-
- For example, if you would like to connect an "Invoice" to a "Customer"
- using the RELATIONAL model, you must store a unique key in both
- records and then retrieve the records using the unique key. Using
- the NETWORK model, once you add the "Customer" and the "Invoice", you
- can make a set connection between the two records using the "DbSetAdd"
- macro. DbSetAdd( "Customer", "Invoice"); "Customer" becomes the
- owner of the "Invoice". "Invoice" is a member of that particular
- "Customer". The connection is only possible if you have defined in
- the "Customer" record a connection to the "Invoice" record. This is
- a one-to-many relationship.
-
-
-
- To create a many-to-many relationship using the same example, a
- "connect Customer;" placed in the "Invoice" record would enable you to
- make the "Customer" a member record of the "Invoice". Using the macro
- DbSetAdd( "Invoice", "Customer"); would make the set connection.
- Although you may rarely see the need for a many-to-many relationship,
- the power to do so is available.
-
- Beginning with release 1.13 of CDB, set connections can be stored by
- a key value, if so desired. This is accomplished by expanding the
- CONNECT phrase to 'CONNECT record_name KEY key_field_name'. The
- key_field_name can be any field name in the member record. It does
- not have to be a key field in the member record. Example:
-
- /* test.ddl */
-
- struct Customer
- {
- connect Address key street;
- connect Invoice;
- key long acctNbr;
- key char company[31];
- double balance;
- };
-
- struct Address
- {
- char street[31];
- char city[21];
- char state[3];
- key char zip[10];
- key char telephone[11];
- };
-
- When set connections are made (e.g. DbSetAdd("Customer","Address")),
- the Address members will be stored by 'street'. If no key were
- specified for the connection, the members would be stored in the
- order in which they are added.
-
- Note: Keep in mind that to use CDB, you are not required to use
- the CONNECT keyword in your database model (DDL). Depending
- on your specific requirements, you may find it advantageous
- to use only the RELATIONAL features of CDB.
-
-
- KEY
-
- This keyword simply defines a key field for a record. You can have
- up to 8 keys per record and the maximum size of a key field is 256
- bytes. If you have registered and have the source code, these
- limitations can be overcome very easily by modifying #define values.
- If a record is defined with no keys, that record cannot be accessed
- unless there is a set connection to that particular record.
-
-
-
- Utilities
-
-
-
- DDLP.EXE
-
- DDLP is the DDL parser (compiler) that creates a DataBase Definition
- file (.DBD) from the DDL. This .DBD file is used as a map into the
- database when this database is opened. DDLP also creates a header
- file from the DDL for use in your C program.
-
- Usage: DDLP filename(.ddl)
-
-
-
-
- DBDLIST.EXE
-
- DBDLIST is a DBD display utility. Using this utility you can display
- the internal contents of a .DBD file.
-
- Usage: DBDLIST filename.dbd
-
-
-
- Modifying the Database Design
-
-
-
- It is very simple to modify the general database design by changing
- some of the defined values in DBMGR.H.
-
-
- #define NBRHANDLES 12
-
- This value is the number of file handles allowed to be open by the
- database at one time. If you have a database with a large number of
- records, it is a good idea to leave this value alone or increase it
- slightly. Remember that the maximum number of file handles available
- for a process under DOS is 20 and the system uses 5. If your database
- has only a few records, it may be a good idea to lower this value.
-
- For example, suppose your database has only 3 records. Each has at
- least one key field. Since the maximum number of files for this
- database is 6, you should reduce the NBRHANDLES to 6.
-
- The file handles are opened and closed using an LRU (least recently
- used) algorithm for maximum file handle management.
-
-
- #define MAXKEY 8
-
- This value is the maximum number of keys that a single record can have.
- You can adjust this value according to your usage. It is recommended
- that this value be a power of 2.
-
-
- #define KEYPAGESIZE 512
-
- This value is the size of a page for the .key data files. The keys
- in the database are stored on pages in a sorted order. The pages are
- linked together through a link list. If your database key fields are
- very large, you may wish to increase this value to store more keys on
- a page. Note: The larger the key page size, the longer the access
- time for read and writing. It is recommended that this value be a
- power of 2.
-
-
- #define NBRPAGES 16
-
- This value is the number of key pages that are buffered in RAM. These
- buffers are accessed using an LRU (least recently used) algorithm for
- maximum page management.
-
-
- #define DATAPAGESIZE 2048
-
- This value is the size of a page for the .dat data files. Each record
- is stored in slots on pages in the data files. Each slot has some
- reserved information at beginning of each slot. It is recommended that
- this value be a power of 2.
-
-
-
- #define DATASLOTSIZE 1024
-
- This value is the maximum size of a data slot. Each data file is made
- up of pages which consist of a group of slots. You will need to
- increase this value if any of your record sizes, when plugged into the
- formula below, exceed 1024.
-
- Formula: (C structure byte length) + 6 +
- (number of owners of this record * 8) +
- (number of members of this record * 12) > 1024
-
- If you have very large C structures you should check them. It is
- recommended that DATASLOTSIZE be a power of 2.
-
-
-
- Database Macro Index
-
-
-
-
-
- General Database Macros
-
- void DbClose( void);
- void DbFlush( void);
- int DbOpen( char *database);
-
-
- Record Macros
-
- int DbRecordAdd( char *record, char *source);
- int DbRecordDelete( char *record);
- int DbRecordFindByKey( char *record, char *field, char *key);
- int DbRecordFindFirst( char *record, char *field);
- int DbRecordFindLast( char *record, char *field);
- int DbRecordFindNext( char *record, char *field);
- int DbRecordFindPrev( char *record, char *field);
- int DbRecordGetCurrency( char *record, char *currency);
- int DbRecordGetByKey( char *record, char *field, char *target, char *key);
- int DbRecordGetCurrent( char *record, char *field, char *target);
- int DbRecordGetFirst( char *record, char *field, char *target);
- int DbRecordGetLast( char *record, char *field, char *target);
- int DbRecordGetNext( char *record, char *field, char *target);
- int DbRecordGetPrev( char *record, char *field, char *target);
- int DbRecordUpdate( char *record, char *source);
- int DbRecordUpdCurrency( char *record, char *currency);
-
-
- Set Macros
-
- int DbSetAdd( char *owner, char *member);
- int DbSetDelete( char *owner, char *member);
- int DbSetFindFirst( char *owner, char *member);
- int DbSetFindLast( char *owner, char *member);
- int DbSetFindNext( char *owner, char *member);
- int DbSetFindPrev( char *owner, char *member);
- int DbSetGetFirst( char *owner, char *member, char *target);
- int DbSetGetLast( char *owner, char *member, char *target);
- int DbSetGetNext( char *owner, char *member, char *target);
- int DbSetGetOwner( char *owner, char *member, char *target);
- int DbSetGetPrev( char *owner, char *member, char *target);
-
-
- All database macros call the function "dbc" to provide one central
- entry and exit point in the database.
-
-
-
-
- DbClose
- -------------------------------------------------------------------------
-
-
-
- void DbClose( void);
-
-
- Description
-
- This call closes the database that is currently open.
-
-
- Example
-
- #include "dbmgr.h"
-
- main()
- {
- strcpy( dbpath, "\\PROJECT\\DATA");
-
- if( DbOpen( "test.dbd"))
- {
- ...error handling
- }
-
- .
- .
- .
-
- Dbclose();
- }
-
-
-
-
- DbFlush
- -------------------------------------------------------------------------
-
-
-
- void DbFlush( void);
-
-
- Description
-
- This function forces all data written to the database to disk.
-
-
- Example
-
- #include "dbmgr.h"
-
- Function()
- {
- DbRecordUpdate( "customer", &customer);
-
- DbFlush();
- }
-
-
-
-
- DbOpen
- -------------------------------------------------------------------------
-
-
-
- int DbOpen( database);
- char *database; Database name
-
-
- Description
-
- This call opens a database. The database must be a DBD (DataBase
- dictionary) created using DDLP. Only one database can be opened at
- a time. The global "dbpath" buffer can be used to define the
- database path. If "dbpath" is not set, the default path is the
- current directory.
-
-
- Example
-
- #include "dbmgr.h"
-
- main()
- {
- strcpy( dbpath, "\\PROJECT\\DATA");
-
- if( DbOpen( "test.dbd"))
- {
- ...error handling
- }
- }
-
-
-
-
- DbRecordAdd
- -------------------------------------------------------------------------
-
-
-
- int DbRecordAdd( record, source);
- char *record; Record name
- char *source; Source pointer
-
-
- Description
- Add a record to the database.
-
-
- Example
-
- #include "dbmgr.h"
-
- Function()
- {
- struct CustomerTable customer;
-
- .
- .
- .
- fill record
- .
- .
- .
-
- if( DbRecordAdd( "customer", (char *)&customer))
- printf( "Error: adding customer record\n");
- }
-
-
-
-
- DbRecordDelete
- -------------------------------------------------------------------------
-
-
-
- int DbRecordDelete( record);
- char *record; Record name
-
-
- Description
- Delete a record in the database. The record you wish to delete must
- be current.
-
-
- Example
-
- #include "dbmgr.h"
-
- Function()
- {
- long accountNbr = 1000L;
- struct CustomerTable customer;
-
-
- if( DbRecordFindByKey( "customer", "acctnbr",
- (char *)&accountNbr))
- {
- printf( "Error: finding customer record\n");
- }
-
- if( DbRecordDelete( "customer"))
- printf( "Error: deleting customer record);
- }
-
-
-
-
- DbRecordFindByKey
- -------------------------------------------------------------------------
-
-
-
- int DbRecordFindByKey( record, field, key);
- char *record; Record name
- char *field; Key field name
- char *key; Key value used in search
-
-
- Description
- Find a specific record using a key field and a key value. If the
- exact match cannot be found the function will return E_NEXTGUESS
- specifying that the match returned is the next best guess.
-
-
- Example
-
- #include "dbmgr.h"
-
- Function()
- {
- unsigned long accountNbr = 1000L;
-
- if( DbRecordFindByKey( "customer", "acctnbr",
- (char *)&accountNbr))
- {
- printf( "Error: customer not found\n");
- }
-
- if( DbRecordFindByKey( "customer", "company",
- "Charter Insurance Inc."))
- {
- printf( "Error: customer not found\n");
- }
- }
-
-
-
-
- DbRecordFindFirst
- -------------------------------------------------------------------------
-
-
-
- int DbRecordFindFirst( record, field);
- char *record; Record name
- char *field; Key field name
-
-
- Description
- Find the first record of a certain record type. The record must be
- retreived using a key field.
-
-
- Example
-
- #include "dbmgr.h"
-
- Function()
- {
- if( DbRecordFindFirst( "customer", "zipcode"))
- printf( "Error: customer not found\n");
- }
-
-
-
-
- DbRecordFindLast
- -------------------------------------------------------------------------
-
-
-
- int DbRecordFindLast( record, field);
- char *record; Record name
- char *field; Key field name
-
-
- Description
- Find the last record of a certain record type. The record must be
- retreived using a key field.
-
-
- Example
-
- #include "dbmgr.h"
-
- Function()
- {
- if( DbRecordFindLast( "customer", "zipcode"))
- printf( "Error: customer not found\n");
- }
-
-
-
-
- DbRecordFindNext
- -------------------------------------------------------------------------
-
-
-
- int DbRecordFindNext( record, field);
- char *record; Record name
- char *field; Key field name
-
-
- Description
- Find the next record of a certain record type. The record must be
- retreived using a key field.
-
-
- Example
-
- #include "dbmgr.h"
-
- Function()
- {
- if( DbRecordFindNext( "customer", "zipcode"))
- printf( "Error: customer not found\n");
- }
-
-
-
-
- DbRecordFindPrev
- -------------------------------------------------------------------------
-
-
-
- int DbRecordFindPrev( record, field);
- char *record; Record name
- char *field; Key field name
-
-
- Description
- Find the previous record of a certain record type. The record must
- be retreived using a key field.
-
-
- Example
-
- #include "dbmgr.h"
-
- Function()
- {
- if( DbRecordFindLast( "customer", "zipcode"))
- printf( "Error: customer not found\n");
- }
-
-
-
-
- DbRecordGetCurrency
- -------------------------------------------------------------------------
-
-
-
- int DbRecordGetCurrency( record, currency);
- char *record; Record name
- char *currency; Ptr to currency record
-
-
- Description
-
- This function allows you to save the current position (currency) of
- a specific record type.
-
-
- Example
-
- #include "dbmgr.h"
-
- Function()
- {
- struct currency_index currency;
-
- DbRecordGetCurrency( (char *)¤cy, "customer");
-
- .
- .
- .
- processing
- .
- .
- .
-
- DbRecordUpdCurrency( (char *)¤cy, "customer");
- }
-
-
-
-
- DbRecordGetByKey
- -------------------------------------------------------------------------
-
-
-
- int DbRecordGetByKey( record, field, target, key);
- char *record; Record name
- char *field; Key field name
- char *target; Destination pointer
- char *key; Key value used in search
-
-
- Description
- Get a specific record using a key field and a key value. If the
- exact match cannot be found the function will return E_NEXTGUESS
- specifying that the match returned is the next best guess.
-
-
- Example
-
- #include "dbmgr.h"
-
- Function()
- {
- unsigned long accountNbr = 1000L;
- struct CustomerTable customer;
-
- if( DbRecordGetByKey( "customer", "acctnbr", (char *)&customer,
- (char *)&accountNbr))
- {
- printf( "Error: customer not found\n");
- }
-
- if( DbRecordGetByKey( "customer", "company", (char *)&customer,
- "Charter Insurance Inc."))
- {
- printf( "Error: customer not found\n");
- }
- }
-
-
-
-
- DbRecordGetCurrent
- -------------------------------------------------------------------------
-
-
-
- int DbRecordGetCurrent( record, field, target);
- char *record; Record name
- char *field; Key field name
- char *target; Destination pointer
-
-
- Description
- This function will retreive the current record of a specific record
- type using the currency table for that record. The record must be
- retreived using a key field.
-
-
- Example
-
- #include "dbmgr.h"
-
- Function()
- {
- struct CustomerTable customer;
-
- DbRecordGetCurrent( "customer", "zipcode", (char *)&customer);
- }
-
-
-
-
- DbRecordGetFirst
- -------------------------------------------------------------------------
-
-
-
- int DbRecordGetFirst( record, field, target);
- char *record; Record name
- char *field; Key field name
- char *target; Destination pointer
-
-
- Description
- Get the first record of a certain record type. The record must be
- retreived using a key field.
-
-
- Example
-
- #include "dbmgr.h"
-
- Function()
- {
- struct CustomerTable customer;
-
- if( DbRecordGetFirst( "customer", "zipcode", (char *)&customer))
- printf( "Error: customer not found\n");
- }
-
-
-
-
- DbRecordGetLast
- -------------------------------------------------------------------------
-
-
-
- int DbRecordGetLast( record, field, target);
- char *record; Record name
- char *field; Key field name
- char *target; Destination pointer
-
-
- Description
- Get the last record of a certain record type. The record must be
- retreived using a key field.
-
-
- Example
-
- #include "dbmgr.h"
-
- Function()
- {
- struct CustomerTable customer;
-
- if( DbRecordGetLast( "customer", "zipcode", (char *)&customer))
- printf( "Error: customer not found\n");
- }
-
-
-
-
- DbRecordGetNext
- -------------------------------------------------------------------------
-
-
-
- int DbRecordGetNext( record, field, target);
- char *record; Record name
- char *field; Key field name
- char *target; Destination pointer
-
-
- Description
- Get the next record of a certain record type. The record must be
- retreived using a key field.
-
-
- Example
-
- #include "dbmgr.h"
-
- Function()
- {
- struct CustomerTable customer;
-
- if( DbRecordGetNext( "customer", "zipcode", (char *)&customer))
- printf( "Error: customer not found\n");
- }
-
-
-
-
- DbRecordGetPrev
- -------------------------------------------------------------------------
-
-
-
- int DbRecordGetPrev( record, field, target);
- char *record; Record name
- char *field; Key field name
- char *target; Destination pointer
-
-
- Description
- Get the previous record of a certain record type. The record must be
- retreived using a key field.
-
-
- Example
-
- #include "dbmgr.h"
-
- Function()
- {
- struct CustomerTable customer;
-
- if( DbRecordGetPrev( "customer", "zipcode", (char *)&customer))
- printf( "Error: customer not found\n");
- }
-
-
-
-
- DbRecordUpdate
- -------------------------------------------------------------------------
-
-
-
- int DbRecordUpdate( record, source);
- char *record; Record name
- char *source; Source pointer
-
-
- Description
- Update a record in the database. The record you wish to update must
- be current.
-
-
- Example
-
- #include "dbmgr.h"
-
- Function()
- {
- long accountNbr = 1000L;
- struct CustomerTable customer;
-
-
- if( DbRecordGetByKey( "customer", "acctnbr", (char *)&customer,
- (char *)&accountNbr))
- {
- printf( "Error: getting customer record\n");
- }
-
- .
- .
- .
- modify record
- .
- .
- .
-
- if( DbRecordUpdate( "customer", (char *)&customer))
- printf( "Error: updating customer record);
- }
-
-
-
-
- DbRecordUpdCurrency
- -------------------------------------------------------------------------
-
-
-
- int DbRecordUpdCurrency( record, currency);
- char *record; Record name
- char *currency; Ptr to currency record
-
-
- Description
-
- This function allows you to update the current position (currency) of
- a specific record type.
-
-
- Example
-
- #include "dbmgr.h"
-
- Function()
- {
- struct currency_index currency;
-
- DbRecordGetCurrency( (char *)¤cy, "customer");
-
- .
- .
- .
- processing
- .
- .
- .
-
- DbRecordUpdCurrency( (char *)¤cy, "customer");
- }
-
-
-
-
- DbSetAdd
- -------------------------------------------------------------------------
-
-
-
- int DbSetAdd( owner, member);
- char *owner; Owner name
- char *member; Member name
-
-
- Description
- Create a set connection between two records. Both records must have
- currency before creating the set connection.
-
-
- Example
-
- #include "dbmgr.h"
-
- Function()
- {
- long accountNbr = 1000L;
-
- DbRecordFindByKey( "customer", "acctnbr", (char *)&accountNbr);
- DbFindRecordbyKey( "address", "zipcode", "99999");
-
- if( DbSetAdd( "customer", "address"))
- printf( "Error: set connection not created\n");
- }
-
-
-
-
- DbSetDelete
- -------------------------------------------------------------------------
-
-
-
- int DbSetDelete( owner, member);
- char *owner; Owner name
- char *member; Member name
-
-
- Description
- Remove a set connection between two records. Both records must have
- currency before removing the set connection.
-
-
- Example
-
- #include "dbmgr.h"
-
- Function()
- {
- long accountNbr = 1000L;
-
- DbRecordFindByKey( "customer", "acctnbr", (char *)&accountNbr);
- DbFindRecordbyKey( "address", "zipcode", "99999");
-
- if( DbSetDelete( "customer", "address"))
- printf( "Error: set connection not deleted\n");
- }
-
-
-
-
- DbSetFindFirst
- -------------------------------------------------------------------------
-
-
-
- int DbSetFindFirst( owner, member);
- char *owner; Owner name
- char *member; Member name
-
-
- Description
- Find the first set connection between an owner and member record.
-
-
- Example
-
- #include "dbmgr.h"
-
- Function()
- {
- long accountNbr = 1000L;
-
- DbFindRecordbyKey( "customer", "acctnbr", (char *)&accountNbr);
-
- if( DbSetFindFirst( "customer", "address"))
- printf( "Error: set connection not found\n");
- }
-
-
-
-
- DbSetFindLast
- -------------------------------------------------------------------------
-
-
-
- int DbSetFindLast( owner, member);
- char *owner; Owner name
- char *member; Member name
-
-
- Description
- Find the last set connection between an owner and member record.
-
-
- Example
-
- #include "dbmgr.h"
-
- Function()
- {
- long accountNbr = 1000L;
-
- DbFindRecordbyKey( "customer", "acctnbr", (char *)&accountNbr);
-
- if( DbSetFindLast( "customer", "address"))
- printf( "Error: set connection not found\n");
- }
-
-
-
-
- DbSetFindNext
- -------------------------------------------------------------------------
-
-
-
- int DbSetFindNext( owner, member);
- char *owner; Owner name
- char *member; Member name
-
-
- Description
- Find the next set connection between an owner and member record.
-
-
- Example
-
- #include "dbmgr.h"
-
- Function()
- {
- long accountNbr = 1000L;
-
- DbFindRecordbyKey( "customer", "acctnbr", (char *)&accountNbr);
-
- if( DbSetFindFirst( "customer", "address"))
- printf( "Error: set connection not found\n");
- if( DbSetFindNext( "customer", "address"))
- printf( "Error: set connection not found\n");
- }
-
-
-
-
- DbSetFindPrev
- -------------------------------------------------------------------------
-
-
-
- int DbSetFindPrev( owner, member);
- char *owner; Owner name
- char *member; Member name
-
-
- Description
- Find the previous set connection between an owner and member record.
-
-
- Example
-
- #include "dbmgr.h"
-
- Function()
- {
- long accountNbr = 1000L;
-
- DbFindRecordbyKey( "customer", "acctnbr", (char *)&accountNbr);
-
- if( DbSetFindLast( "customer", "address"))
- printf( "Error: set connection not found\n");
- if( DbSetFindPrev( "customer", "address"))
- printf( "Error: set connection not found\n");
- }
-
-
-
-
- DbSetGetFirst
- -------------------------------------------------------------------------
-
-
-
- int DbSetGetFirst( owner, member, target);
- char *owner; Owner name
- char *member; Member name
- char *target; Destination pointer
-
-
- Description
- Get the first set connection between an owner and member record.
- The member record will be retrieved.
-
-
- Example
-
- #include "dbmgr.h"
-
- Function()
- {
- long accountNbr = 1000L;
- struct AddressTable address;
-
- DbFindRecordbyKey( "customer", "acctnbr", (char *)&accountNbr);
-
- if( DbSetGetFirst( "customer", "address", (char *)&address))
- printf( "Error: set not found\n");
- }
-
-
-
-
- DbSetGetLast
- -------------------------------------------------------------------------
-
-
-
- int DbSetGetLast( owner, member, target);
- char *owner; Owner name
- char *member; Member name
- char *target; Destination pointer
-
-
- Description
- Get the last set connection between an owner and member record.
- The member record will be retrieved.
-
-
- Example
-
- #include "dbmgr.h"
-
- Function()
- {
- long accountNbr = 1000L;
- struct AddressTable address;
-
- DbFindRecordbyKey( "customer", "acctnbr", (char *)&accountNbr);
-
- if( DbSetGetLast( "customer", "address", (char *)&address))
- printf( "Error: set not found\n");
- }
-
-
-
-
- DbSetGetNext
- -------------------------------------------------------------------------
-
-
-
- int DbSetGetNext( owner, member, target);
- char *owner; Owner name
- char *member; Member name
- char *target; Destination pointer
-
-
- Description
- Get the next set connection between an owner and member record.
- The member record will be retrieved.
-
-
- Example
-
- #include "dbmgr.h"
-
- Function()
- {
- long accountNbr = 1000L;
- struct AddressTable address;
-
- DbFindRecordbyKey( "customer", "acctnbr", (char *)&accountNbr);
-
- if( DbSetGetFirst( "customer", "address", (char *)&address))
- printf( "Error: set not found\n");
- if( DbSetGetNext( "customer", "address", (char *)&address))
- printf( "Error: set not found\n");
- }
-
-
-
-
- DbSetGetOwner
- -------------------------------------------------------------------------
-
-
-
- int DbSetGetOwner( owner, member, target);
- char *owner; Owner name
- char *member; Member name
- char *target; Destination pointer
-
-
- Description
- Get the owner of a record. A set connection must exist between owner
- and member. The owner record will be retrieved.
-
-
- Example
-
- #include "dbmgr.h"
-
- Function()
- {
- struct CustomerTable customer;
- struct AddressTable address;
-
- DbFindRecordbyKey( "address", "zipcode", "99999");
-
- if( DbSetGetOwner( "customer", "address", (char *)&customer))
- printf( "Error: set not found\n");
- }
-
-
-
-
- DbSetGetPrev
- -------------------------------------------------------------------------
-
-
-
- int DbSetGetPrev( owner, member, target);
- char *owner; Owner name
- char *member; Member name
- char *target; Destination pointer
-
-
- Description
- Get the previous set connection between an owner and member record.
- The member record will be retrieved.
-
-
- Example
-
- #include "dbmgr.h"
-
- Function()
- {
- long accountNbr = 1000L;
- struct AddressTable address;
-
- DbFindRecordbyKey( "customer", "acctnbr", (char *)&accountNbr);
-
- if( DbSetGetLast( "customer", "address", (char *)&address))
- printf( "Error: set not found\n");
- if( DbSetGetPrev( "customer", "address", (char *)&address))
- printf( "Error: set not found\n");
- }
-
-
- Errors
-
-
-
- Every database call has the potential for errors to occur. A return
- value of 0 indicates no error has occured.
-
-
- Error returns
- -------------
- E_INVALIDCASE -2
- E_DOS -1
- E_NORECNAME 1
- E_NOFLDNAME 2
- E_INVALIDSET 3
- E_NOTAKEY 4
- E_NOTFOUND 5
- E_NEXTGUESS 6
- E_NOCURRENT 7
- E_NONEXT 8
- E_NOPREV 9
- E_NOMEMBER 10
- E_NOOWNER 11
-
-
-
- E_INVALIDCASE An internal database error. Should this error occur,
- contact technical support.
- E_DOS A DOS error has occured. The error number is in the
- global "errno".
- E_NORECNAME The record name passed is not valid.
- E_NOFLDNAME The field name passed is not valid.
- E_INVALIDSET The set name combination passed is not a valid set.
- The DDL keyword CONNECT must be used to enable set
- connections between records to occur.
- E_NOTAKEY Field name passed is not a key field.
- E_NOTFOUND Record or set not found.
- E_NEXTGUESS The key value passed was not found but the next closest
- match was returned.
- E_NOCURRENT There is no current record for the record(s) specified.
- i.e You are trying to do a DbRecordGetNext before doing
- a DbRecordGetFirst.
- E_NONEXT Next record or set not found.
- E_NOPREV Previous record or set not found.
- E_NOMEMBER Owner record has no member.
- E_NOOWNER Member record has no owner.
-
-
-
-
- Registration Notification
-
-
-
-
- CDB is copyrighted and is the property of Daytris.
-
- CDB is distributed as User-Supported software. Commercial use or
- development using this product requires you to register. Registering
- your copy of the software helps the authors continue to provide
- professional quality software at very reasonable prices.
-
- You have a royalty-free right to reproduce and distribute executable
- files created using the CDB libraries after registration.
-
- The Complete Registration is $45.00 and includes the full library source
- code, all utility source code, make files, royalty-free use of library
- functions, unlimited technical support, and low-cost upgrades.
-
- A Basic Registration is also available for $35.00 which includes all of
- the above excluding source code. With the Basic Registration, the user
- will receive the CDB libraries for the memory model(s) and compiler(s)
- of their choice.
-
- Non-U.S. orders need to include $5.00 extra to cover additional shipping
- and handling charges. Checks and money orders must be drawn on a U.S.
- bank. Please send all payments payable in U.S. Dollars.
-
-
-
- Disclaimer.
-
- The authors claim no responsibility for any damages caused by the use or
- misuse of this product. This product is distributed "as is" with no
- warranty expressed or implied. The authors will not be responsible for
- any losses incurred, either directly or indirectly, by the use of this
- product. The authors reserve the right to make modifications at any
- time. Prices are subject to change without notice.
-
-
- ---------------------------------------------------------------------
-
- Registration Form for CDB
-
-
-
- Name: _________________________________________________
-
- Company: _________________________________________________
-
- Address: _________________________________________________
-
- City, State, Zip: _________________________________________________
-
- Telephone: _________________________________________________
-
- Country: _________________________________________________
-
- E-Mail Address: _________________________________________________
-
-
- Source Code Media:
-
- 5 1/4 " diskette ___
-
- 3 1/2 " diskette ___
-
-
- A. Basic Registration (includes libraries only)
-
- Memory Model(s): ___ Small ___ Medium ___ Compact ___ Large
-
- Compiler(s): ___ MSC ___ Turbo C
-
- Number of Copies ___ X $35 = ______________
-
-
- B. Complete Registration (includes full library source)
-
- Number of Copies ___ X $45 = ______________
-
-
-
- COMMENTS: Please feel free to add your thoughts or suggestions!
-
- _____________________________________________________________________
-
- _____________________________________________________________________
-
- _____________________________________________________________________
-
-
- Make Checks payable to: Daytris
-
- Mail to: Daytris
- 81 Bright Street, Suite 1E
- Jersey City, NJ 07302