home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Black Box 4
/
BlackBox.cdr
/
database
/
edb21.arj
/
EDB.DOC
< prev
next >
Wrap
Text File
|
1991-04-03
|
14KB
|
263 lines
EDB
Ed's Data Base
Copyright 1991 Ed Hand
This file is in two sections. The first deals with the use of
EDB.EXE. The second section goes into detail on the format of the
form file and how to write your own form files.
Section One: How to get around in EDB
EDB is a database whose format is defined by an ascii form file.
The form file has an extension of ".frm". The fields of a form can
contain simple static information for display or accept any format of
input.
Execution of EDB is simple. The name of the form file is given
on the command line with no other arguments. For example:
EDB PHOTO
This will start EDB and try to open a file named "PHOTO.FRM".
If the file cannot be found in the current directory EDB will issue
an error and halt execution. If the file is successfully opened then
EDB will read the form description, draw the screen and then allow
you to start processing. To run EDB the only files needed are the
executable EDB.EXE and a form file.
Once EDB has been started you will see a working screen. You
will stay at this screen for the entire program. All commands are
available from an options menu at the top of the screen. There are
several ways to select a command. You may use the arrow keys to move
the cursor around to the different commands. Or for most commands
you may simply enter the first letter of the command and EDB will
move the cursor to that command. The only exception to this is the
compress command. To move to the compress command enter the letter
"O", the second letter of the word. Once the command is highlighted
press enter to select the command. Users of emacs can also use
standard emacs cursor commands to move the cursor:
Cntrl-P and Cntrl-B move to the previous command.
Cntrl-F and Cntrl-N move to the next command.
Note that the emacs commands only work on the options menu. If you
are editing a field and enter a control character it will be entered
as part of the data. More on that later. From the options menu you
may also use Cntrl-R or Cntrl-L to redraw the screen. This is useful
if an ill behaved TSR pop-up doesn't repaint the screen upon exit.
The EDB options commands are as follows:
Exit - Exit the current session and return to the dos
prompt.
Add - This function places the user in the first field of
the form and accepts data until the user exits the
form. The data is then stored as the next entry in
the database. If the specified database file does
not exist then EDB will issue an error and toss the
entered data. If a database does not exist the add
function does NOT try to create it.
Create - This option is used to create a new database file.
The cursor will be placed in the form at the
location of the field used to hold the filename.
After the user provides a filename EDB will create a
file of the form <filename>.EDB and put a standard
EDB header on the file. This option must be used
before an add may be performed. If the named file
already exists then EDB will not create the new
database file.
Search - This option puts the user in the form and lets him
enter data into any/all/none of the fields. After
the user exits the form any fields that had data
entered in them will be used for search criteria.
The only field that requires a value to be entered
is the field that holds the database file name. If
the rest of the fields are left blank then all rows
will be found.
Modify - After a search has completed, the retrieved data
may be modified with this command. The user will be
placed in the form and allowed to edit any field
desired. If the user edits the name of the database
file then EDB will try to add the entry to the newly
named file, if it exists. If it writes the entry to
the new file then it will also set the delete bit on
the entry in the old file.
Next - Moves to the next row found by search or find.
Previous - Moves to the previous row found by search or
find.
Delete - This row will set the delete bit for the current
record. It will first ask for confirmation before
marking the record as deleted.
Report - This row will prompt for a file name and then write
a copy of each record in the current search list to
the file. If no file name is given EDB will default
to <formname.RPT>. There are two choices for the
format of the report. You may select either a comma
separated list or a file with one line for each
field using a "<field prompt>: <data value>" format.
Compress - This option will compress a database file by
removing all entries with the delete bit set. It
does this by creating a temporary file and reading
all non-deleted entries to that file. Upon
successful completion EDB will then rename the old
database to <filename.old> and rename the temporary
file to <filename.EDB>. Thus if there are any
errors during the compression the original file will
be left intact and in place.
Find - This option is the same as search with one exception.
This command will find matching entries even if they
are marked as deleted.
Undelete - This is the opposite of delete. If a row is
deleted by mistake or for any reason needs to be
made active after a deletion this option will clear
the delete bit for that row. The find command must
be used to locate a deleted row since search ignores
deleted records.
When entering data into fields EDB requires that a carriage
return be entered for the data to be accepted. To exit a form the
user must enter an escape character as the first character in a
field. If the user enters ANY character after a normal displayable
character in a field, that character will be accepted as data. To
exit a form the user must enter a carriage return to get to the next
field if any data has been entered in the current field. Then an
escape may be entered to keep the data or a CNTRL-C may be entered to
cancel the current operation.
Section Two: Form File Syntax
The form file is a simple ascii file that describes how to draw
the screen. Any form of white space may separate the fields in the
form file. A form field description may contain several fields in
the form file.
The first field of the file is a single integer. This is the
number of form fields described in the file. The rest of the file
describes the actual fields of the database.
There are six different types of form fields. Each form field
definition starts with a letter that identifies that fields type.
The letters are "a", "d", "i", "l", "D", and "T".
After the identifying character each field description is
followed by an x and y coordinate value. These two values tell EDB
were on the screen to put the first character of the fourth parameter
of the field.
The fourth parameter is a quoted text string. In most cases
this string acts as a prompt for the field. In one case this string
is just static information to display at some point on the screen.
If you don't want a prompt then define this as a null field (ie. "").
Some fields require a fifth parameter. This is a data type
parameter. It tells what kind of data the field holds. Valid
values for this option are:
i - An integer value. All integers are stored as a 32
bit value in the database.
f - A floating point value. All floating point numbers
are stored as doubles.
s - A string. Strings are stored at whatever length the
field is defined to be, padded if needed.
The sixth parameter, for fields that need it, is the field length.
It defines the number of characters allocated on the screen for a
field.
Please examine the sample form files delivered with this product
for examples on how to implement a form file. The syntax for each
field type follows.
Type = a
Syntax - a <x> <y> <"prompt"> <data_type> <length>
This is a special field. There may be only one in any
form. Each time you add a new record to a database with
this field in the form, this field will automatically
increment. This field must be of data_type integer.
When modifying records created with a form using this
field, this field may not be modified.
Type = d
Syntax - d <x> <y> <"prompt"> <data_type> <length> [places]
This is a standard data field. Most fields in a form
will be of this type. These fields can have a data_type
of integer, floating point, or string. If this field
has a data_type of floating point then you must also
specify the number of decimal places to display on the
screen. Otherwise the "places" parameter is left blank.
Type = i
Syntax - i <x> <y> <"text">
This is a static information field. It is used to place
a string of text on the screen that will not change. It
is useful for placing a name over a subsection of a
form.
Type = l
Syntax - l <x> <y> <"prompt">
This is a location field. It is used to hold the name
of the database file to use. The idea here being that
the same form can be used with several files. Note
however, when doing a search or find only one filename
can be used. Searching of multiple files is planned as
a future feature. Each form may contain only one
location field.
Type = D
Syntax - D <x> <y> <"prompt">
This is a date field. It holds a four byte structure
that is a date. If the first and only character entered
in this field is a "T", then EDB will return the current
date. The way the date is displayed is dependent on
your country code. If you don't have country.sys
running or country is set to U.S. then the date is
displayed as "mm/dd/yy". The date will display as
"dd/mm/yy" for european users and as "yy/mm/dd" for
asian user if country.sys is properly installed. Please
note that you must enter a date in the same format it is
displayed in or EDB will get confused. At this time
there is no check to insure a valid date.
Type = T
Syntax - T <x> <y> <"prompt">
This is a time field. It is identical to the date field
but holds a time stamp instead. As with the date field,
a "T" will return the current system time.
Now for the limiting factors.
No more than thirty-two fields per form.
No more than one screen per form. In other words, your form
cannot be more than eighteen lines long. However, this is something
I plan to change in the future.
The suggested working area for the screen is from lines six
through twenty-three inclusive. And columns two through seventy-nine
inclusive.
Well, if you find any bugs or problems let me know. Also if you
have any suggestions or ideas feel free to send them to me also.
My INTERNET address is:
hande@infonode.ingr.com