[net.sources] a small dbms - part 1

oz@yetti.UUCP (Ozan Yigit) (08/26/85)

Following is a small database management system, originally written
under a PDT-11. Is was meant to be relational, but author could not
quite finish it up. It runs under IBM-PC. I also use it in under my
PRO/VENIX for my record collection and number of other purposes. It
seems to work fine for not-so-critical database needs. I am posting
it due to some recent queries. This version came off an 84 DECUS
tape.

have fun.	Oz

----------- SNIP SNIP SNIP ----------------------------------------
#!/bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #!/bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create the files:
#	readme.
#	sdb.hlp
#	sdb.mem
#	aaareadme.txt
#	sdbgen.bat
#	sdbgrep.bat
#	sdblump.bat
#	sdbxc.bat
#	sdbgen.arf
# This archive created: Mon Aug 26 15:38:43 1985
export PATH; PATH=/bin:$PATH
echo shar: extracting "'readme.'" '(373 characters)'
if test -f 'readme.'
then
	echo shar: over-writing existing file "'readme.'"
fi
sed 's/^X//' << \SHAR_EOF > 'readme.'
X
X
X     SDB was obtained from the CNODE bulletin board at 617-470-2548
X     in Amherst, Mass.  It was converted to the IBM PC using the Lattice
X     C Compiler.
X
X     To try some other compiler or system, see comments and settings in
X     the front of SDBIO.H and things in PCJUNK.C.
X
X     David N. Smith
X     44 Ole Musket Lane
X     Danbury, CT 06810
X
X     24 January 1984
SHAR_EOF
if test 373 -ne "`wc -c 'readme.'`"
then
	echo shar: error transmitting "'readme.'" '(should have been 373 characters)'
fi
echo shar: extracting "'sdb.hlp'" '(1319 characters)'
if test -f 'sdb.hlp'
then
	echo shar: over-writing existing file "'sdb.hlp'"
fi
sed 's/^X//' << \SHAR_EOF > 'sdb.hlp'
Xcreate <rname> ( <adefs> ) <size>       - create a new relation
Xinsert <rname>                          - insert tuples into a relation
Xdelete <rse> ;                          - delete tuples from relations
Xupdate <anames> from <rse> ;            - update tuples within a relation
Xprint [<u>] <anames> from <rse> [<i>] ; - print tuples
Xsort <rname> by <snames> ;              - sort a relation file
Ximport <fname> into <rname>             - import tuples from a file
Xexport <rname> [<i>] ;                  - export tuples to a file
Xextract <rname> [<i>] ;                 - extract definition to a file
Xcompress <rname>                        - compress a relation file
Xdefine <mname>                          - define a macro
Xexit                                    - exit SDB
X
X<u>             ::=     using <fname>
X<i>             ::=     into <fname>
X<adefs>         ::=     <a list of attribute definitions>
X<rse>           ::=     <rnames> [where <boolean-expression>]
X<rname>         ::=     <a relation name>
X<rnames>        ::=     <a comma separated list of <rname>s>
X<aname>         ::=     [<rname> .] <an attribute name>
X<anames>        ::=     * | <a comma separated list of <aname>s>
X<sname>         ::=     <aname> { ascending | descending }
X<snames>        ::=     <a comma separated list of <sname>s>
SHAR_EOF
if test 1319 -ne "`wc -c 'sdb.hlp'`"
then
	echo shar: error transmitting "'sdb.hlp'" '(should have been 1319 characters)'
fi
echo shar: extracting "'sdb.mem'" '(25337 characters)'
if test -f 'sdb.mem'
then
	echo shar: over-writing existing file "'sdb.mem'"
