URL: http://www.firstbasesoftware.com/man/man1/dbdbas.htm
Last modified: 12 September 1995
Copyright © by FirstBase Software.
[
Index of Contents] [
FirstBase RDBMS Overview]
A database dictionary consists of a series of field descriptors. Each field descriptor contains at least three field attributes: field_name, field_type, and field_size. These and optional field attributes are described below.
Dbdbas(1) allows creation and deletion of field descriptors, as well as modification of field attributes without disturbing attributes already in place. The overall effect is a database-dictionary screen editor complete with an auto add mode, as well as insert and delete capabilities.
A list of simple editor commands appears on the 24th line of the screen at all times, with the standard help signal offering a longer summary of possible commands. Complete interactive error checking is done on the contents of all attributes.
The following is a list of all field attributes and their purpose:
a
- alphanumeric
b
- binary
A
- alpha
c
- choice
C
- choice (no screen display)
d
- date
f
- floating point
F
- Formula (virtual)
L
- Link (to another database)
n
- numeric
N
- positive numeric (>= 0)
U
- Uppercase. (Alphanumeric).
X
- Extended Choice/Help.
$
- dollar
Input into the described field (using dbedit) will be checked according to the value of this field attribute. Note that binary fields can only be manipulated through the use of the FirstBase Library routines fetch(3) and store(3).
For more details on the behavior of each of these field types, see the chapter on dbedit in the FirstBase User's Guide and Reference Manual.
Special meta-defaults that allow softer, less rigid defaults are:
Remember: the field using this auto increment feature MUST be auto indexed. Auto increments work in a multi-user environment. Also, there is an environment variable, FORCEAUTOINCR, that can be used to alleviate the need for the <RETURN> during editing of these fields.
Additionally, for ensured proper behavior, fields using the automatic increment function should be locked (see lock below) so that the increment key is not overwritten (inadvertently).
Note: all database fields have their own increment and previous areas that are used for $INCR and $PREV.
In the case of a formula field, the default input is specialized to achieve formula input. Formulas use numbers to represent fields (i.e. 16 for field 16) and a prepended 'C' or 'c' for constants (i.e. C4.5 for 4.5). Addition (+), subtraction (-), multiplication (*), and division (/) are allowed as operators.
Note: Only dollar, float, numeric and positive numeric fields can be used in formula calculations. This means references to other formulas will not work. Also, all formulas read from left to right, and there is no precedence among the operators.
The precision of a formula is specified by appending a colon (:) to the formula followed by a number. Default precision is two.
For example, if field 5 is hours and field 16 is days, then 5*C4.5:2 would specify a field that would show the pay due to anyone working at $4.50 per hour. And 5/16:6 would show the average number of hours worked per day, carried out to six (6) decimal places.
All formula entries are parsed to determine whether the formula is valid at that moment, with interactive error messages to help debug long formulas. This means re-editing of a formula may be necessary if it has forward references in it. (A forward reference is a reference to a field not yet defined).
Note: these basic formulas are subsumed by the macro field feature. If this simplistic formula entry described here is inadequate, use a macro field to provide a more complex default. See the description of macro files below, and the manual page macro(5).
In the case of a link field, the default input is specialized to handle a link address. Link addresses contain four parts or components, with each component separated by an exclamation point.
An entire link address looks something like
local-field!link-index!link-dbase!far-field
There is also a link method that allows pointing to absolute records. In this case, although a link-index value is listed in the link formula, the link index is ignored, and the absolute record number indicated is used as the link record.
The entire link address using this feature looks like
R@local-field!link-index!link-dbase!far-field
The choice file is only allowed for a field defined to be of type choice. See choice(5) for a definition of the choice file layout. In addition, the AddChoice option flag can be set so users can add new selections to a choicefile (for future use).
An autoindex can also be defined to only allow unique entries into the field during use of dbedit(1). For example, if a field for an account number was being autoindexed with the unique entry option set, then you could not enter two account number 101's into the dbase.
NOTE: A better method for defining autoindex fields is available using a *.auto file. See autoindex(5).
Ranges can also be defined using comma separated fields of accepted values. In other words, the range 'y,n' will only accept a 'y' or an 'n'. Any number of comma separated values can be used.
The macro file specified can assign a default string or value to the field, or can provide the entrance to conditional editing of other fields. The contents of the current record can be tested, additional input can be requested, or complex functions can be generated.
A full description of macro files is in macro(5).
Per normal FirstBase programs, the user is given a chance to change and modify data on the screen via the standard 'any change' screen. This prompt is displayed at the bottom of the screen and the program awaits interactive commands. The following is a list of valid dbdbas(1) commands:
NOTE: in the FirstBase database dictionary some file names are used to specify other data objects: helpfiles, choicefiles, auto indexes, and database link files. When a FirstBase tool is invoked, if the working database is in a different directory, these file names are expanded to reflect the working directory. File names beginning with a dot (.) or a slash (/) will not be expanded.
FirstBase User's Guide and Reference Manual