Rdb: Ruby-Nachbau der MWC /rdb-Werkzeuge

This commit is contained in:
wkh
2026-10-11 20:33:17 +02:00
commit a9990169e9
308 changed files with 16738 additions and 0 deletions
+360
View File
@@ -0,0 +1,360 @@
.TH update.rdb "" "" "/rdb Command"
.PC "Display and edit records in any sized file"
\fBupdate.rdb [-l -m[bhirs] -v] \fItableorlist \fB[\fIkeycolumn ... \fB]\fR
.PP
.II "table^update"
.II "record^update"
.II "update table"
The command
.B update.rdb
lets you find a record in
.IR tableorlist ,
display it, and update it.
.PP
.B update.rdb
can find a record in any of several different ways:
by moving up and down in the file,
by record number,
by matching a string pattern in a record,
and a fast-access method search.
.PP
.B update.rdb
lets you use a text editor to edit the record you find.
To lock out other users who might be looking at your file,
.B update.rdb
uses the
.B /rdb
command
.B lock
to lock the record being edited.
When you finish editing,
.B update.rdb
replaces the edited record back into
.IR tableorlist .
.PP
If the new record is smaller than the old record,
it adds space characters to the end of the last column to pad out the record.
If the new record is larger than
the old record, it trims
trailing and leading spaces from the columns.
If
.B update.rdb
cannot find enough blank spaces to trim,
it does not replace the record,
but appends it to the end of the table and updates the
fast-access method indexes, if any.
If this happens, you have several options:
You can reedit the record.
You can append the record to the end of the file using
.B enter
and delete the current record.
You can also pad each record with extra spaces so that there
will be room when you do updates.
To add padding, use the command
.BR pad .
.PP
Because
.B update.rdb
replaces an edited record to where the original was extracted, you
do not have to rebuilt entirely any fast-access indexes that
.I fileorlist
owns.
As long as you don't change the key columns, the fast-access
methods can still find the records.
This can mean a considerable savings in the time needed to update a record.
.PP
Also,
.B update.rdb
can handle any sized file, whereas the text editors
and word processors mostly cannot handle files of more than a few
thousand characters.
.SH Options
.B update.rdb
recognizes the following options:
.IP \fB\-l\fR 0.3i
No lock.
Do not lock the record by blanking out the record in the file while updating.
This is much faster than using record-locking; but it is truly safe if you
are the only person who can update
.IR tableorlist .
If more than one person can access
.I tableorlist
at the same time, do not use this option.
.IP \fB-m\fR
Fast access method.
See the manual page for the
.B /rdb
command
.B search
for a description of these options.
.IP \fB\-v\fR
Verbose.
With this option,
.B update.rdb
prints information about what it is doing during each step of updating
a record.
You can use this information to find the bottlenecks in updating; for
example, you may find that you are not using the best method of
accessing the records you wish to update.
.SH Getting In and Out
To invoke
.B update.rdb
to edit
.IR tableorlist ,
simply type:
.DM
update.rdb tableorlist
.DE
.PP
.B update.rdb
prompt you with a `>'.
.PP
You can exit from
.B update.rdb
by any of three methods:
Type \fB<ctrl-D>\fR, type ``quit'', or simply type `q'
(because
.B update.rdb
looks at only the first character of the one-word commands).
.PP
Finally, the
.I kill
character on your terminal (usually \fB<ctrl-C>\fR)
kills the program, as it does other COHERENT commands.
.SH "Help Menu"
.B update.rdb
has a help menu built into it.
To see it, type
.B help
at the `>' prompt.
You will see the following:
.DM
Command Description | update.rdb [-l -m[bhirs] -l] file
---------------------------------------------------------------
CTRL-d exit, hold down CTRL key and press \fBd\fP
(see quit below)
Return key display next record
number display record number you enter
(number = 1,29,...)
+number move forward the number of records in the file
-number move backwards the number of records in the file
. redisplay the current record
/pattern find next record with pattern
=key find records with key matching what you type
!command execute the unix command while still in update.rdb
!enter file enter new records at end of the file
.sp \n(pDu
(You need only type the first letter of the commands below)
.DE
.DM
delete delete the current record
m[bhirs] [col] set up fast access method for key column
b=binary, h=hash, i=index, r=record, s=sequential
lock lock update.rdb record by blanking (toggle, true)
search key find records with matching key
help help list displayed (this help list)
quit quit (also cntl-d)
update.rdb update current record, allows you to edit, replace
verbose report internal actions (toggle, false)
.DE
.SH "Finding a Record"
There are several ways to find the record you want.
.PP
When
.B update.rdb
comes up, it displays the first record in
.IR tableorlist .
To move to the next record, simply press
.BR <Return> .
You can move forward any number of records with a plus sign and a number,
for example,
.BR +5 ;
and you can move backwards with a minus sign and a number, for example:
.BR \-16 .
You can also select a specific record by typing its number.
Record numbers are displayed with each record.
.SH "Pattern Search"
If you try to go beyond the last record or before the first record,
.B update.rdb
warns you.
.PP
You can also search for a record that has a given string
by typing a slash character followed by string.
For example, to search for pattern ``Ronald'', type:
.BR /Ronald .
.B update.rdb
searches forward starting with the next record, then
wraps around and goes to the first record in the file
and continues till it finds a match or returns to the current record.
.SH "Fast-Access Methods"
.B update.rdb
can use fast-access methods to find a record within
.IR tableorlist .
You can turn on the fast-access methods in either of two ways:
.IP \fB1.\fR 0.3i
Use the appropriate option on the command line.
For example, the command
.DM
update.rdb -mh inventory Description
.DE
.sp \n(pDu
invokes the fast-access method for table
.BR inventory .
.IP \fB2.\fR
Type the appropriate option at
.BR update.rdb 's
prompt.
For example, typing
.DM
mh Description
.DE
.PP
at
.BR update.rdb 's
`>' prompt invokes the fast-access method for column
.BR Description .
.PP
Both ways tell
.B update.rdb
which method to use and which column is the key column.
.PP
Once invoked, you can search with either the
.B =
or
.B s
commands.
For example:
.DM
> =keyvalue
> s keyvalue
.DE
.SH Updating
To update the current record, simply type:
.DM
> update
.DE
.PP
Just the letter
.B u
is sufficient.
.PP
The steps in using
.B update.rdb
are as follows:
.IP \fB1.\fR 0.3i
Invoke
.B update.rdb
with the name of the table or list to be edited.
.IP \fB2.\fR
Find the record you want by entering its row number, a string it contains,
or through a fast-access method.
.IP \fB3.\fR
When the record is found, type
.B u
to update it.
.IP \fB4.\fR
.B update.rdb
copies the record to a file with a header
so that it is a one record table or list.
.IP \fB5.\fR
.B update.rdb
replaces the selected record with a string of blanks of the same length,
hold the record's place within its table, and to lock out other users.
.IP \fB6.\fR
.B update.rdb
then copies the temporary record file to a backup file in case you
damage it.
.IP \fB7.\fR
.B update.rdb
then reads environmental variable
.B EDITOR
and calls the editor it names to let you edit the record you selected.
If
.B EDITOR
is not set in your environment,
it invokes
.B vi
by default.
.IP \fB8.\fR
Use the editor to edit the record.
.IP \fB9.\fR
When you exit your editor,
.B update.rdb
returns the edited the record into its table or list.
It adds or removes trailing spaces to make the record fit into the same
amount of space it previously occupied in its table or list.
If the record doesn't fit into its old space,
.B update.rdb
lets you choose whether to re-edit the record,
or append it to the end of the table or list.
.sp \n(pDu
You can also validate a record before leaving your editor by typing:
.DM
validate file.v < file
.DE
.PP
See the COHERENT Lexicon entries for the editor you are using for
information on how to pass that command to the shell without exiting
from the editor.
The entry for the command
.B validate
in this manual describes how it works.
.SH "Other Useful Commands"
If you need to see the current record again because it has
run off the screen, simply type a period at
.BR update.rdb 's
prompt.
.PP
To execute a COHERENT shell command, type an exclamation point
and the command you wish to execute.
For example, to execute the command
.B ls
from within
.BR update.rdb ,
type
.DM
> !ls
.DE
.PP
This feature also lets you append new records to a table while still within
.BR update.rdb .
To do so, just type:
.DM
> !enter thisfilename
.DE
.PP
When you leave the
.B enter
command, you will be back in
.BR update.rdb .
.PP
You can also index the file you are working with from within
.BR update.rdb .
Just type:
.DM
> !index -mi filename keycolumn
.DE
.PP
This command creates index file \fIfilename\fB.i\fR, which
.B update.rdb
can then use for fast-access searching of file you are updating.
.SH Padding
When you set up a table
that you intend to update, you probably should pad it \(em
that is, add extra space characters to each record.
Then you can add characters to a record and
.B update.rdb
will trim off the space characters to fit it back into the file.
For details,
see the manual page for the command
.BR pad .
.SH Notes
This command is named
.B update.rdb
rather than
.BR update ,
as in other implementations of
.BR /rdb ,
to avoid clashing with the COHERENT command
.BR update ,
which does something very different.