fi
sed 's/^X//' << \SHAR_EOF > 'sdb.mem'
X
X
X
X
X                       SDB - a Simple Database System
X
X                              by David Betz
X                            114 Davenport Ave.
X                           Manchester, NH 03103
X                              (603) 625-4691
X
X                        Converted to the IBM/PC by
X                              David N. Smith
X                            44 Ole Musket Lane
X                            Danbury, CT  06810
X                              (203) 748-5934
X
X
X        1.0  INTRODUCTION
X
X        SDB is a simple database manager for small systems.  It  was
X        developed  to  provide  a relatively low overhead system for
X        storing data  on  machines  with  limited  disk  and  memory
X        resources.   The current version runs on a PDT-11/150 with 2
X        RX01 floppy disk drives and 60K bytes of  memory  under  the
X        RT-11 operating system.  (it also runs on the VAX under VMS)
X
X        SDB was originally intended  to  be  a  relational  database
X        system, so many of the terms used in describing it are taken
X        from the relational database literature.  Within the context
X        of SDB the user can safely make the following associations:
X
X             1.  RELATION can be taken to mean FILE
X
X             2.  TUPLE can be taken to mean RECORD
X
X             3.  ATTRIBUTE can be taken to mean FIELD
X
X        It should be noted that SDB is not a  relationally  complete
X        system.   It  provides  the relational operations of SELECT,
X        PROJECT, and JOIN, but does not provide the  set  operations
X        of  UNION,  INTERSECTION,  or  DIFFERENCE  as  well  as some
X        others.
X
X
X        2.0  RELATION FILE FORMATS
X
X        SDB maintains a separate file for  each  relation  that  the
X        user  creates.  This file contains a header block containing
X        the definition of the relation including the names and types
X        of  all  of the relation's attributes.  The remainder of the
X        file contains fixed length records each containing one tuple
X        from the relation.
X
X        Tuples can be of three types:
X
X             1.  active - tuples that contain actual active data
X
X             2.  deleted - tuples that have been deleted
X
X             3.  unused - tuples that haven't been used yet
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X        SDB - a Simple Database System                        Page 2
X
X
X        Initially, all tuples are  unused.   When  a  new  tuple  is
X        stored  into  a  relation,  the  first unused tuple is found
X        (they are all contiguous at the end of the  relation  file).
X        The new tuple is stored as an active tuple.
X
X        When a tuple is deleted, it is marked as  such.   The  space
X        previously  allocated  to  the  deleted tuple is left unused
X        until the relation is compressed.
X
X        It is possible that when attempting to store a new tuple, no
X        unused  tuple can be found even though the relation contains
X        fewer than the maximum active  tuples.   This  happens  when
X        tuples  have  been  deleted since the time the relation file
X        was last compressed.
X
X        The compress function  allows  all  of  the  space  lost  by
X        deleting tuples to be regained.  It does this by copying all
X        of the active tuples as far backward in the file as possible
X        leaving  all  of  the  available space toward the end of the
X        file.
X
X
X
X        3.0  SELECTION EXPRESSIONS
X
X        A selection expression specifies a set of tuples over  which
X        some  SDB  operation  is  to  be executed.  The syntax for a
X        selection expression is:
X
X        <rse>           ::= <rnames> [ where <boolean> ]
X        <rnames>        ::= <rname> [ , <rname> ] ...
X        <rname>         ::= <relation-name> [ <alias> ]
X
X        When a single relation name  is  specified  in  a  selection
X        expression,  each  tuple  within  that  relation  becomes  a
X        candidate for selection.
X
X        When more than one relation name is  specified,  the  tuples
X        are  formed  by  taking  the  cross product of all specified
X        relations.  If a relation is to be crossed with  itself,  an
X        alias must be given to one or both of the occurances of that
X        relation name in the selection expression.  This allows  SDB
X        to determine which relation occurance is being refered to in
X        the boolean part of the selection expression.
X
X        After the set of candidate tuples is determined, the boolean
X        expression  is evaluated for each candidate.  The candidates
X        for which the boolean expression evaluates  to  TRUE  become
X        the selected tuples.
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X        SDB - a Simple Database System                        Page 3
X
X
X        4.0  INITIALIZATION FILE AND COMMAND FILES
X
X        When SDB is first run,  it  attempts  to  read  and  process
X        commands  from  a  file  named "SDB.INI".  This file usually
X        contains macro definitions, but can contain  any  valid  SDB
X        command.   In  addition,  it  is possible to process command
X        files from within SDB.   This  is  done  by  typing  an  '@'
X        followed by the command file name after the SDB prompt.
X
X
X
X        5.0  FILE NAMES
X
X        Whenever a file name is allowed in the syntax for a command,
X        it  is  possible  to  use  either  an identifier or a quoted
X        string.  An identifier is interpreted as the file name and a
X        string  is  interpreted  as  a full file specification.  The
X        string form allows for the  specification  of  an  alternate
X        device or extension.
X
X
X
X        6.0  FORM DEFINITION FILES
X
X        A form  definition  file  contains  a  template  into  which
X        attribute  values  are substituted during a print operation.
X        There are two types of information that can be included in a
X        form definition:
X
X             1.  Literal text
X
X             2.  Attribute references
X
X        Attribute references are indicated by placing  the  name  of
X        the  attribute  being  referenced  between  a  pair of angle
X        brackets.  Literal text is anything that is not enclosed  in
X        angle brackets.
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X        SDB - a Simple Database System                        Page 4
X
X
X        Example:
X        ________
X
X        print using test amount,category from checks;
X
X        Where test.frm contains:
X
X        Amount: <amount>
X        Category: <category>
X
X
X        7.0  ALIASES FOR RELATIONS AND ATTRIBUTES
X
X        When a relation or attribute name is specified  in  a  print
X        statement,  it  is possible to provide an alternate name for
X        that relation or attribute.  This is useful  for  relations,
X        when  it  is  necessary to join a relation to itself.  It is
X        useful for attributes when it is  desired  that  the  column
X        headers  in  a  table be different from the actual attribute
X        names.  Also, alternate  attribute  names  can  be  used  in
X        references  to that attribute in the where clause as well as
X        in a  form  definition  file.   The  syntax  for  specifying
X        aliases is:
X
X            <name> <alias>
X
X
X        Example:
X        ________
X
X        print using test amount a,category c from checks;
X
X        Where test.frm contains:
X
X        Amount: <a>
X        Category: <c>
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X        SDB - a Simple Database System                        Page 5
X
X
X        8.0  BOOLEAN EXPRESSIONS
X
X        The syntax for boolean expressions:
X
X        <expr>          ::= <land> [ '|' <land> ]
X        <land>          ::= <relat> [ '&' <relat> ]
X        <relat>         ::= <primary> [ <relop> <primary> ]
X        <primary>       ::= <term> [ <addop> <term> ]
X        <term>          ::= <unary> [ <mulop> <unary> ]
X        <unary>         ::= <factor> | <unop> <unary>
X        <factor>        ::= <operand> | '(' <expr> ')'
X        <operand>       ::= <number> | <string> | <attribute>
X        <attribute>     ::= [ <rname> . ] <aname>
X        <relop>         ::= '=' | '<>' | '<' | '>' | '<=' | '>='
X        <addop>         ::= '+' | '-'
X        <mulop>         ::= '*' | '/'
X        <unop>          ::= '+' | '-' | '~'
X
X
X        Operators:
X
X             1.  '=' - equal
X
X             2.  '<>' - not equal
X
X             3.  '<' - less than
X
X             4.  '>' - greater than
X
X             5.  '<=' - less than or equal
X
X             6.  '>=' - greater than or equal
X
X             7.  '+' - addition or unary plus (not implemented)
X
X             8.  '-' - subraction or unary minus (not implemented)
X
X             9.  '*' - multiplication (not implemented)
X
X            10.  '/' - division (not implemented)
X
X            11.  '&' - logical and
X
X            12.  '|' - logical or
X
X            13.  '~' - logical not
X
X        Operands:
X
X             1.  number - a string of digits containing at most  one
X                 decimal point
X
X             2.  string - a string of characters enclosed in  double
X                 quotes
X
X
X
X
X
X
X
X
X
X        SDB - a Simple Database System                        Page 6
X
X
X             3.  attribute - an attribute name optionally  qualified
X                 by a relation name
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X        SDB - a Simple Database System                        Page 7
X
X
X        9.0  INTERACTIVE COMMAND DESCRIPTIONS
X
X        Function:
X        _________
X
X        Create a relation file
X
X
X        Format:
X        _______
X
X        create <rname> ( <alist> ) <size>
X
X
X        Rules:
X        ______
X
X             1.  <rname> is the name of the relation file
X
X             2.  <alist> is a list of attribute definitions  of  the
X                 form:
X
X                   <aname> { char | num } <size>
X
X                 where:
X
X                 1.  <aname> is the name of the attribute
X
X                 2.  the type of the attribute is either  "char"  or
X                     "num"
X
X                 3.  <size> is the number of bytes allocated to  the
X                     attribute value
X
X
X             3.  <size> is the maximum number of tuples the file  is
X                 to hold
X
X
X
X        Example:
X        ________
X
X        create checks (
X            number      num     4
X            date        char    8
X            payee       char    20
X            amount      num     8
X            category    char    5
X        ) 200
X
X        This command creates a relation file named "checks.sdb" with
X        attributes   "number",   "date",   "payee",   "amount",  and
X        "category" and space to store 200 tuples.
X
X
X
X
X
X
X
X
X
X        SDB - a Simple Database System                        Page 8
X
X
X        Function:
X        _________
X
X        Insert tuples into a relation
X
X
X        Format:
X        _______
X
X        insert <rname>
X
X
X        Rules:
X        ______
X
X             1.  <rname> is the name of a relation
X
X             2.  the user will be prompted for  the  values  of  the
X                 attributes for the tuple to be inserted
X
X             3.  a  null  response  to  an  attribute  prompt   will
X                 terminate tuple entry
X
X             4.  if a null value is desired, a single space  can  be
X                 entered
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X        SDB - a Simple Database System                        Page 9
X
X
X        Function:
X        _________
X
X        Delete tuples from a set of relations
X
X
X        Format:
X        _______
X
X        delete <rse> ;
X
X
X        Rules:
X        ______
X
X             1.  <rse> is a tuple selection expression
X
X             2.  selected tuples are deleted
X
X
X
X        Example:
X        ________
X
X        delete checks where category = "junk";
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X        SDB - a Simple Database System                       Page 10
X
X
X
X        Function:
X        _________
X
X        Update the values of selected attributes in selected tuples
X
X
X        Format:
X        _______
X
X        update { <attrs> | * } from <rse> ;
X
X
X        Rules:
X        ______
X
X             1.  <attrs> is a list of attribute names to be updated
X
X             2.  * means all attributes
X
X             3.  <rse> is a tuple selection expression
X
X             4.  for each  set  of  selected  tuples,  the  user  is
X                 prompted for new values for the selected attributes
X
X             5.  a null response to an attribute prompt will  retain
X                 the previous attribute value
X
X             6.  if a null value is desired, a single space  can  be
X                 entered
X
X
X
X        Example:
X        ________
X
X        update amount,category from checks where number > 10;
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X        SDB - a Simple Database System                       Page 11
X
X
X        Function:
X        _________
X
X        Print a table of values of selected attributes
X
X
X        Format:
X        _______
X
X        print [ using <fname> ] { <attrs> | * } from  <rse>  [  into
X        <fname> ] ;
X
X
X        Rules:
X        ______
X
X             1.  using  <fname>  indicates  output  using   a   form
X                 definition file (.FRM)
X
X             2.  <attrs> is a list of attribute names to be printed
X
X             3.  * means all attributes
X
X             4.  <rse> is a tuple selection expression
X
X             5.  <fname> is the name of an file to which  the  table
X                 will be output (.TXT)
X
X             6.  if the output file name is omitted,  output  is  to
X                 the terminal
X
X             7.  for each set of selected tuples, a table  entry  is
X                 printed containing the selected attributes
X
X
X
X        Example:
X        ________
X
X        print payee,amount from checks where category = "junk";
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X        SDB - a Simple Database System                       Page 12
X
X
X        Function:
X        _________
X
X        Import tuples from a file into a relation
X
X
X        Format:
X        _______
X
X        import <fname> into <rname>
X
X
X        Rules:
X        ______
X
X             1.  <fname> is the name of the input file (.DAT)
X
X             2.  the input file contains the  values  of  the  tuple
X                 attributes with each on a separate line
X
X             3.  <rname> is the name of a relation
X
X             4.  tuples are appended to the named relation
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X        SDB - a Simple Database System                       Page 13
X
X
X        Function:
X        _________
X
X        Export tuples from a relation into a file
X
X
X        Format:
X        _______
X
X        export <rname> [ into <fname> ] ;
X
X
X        Rules:
X        ______
X
X             1.  <rname> is the name of a relation
X
X             2.  <fname> is the name of the output file (.DAT)
X
X             3.  if the output file name is omitted,  output  is  to
X                 the terminal
X
X             4.  tuples are written to  the  output  file  with  one
X                 attribute value per line
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X        SDB - a Simple Database System                       Page 14
X
X
X        Function:
X        _________
X
X        Extract the definition of a relation into a file
X
X
X        Format:
X        _______
X
X        extract <rname> [ into <fname> ] ;
X
X
X        Rules:
X        ______
X
X             1.  <rname> is the name of a relation
X
X             2.  <fname> is the name of the output file (.DEF)
X
X             3.  if the output file name is omitted,  output  is  to
X                 the terminal
X
X             4.  the definition of the relation is  written  to  the
X                 output file
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X        SDB - a Simple Database System                       Page 15
X
X
X        Function:
X        _________
X
X        Compress a relation file
X
X
X        Format:
X        _______
X
X        compress <rname>
X
X
X        Rules:
X        ______
X
X             1.  <rname> is the name of a relation file
X
X             2.  tuples are copied toward the front of the  relation
X                 file  such  that  any  space  freed  by  previously
X                 deleted tuples becomes adjacent to the  free  space
X                 at the end of the file, thus becoming available for
X                 use in inserting new tuples
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X        SDB - a Simple Database System                       Page 16
X
X
X        Function:
X        _________
X
X        Sort a relation file
X
X
X        Format:
X        _______
X
X        sort <rname> by <sname> { , <sname } ...  ;
X
X
X        Rules:
X        ______
X
X             1.  <rname> is the name of a relation file
X
X             2.  <sname> is the name of  an  attribute  to  sort  on
X                 followed optionally by "ascending" or "descending"
X
X             3.  if a sort order  is  not  specified,  ascending  is
X                 assumed
X
X             4.  tuples within the  relation  are  sorted  in  place
X                 using the attributes indicated
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X        SDB - a Simple Database System                       Page 17
X
X
X        Function:
X        _________
X
X        Define a macro
X
X
X        Format:
X        _______
X
X        define <mname>
X
X
X        Rules:
X        ______
X
X             1.  <mname> is the name of the macro being defined
X
X             2.  if a macro with the specified name already  exists,
X                 it is replaced
X
X             3.  after entering the define command, definition  mode
X                 is entered
X
X             4.  definition  mode  is  indicated   by   the   prompt
X                 "SDB-DEF>"
X
X             5.  all lines typed in definition mode are added to the
X                 macro definition
X
X             6.  a blank line terminates definition mode
X
X             7.  a macro can be deleted by entering a blank line  as
X                 the only line in the definition
X
X             8.  after a macro is defined, every  occurance  of  the
X                 macro name is replaced by the macro definition
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X        SDB - a Simple Database System                       Page 18
X
X
X        Function:
X        _________
X
X        Show a macro definition
X
X
X        Format:
X        _______
X
X        show <mname>
X
X
X        Rules:
X        ______
X
X             1.  <mname> is the name of a macro whose definition  is
X                 to be shown
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X        SDB - a Simple Database System                       Page 19
X
X
X        Function:
X        _________
X
X        Print a short help message
X
X
X
X        Format:
X        _______
X
X        help
X
X
X        Rules:
X        ______
X
X             1.  (none)
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X        SDB - a Simple Database System                       Page 20
X
X
X        Function:
X        _________
X
X        Exit from SDB
X
X
X        Format:
X        _______
X
X        exit
X
X
X        Rules:
X        ______
X
X             1.  (none)
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X        SDB - a Simple Database System                       Page 21
X
X
X        10.0  PROGRAM INTERFACE
X
X        SDB provides a callable program interface to allow  programs
X        written  in  DECUS-C  to access relation files.  In order to
X        use the call interface, the users program should  be  linked
X        with  the SDBUSR.OBJ object library.  Also, additional stack
X        space should be allocated at link  time  using  the  /BOTTOM
X        qualifier  on  the link command.  /BOTTOM:3000 seems to work
X        well, but it is probably possible to get away with less.
X
X        Example:
X        ________
X
X        #include <stdio.h>
X        #include "sdb.h"
X
X        main()
X        {
X            DB_SEL *sptr;
X            char payee[100],amount[100];
X
X            /* setup retrieval */
X            if ((sptr = db_retrieve("checks where amount > 25.00")) == NULL) {
X                printf("*** error: %s ***\n",db_ertxt(dbv_errcode));
X                exit();
X            }
X
X            /* bind user variables to attributes */
X            db_bind(sptr,"checks","payee",payee);
X            db_bind(sptr,"checks","amount",amount);
X
X            /* loop through selection */
X            while (db_fetch(sptr))
X                printf("%s\t%s\n",payee,amount);
X
X            /* finish selection */
X            db_done(sptr);
X        }
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X        SDB - a Simple Database System                       Page 22
X
X
X        Function:
X        _________
X
X        Setup a tuple retrieval context
X
X
X        Format:
X        _______
X
X        dbptr = db_retrieve(sexpr [ ,arg ]...)
X
X
X        Rules:
X        ______
X
X             1.  sexpr is a pointer to a string containing an rse
X
X             2.  arg is a "printf" argument
X
X             3.  dbptr is a database context pointer
X
X             4.  db_retrieve returns NULL on errors
X
X             5.  on errors, the error code is in dbv_errcode
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X        SDB - a Simple Database System                       Page 23
X
X
X        Function:
X        _________
X
X        Fetch the next set of tuples from a retrieval context
X
X
X        Format:
X        _______
X
X        db_fetch(dbptr)
X
X
X        Rules:
X        ______
X
X             1.  dbptr is a database context pointer
X
X             2.  updates the values of all bound user variables
X
X             3.  db_fetch returns FALSE if no more tuples  match  or
X                 if an error occurs
X
X             4.  on errors, the error code is in dbv_errcode
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X        SDB - a Simple Database System                       Page 24
X
X
X        Function:
X        _________
X
X        Update the current tuple within a retrieval context
X
X
X        Format:
X        _______
X
X        db_update(dbptr)
X
X
X        Rules:
X        ______
X
X             1.  dbptr is a database context pointer
X
X             2.  db_update returns FALSE if an error occurs
X
X             3.  on errors, the error code is in dbv_errcode
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X        SDB - a Simple Database System                       Page 25
X
X
X        Function:
X        _________
X
X        Store a new tuple within a retrieval context
X
X
X        Format:
X        _______
X
X        db_store(dbptr)
X
X
X        Rules:
X        ______
X
X             1.  dbptr is a database context pointer
X
X             2.  db_store returns FALSE if an error occurs
X
X             3.  on errors, the error code is in dbv_errcode
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X        SDB - a Simple Database System                       Page 26
X
X
X        Function:
X        _________
X
X        Bind a user variable to  the  value  of  a  tuple  attribute
X        within a retrieval context
X
X
X        Format:
X        _______
X
X        db_bind(dbptr,rname,aname,value)
X
X
X        Rules:
X        ______
X
X             1.  dbptr is a database context pointer
X
X             2.  rname is a pointer to the relation name
X
X             3.  aname is a pointer to the attribute name
X
X             4.  value is a pointer to a character array to  receive
X                 the attribute value
X
X             5.  db_bind returns FALSE if an error occurs
X
X             6.  on errors, the error code is in dbv_errcode
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X        SDB - a Simple Database System                       Page 27
X
X
X        Function:
X        _________
X
X        Get the value  of  a  tuple  attribute  within  a  retrieval
X        context
X
X
X        Format:
X        _______
X
X        db_get(dbptr,rname,aname,value)
X
X
X        Rules:
X        ______
X
X             1.  dbptr is a database context pointer
X
X             2.  rname is a pointer to the relation name
X
X             3.  aname is a pointer to the attribute name
X
X             4.  value is a pointer to a character array to  receive
X                 the attribute value
X
X             5.  db_get returns FALSE if an error occurs
X
X             6.  on errors, the error code is in dbv_errcode
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X        SDB - a Simple Database System                       Page 28
X
X
X        Function:
X        _________
X
X        Put the value  of  a  tuple  attribute  within  a  retrieval
X        context
X
X
X        Format:
X        _______
X
X        db_put(dbptr,rname,aname,value)
X
X
X        Rules:
X        ______
X
X             1.  dbptr is a database context pointer
X
X             2.  rname is a pointer to the relation name
X
X             3.  aname is a pointer to the attribute name
X
X             4.  value is a pointer to the new value
X
X             5.  db_put returns FALSE if an error occurs
X
X             6.  on errors, the error code is in dbv_errcode
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X        SDB - a Simple Database System                       Page 29
X
X
X        Function:
X        _________
X
X        Discontinue usage of a retrieval context
X
X
X
X        Format:
X        _______
X
X        db_done(dbptr)
X
X
X        Rules:
X        ______
X
X             1.  dbptr is a database context pointer
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X        SDB - a Simple Database System                       Page 30
X
X
X        Function:
X        _________
X
X        Translate an error code to an error message text
X
X
X        Format:
X        _______
X
X        db_ertxt(errcode)
X
X
X        Rules:
X        ______
X
X             1.  errcode is an SDB error code
X
X             2.  db_ertxt returns a pointer  to  the  error  message
X                 text
X
X
SHAR_EOF
if test 25337 -ne "`wc -c 'sdb.mem'`"
then
	echo shar: error transmitting "'sdb.mem'" '(should have been 25337 characters)'
