DATABASE FILES
The basic type of files which Star4Win generates and works with are
database files, with a usual extension .dbf. These
files
are generally compatible with widely used software products like
dBASE
III+, dBASE IV and FoxBase. Star4Win database files, however, have
their
own peculiar features. In order to explain them, we have to dwell in
some
detail on databases in general.
A database file (sometimes called electronic table or
a spreadsheet) is a table-like structure consisting of a certain
amount of records ( = lines), each record being subdivided into fields
( = columns). The number, types and names of fields are fixed and can
be
changed only by means of a special procedure (called "modifying
structure"),
whereas the number of records is optional and can be easily increased
or
decreased by the user. The fixed structure of the database files allows
for a very quick access to all records even in huge databases.
Fields in a database file can belong to several
types, serving different purposes. Standard dBase files
have
five basic field types:
- Character fields
- For input of all kinds of
character information.
- Numeric fields
- For numbers only.
- Date fields
- For dates only.
- Logical fields
- For binary logical input (these fields may only
contain the information "Yes"/"No" or "True/False")
- Memo fields
- For input of character (memo) information.
While the first four field types have fixed field
length (a maximum of 255 symbols for character fields, 15 symbols for
numeric
fields; always 1 symbol for logical fields and 6 symbols for date
fields),
memo fields have no field boundary. Still I do not recommend to use
memo
fields (however convenient they seem) for the following reason.
Memo fields in standard dBase are, in fact, not
fields in the strict sense of the word. The database itself contains
only
numeric pointers to the field information contained in a separate
file
(with a standard extension .dbt). These numeric pointers themselves
occupy
special fields (10 bytes long for every memo field) within the
.dbf file.
Once you input anything (even 1 symbol) into a memo field within a
certain
record, a standard block of 512 bytes is added to the
.dbt file - and most
of these 512 bytes remain unused. On the other hand, if you edit an
already
occupied memo field and cross the 512-byte boundary, the whole content
of the field is overwritten in two 512-byte blocks which are then added
to the end of the .dbt file - while the old 512- byte block stays in
its
original place (although it is not being used any more). All this
results
in the fact that .dbt files may grow even
longer than .dbf files.
Star4Win supports all the original dBase field
types,
which means that you can safely view and edit original dBase files
while
working with Star4Win. It has, however, its own specific features:
- Character fields are no longer restricted in length
(the maximum field length is 65535 symbols).
- The number of possible fields is increased (from
a dBase III+ maximum in 127 fields to 2046 fields).
- Star4Win also introduces a new type of fields: fields
with variable length. They can be effectively used for any character
information and usually occupy much less space than standard character
fields and memo fields (which are still supported for compatibility).
Variable length fields are in many respects similar
to memo fields: each variable ("V") field occupies 6 bytes within a
database
file, and their contents are actually stored in a separate file with
the extension .var. However, each entry within a
V-field occupies exactly the space it needs.
You should remember several things concerning the
new field type:
a) Special Star4Win files (wordlists etc.) are
created
without V-fields. Any character (or memo) field, however, can be
easily
transformed to a V-field by using the File
structure option of the File menu.
b) You can create new files (using the
Create a database menu option) already with
V-fields, or else modify the structure of already existing files.
c) All operations that were supported for character
("C") and memo ("M") fields, are also supported for V- fields.
d) In Star4Win, when you edit your database files,
contents of each field (whether it is a C-field, M-field or Vfield)
immediately
appear on the screen. However, there may be cases when long M-fields or
V-fields do not fit into one screen. In such cases you can press
Ctrl T to enter the full-screen editing mode, and
the content of the field will
be edited just like a text file with a text editor. If you wish to save
the field content as it is (with margins, line breaks and indents),
please
enter the character (by pressing Ctrl
and then [) in the field's
beginning.
e) The .var files (containing
the variable length fields) also have a tendency to grow unnecessarily,
although not at all as rapidly as the .dbt files
with memo fields. This happens when you make
a new input within an already occupied record, overwriting its
previous
content and exceeding it in length. In this case the new field content
is written to the end of file, while the old record stays in its
original
place. You may shrink your files periodically, choosing the option
Pack in the Assist menu.
This command first does the checking of the variable
fields fragmentation: if it is encountered, you are asked whether you
wish to pack your file or not. Only afterwards the usual routine of
packing
deleted records (if any) is performed.
Periodical PACKing of your files is also
recommended,
because some operations (e.g., searching for string values using the
F3 key) may be hindered by the file's fragmentation.
- Starting with version 1.0.7 the database system of
StarLing / Star4Win has been enhanced by field aliases. A field alias
is a field description that can be optionally used instead of the real
field name in database headers. Unlike field names, field aliases are
not restricted in length, can consist of several words, contain spaces
and non-Roman (e.g. Cyrillic) letters. You can change field aliases
while modifying structure or while changing any field name
(Change field name... option of the
Field menu).
A single field may have multiple aliases: in this case
they should be
preceded by slash + number + semicolon (e.g.
\1:Fieldname1\2:Fieldname2). All aliases having the same number are
united within an alias set, and it is possible to assign any of these
sets to your database file. Note that if the alias
set 0 is chosen, only original field names will be displayed.
Field aliases, as well as some other information, are
stored in special text files with the extension
.inf (officially also introduced in
version 1.0.7). These files are optional - i.e., the
.dbf/.var files will
still be editable without .inf files, but many useful parameters can be
stored in this way. The parameters that .inf files now support are:
- a) Links to related databases. E.g., in the database
\data\alt\turcet containing the field PROTO the line
PROTO = \data\alt\altet
means that the field PROTO relates turcet.dbf to
altet.dbf.
In many cases (for standard
lexicostatistical files) there exist automatic relations to lower level
and upper level files; note that the settings within INF files override
automatic relations.
- b) field aliases and alias sets (see below): the syntax is
FIELD_ALIAS[field name] = alias;
ALIASSET = 1 (2, 3...n)
- c) default indexes (see below): the syntax is INDEX = index
file name
- d) list of fields to display and
order of fields. Here the syntax is: FIELD_LIST = field
range
- e) list (of unlimited length) of databases that can be
linked to any segment of text surrounded by the delimiters \X0....\x,
\X1....\x etc.
Every database name should be located on a new
line with the syntax LOOKUP[1] = database file) etc. Links of this
type differ from global links specified in
config.str in that the list
of linked databases may be different for any individual database, thus
allowing for more flexibility. At this time for such links you cannot
specify default reference fields; however, it is possible to directly
specify record numbers in linked databases, see below on links.
Note: \X0....\x refers to the current database.
- f) file description - a text of unlimited length that may
contain any information concerning the current database. There can be
any number of file descriptions, corresponding to the number of
alias sets available for the file. The descriptions should be started
by the line DBINFO START number and ended by the line
DBINFO END.
You see that .inf files have become a rather
important part of the database system - if you wish to skip the
necessity of readjusting the list of linked databases, displayed fields
and their order, as well as the field aliases every time you open the
database you are working it. So if you transfer a database to a
different directory, drive or computer, do not forget to copy the .inf
file and place it in the same folder.
All the parameters within the .inf
file can be viewed or edited by the Star32 text editor, or in
fact by any text editor program. However, for user convenience there
are now several new options in the File menu
specially suited for this purpose. Those are:
- File info: general technical information
about the current database (this option was there before but was
located in the Assist menu).
- File configuration: A menu
dialog similar to the general configuration, but allowing to edit
information pertaining to the current file. So far it contains two
sub-options:
- INF file content: here you can view and edit
the .inf file.
For user convenience the options of editing the
.inf file as text and editing file decriptions are
also located in the general File menu, as
INF file text edit and
File description,
with the keyboard shortcuts Alt F2 and
Alt F1 respectively.
- Lookup databases: here you can add any number
of lookup databases for hyperlinks within your file.