fi
echo shar: extracting "'aaareadme.txt'" '(234 characters)'
if test -f 'aaareadme.txt'
then
	echo shar: over-writing existing file "'aaareadme.txt'"
fi
sed 's/^X//' << \SHAR_EOF > 'aaareadme.txt'
XThis area contains a simple DBMS system in C. Originally for VAX, it
Xhas been somewhat modified for IBMPC but since full sources are
Xhere, it shouldn't be too hard to change back if anyone needs it.
X        From a PC-sig disk (#147).
SHAR_EOF
if test 234 -ne "`wc -c 'aaareadme.txt'`"
then
	echo shar: error transmitting "'aaareadme.txt'" '(should have been 234 characters)'
fi
echo shar: extracting "'sdbgen.bat'" '(31 characters)'
if test -f 'sdbgen.bat'
then
	echo shar: over-writing existing file "'sdbgen.bat'"
fi
sed 's/^X//' << \SHAR_EOF > 'sdbgen.bat'
Xerase sdb.exe
Xlink @sdbgen.arf
SHAR_EOF
if test 31 -ne "`wc -c 'sdbgen.bat'`"
then
	echo shar: error transmitting "'sdbgen.bat'" '(should have been 31 characters)'
fi
echo shar: extracting "'sdbgrep.bat'" '(123 characters)'
if test -f 'sdbgrep.bat'
then
	echo shar: over-writing existing file "'sdbgrep.bat'"
fi
sed 's/^X//' << \SHAR_EOF > 'sdbgrep.bat'
Xgrep %1 %2 %3 %4 %5 %6 %7 %8 pcjunk.c sdb.c cmd.c com.c err.c cre.c iex.c int.c io.c mth.c scn.c sel.c srt.c tbl.c sdbio.h
SHAR_EOF
if test 123 -ne "`wc -c 'sdbgrep.bat'`"
then
	echo shar: error transmitting "'sdbgrep.bat'" '(should have been 123 characters)'
fi
echo shar: extracting "'sdblump.bat'" '(212 characters)'
if test -f 'sdblump.bat'
then
	echo shar: over-writing existing file "'sdblump.bat'"
fi
sed 's/^X//' << \SHAR_EOF > 'sdblump.bat'
Xerase s
Xerase sdb1.lmp
Xerase sdb2.lmp
Xlump s sdb.c cmd.c com.c err.c cre.c iex.c int.c io.c
Xrename s sdb1.lmp
Xlump s mth.c scn.c sel.c srt.c tbl.c pcjunk.c sdbio.h sdb.hlp sdbgen.arf sdbgen.bat
Xrename s sdb2.lmp
SHAR_EOF
if test 212 -ne "`wc -c 'sdblump.bat'`"
then
	echo shar: error transmitting "'sdblump.bat'" '(should have been 212 characters)'
fi
echo shar: extracting "'sdbxc.bat'" '(101 characters)'
if test -f 'sdbxc.bat'
then
	echo shar: over-writing existing file "'sdbxc.bat'"
fi
sed 's/^X//' << \SHAR_EOF > 'sdbxc.bat'
Xxc sdb.c cmd.c com.c cre.c err.c iex.c int.c io.c mth.c scn.c sel.c srt.c tbl.c pcjunk.c io.h -o x.x
SHAR_EOF
if test 101 -ne "`wc -c 'sdbxc.bat'`"
then
	echo shar: error transmitting "'sdbxc.bat'" '(should have been 101 characters)'
fi
echo shar: extracting "'sdbgen.arf'" '(89 characters)'
if test -f 'sdbgen.arf'
then
	echo shar: over-writing existing file "'sdbgen.arf'"
fi
sed 's/^X//' << \SHAR_EOF > 'sdbgen.arf'
Xc sdb cre err iex int cmd com mth scn sel srt tbl io pcjunk
Xsdb
Xsdb.map /map
X\lattice\lc
SHAR_EOF
if test 89 -ne "`wc -c 'sdbgen.arf'`"
then
	echo shar: error transmitting "'sdbgen.arf'" '(should have been 89 characters)'
fi
#	End of shell archive
exit 0
-- 
Usenet: [decvax|allegra|linus|ihnp4]!utzoo!yetti!oz
Bitnet: oz@[yusol|yuyetti]
	You see things; and you say "WHY?"
	But I dream things that never were;
	and say "WHY NOT?"
			G. Bernard Shaw (Back to Methuselah)