home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / vol_100 / 168_01 / sdb.mem < prev    next >
Text File  |  1985-08-21  |  25KB  |  1,007 lines

  1.  
  2.  
  3.  
  4.  
  5.                        SDB - a Simple Database System
  6.  
  7.                               by David Betz
  8.                             114 Davenport Ave.
  9.                            Manchester, NH 03103
  10.                               (603) 625-4691
  11.  
  12.                         Converted to the IBM/PC by
  13.                               David N. Smith
  14.                             44 Ole Musket Lane
  15.                             Danbury, CT  06810
  16.                               (203) 748-5934
  17.  
  18.  
  19.         1.0  INTRODUCTION
  20.  
  21.         SDB is a simple database manager for small systems.  It  was
  22.         developed  to  provide  a relatively low overhead system for
  23.         storing data  on  machines  with  limited  disk  and  memory
  24.         resources.   The current version runs on a PDT-11/150 with 2
  25.         RX01 floppy disk drives and 60K bytes of  memory  under  the
  26.         RT-11 operating system.  (it also runs on the VAX under VMS)
  27.  
  28.         SDB was originally intended  to  be  a  relational  database
  29.         system, so many of the terms used in describing it are taken
  30.         from the relational database literature.  Within the context
  31.         of SDB the user can safely make the following associations:
  32.  
  33.              1.  RELATION can be taken to mean FILE
  34.  
  35.              2.  TUPLE can be taken to mean RECORD
  36.  
  37.              3.  ATTRIBUTE can be taken to mean FIELD
  38.  
  39.         It should be noted that SDB is not a  relationally  complete
  40.         system.   It  provides  the relational operations of SELECT,
  41.         PROJECT, and JOIN, but does not provide the  set  operations
  42.         of  UNION,  INTERSECTION,  or  DIFFERENCE  as  well  as some
  43.         others.
  44.  
  45.  
  46.         2.0  RELATION FILE FORMATS
  47.  
  48.         SDB maintains a separate file for  each  relation  that  the
  49.         user  creates.  This file contains a header block containing
  50.         the definition of the relation including the names and types
  51.         of  all  of the relation's attributes.  The remainder of the
  52.         file contains fixed length records each containing one tuple
  53.         from the relation.
  54.  
  55.         Tuples can be of three types:
  56.  
  57.              1.  active - tuples that contain actual active data
  58.  
  59.              2.  deleted - tuples that have been deleted
  60.  
  61.              3.  unused - tuples that haven't been used yet
  62.  
  63.         SDB - a Simple Database System                        Page 2
  64.  
  65.  
  66.         Initially, all tuples are  unused.   When  a  new  tuple  is
  67.         stored  into  a  relation,  the  first unused tuple is found
  68.         (they are all contiguous at the end of the  relation  file).
  69.         The new tuple is stored as an active tuple.
  70.  
  71.         When a tuple is deleted, it is marked as  such.   The  space
  72.         previously  allocated  to  the  deleted tuple is left unused
  73.         until the relation is compressed.
  74.  
  75.         It is possible that when attempting to store a new tuple, no
  76.         unused  tuple can be found even though the relation contains
  77.         fewer than the maximum active  tuples.   This  happens  when
  78.         tuples  have  been  deleted since the time the relation file
  79.         was last compressed.
  80.  
  81.         The compress function  allows  all  of  the  space  lost  by
  82.         deleting tuples to be regained.  It does this by copying all
  83.         of the active tuples as far backward in the file as possible
  84.         leaving  all  of  the  available space toward the end of the
  85.         file.
  86.  
  87.  
  88.  
  89.         3.0  SELECTION EXPRESSIONS
  90.  
  91.         A selection expression specifies a set of tuples over  which
  92.         some  SDB  operation  is  to  be executed.  The syntax for a
  93.         selection expression is:
  94.  
  95.         <rse>           ::= <rnames> [ where <boolean> ]
  96.         <rnames>        ::= <rname> [ , <rname> ] ...
  97.         <rname>         ::= <relation-name> [ <alias> ]
  98.  
  99.         When a single relation name  is  specified  in  a  selection
  100.         expression,  each  tuple  within  that  relation  becomes  a
  101.         candidate for selection.
  102.  
  103.         When more than one relation name is  specified,  the  tuples
  104.         are  formed  by  taking  the  cross product of all specified
  105.         relations.  If a relation is to be crossed with  itself,  an
  106.         alias must be given to one or both of the occurances of that
  107.         relation name in the selection expression.  This allows  SDB
  108.         to determine which relation occurance is being refered to in
  109.         the boolean part of the selection expression.
  110.  
  111.         After the set of candidate tuples is determined, the boolean
  112.         expression  is evaluated for each candidate.  The candidates
  113.         for which the boolean expression evaluates  to  TRUE  become
  114.         the selected tuples.
  115.  
  116.         SDB - a Simple Database System                        Page 3
  117.  
  118.  
  119.         4.0  INITIALIZATION FILE AND COMMAND FILES
  120.  
  121.         When SDB is first run,  it  attempts  to  read  and  process
  122.         commands  from  a  file  named "SDB.INI".  This file usually
  123.         contains macro definitions, but can contain  any  valid  SDB
  124.         command.   In  addition,  it  is possible to process command
  125.         files from within SDB.   This  is  done  by  typing  an  '@'
  126.         followed by the command file name after the SDB prompt.
  127.  
  128.  
  129.  
  130.         5.0  FILE NAMES
  131.  
  132.         Whenever a file name is allowed in the syntax for a command,
  133.         it  is  possible  to  use  either  an identifier or a quoted
  134.         string.  An identifier is interpreted as the file name and a
  135.         string  is  interpreted  as  a full file specification.  The
  136.         string form allows for the  specification  of  an  alternate
  137.         device or extension.
  138.  
  139.  
  140.  
  141.         6.0  FORM DEFINITION FILES
  142.  
  143.         A form  definition  file  contains  a  template  into  which
  144.         attribute  values  are substituted during a print operation.
  145.         There are two types of information that can be included in a
  146.         form definition:
  147.  
  148.              1.  Literal text
  149.  
  150.              2.  Attribute references
  151.  
  152.         Attribute references are indicated by placing  the  name  of
  153.         the  attribute  being  referenced  between  a  pair of angle
  154.         brackets.  Literal text is anything that is not enclosed  in
  155.         angle brackets.
  156.  
  157.         SDB - a Simple Database System                        Page 4
  158.  
  159.  
  160.         Example:
  161.         ________
  162.  
  163.         print using test amount,category from checks;
  164.  
  165.         Where test.frm contains:
  166.  
  167.         Amount: <amount>
  168.         Category: <category>
  169.  
  170.  
  171.         7.0  ALIASES FOR RELATIONS AND ATTRIBUTES
  172.  
  173.         When a relation or attribute name is specified  in  a  print
  174.         statement,  it  is possible to provide an alternate name for
  175.         that relation or attribute.  This is useful  for  relations,
  176.         when  it  is  necessary to join a relation to itself.  It is
  177.         useful for attributes when it is  desired  that  the  column
  178.         headers  in  a  table be different from the actual attribute
  179.         names.  Also, alternate  attribute  names  can  be  used  in
  180.         references  to that attribute in the where clause as well as
  181.         in a  form  definition  file.   The  syntax  for  specifying
  182.         aliases is:
  183.  
  184.             <name> <alias>
  185.  
  186.  
  187.         Example:
  188.         ________
  189.  
  190.         print using test amount a,category c from checks;
  191.  
  192.         Where test.frm contains:
  193.  
  194.         Amount: <a>
  195.         Category: <c>
  196.  
  197.         SDB - a Simple Database System                        Page 5
  198.  
  199.  
  200.         8.0  BOOLEAN EXPRESSIONS
  201.  
  202.         The syntax for boolean expressions:
  203.  
  204.         <expr>          ::= <land> [ '|' <land> ]
  205.         <land>          ::= <relat> [ '&' <relat> ]
  206.         <relat>         ::= <primary> [ <relop> <primary> ]
  207.         <primary>       ::= <term> [ <addop> <term> ]
  208.         <term>          ::= <unary> [ <mulop> <unary> ]
  209.         <unary>         ::= <factor> | <unop> <unary>
  210.         <factor>        ::= <operand> | '(' <expr> ')'
  211.         <operand>       ::= <number> | <string> | <attribute>
  212.         <attribute>     ::= [ <rname> . ] <aname>
  213.         <relop>         ::= '=' | '<>' | '<' | '>' | '<=' | '>='
  214.         <addop>         ::= '+' | '-'
  215.         <mulop>         ::= '*' | '/'
  216.         <unop>          ::= '+' | '-' | '~'
  217.  
  218.  
  219.         Operators:
  220.  
  221.              1.  '=' - equal
  222.  
  223.              2.  '<>' - not equal
  224.  
  225.              3.  '<' - less than
  226.  
  227.              4.  '>' - greater than
  228.  
  229.              5.  '<=' - less than or equal
  230.  
  231.              6.  '>=' - greater than or equal
  232.  
  233.              7.  '+' - addition or unary plus (not implemented)
  234.  
  235.              8.  '-' - subraction or unary minus (not implemented)
  236.  
  237.              9.  '*' - multiplication (not implemented)
  238.  
  239.             10.  '/' - division (not implemented)
  240.  
  241.             11.  '&' - logical and
  242.  
  243.             12.  '|' - logical or
  244.  
  245.             13.  '~' - logical not
  246.  
  247.         Operands:
  248.  
  249.              1.  number - a string of digits containing at most  one
  250.                  decimal point
  251.  
  252.              2.  string - a string of characters enclosed in  double
  253.                  quotes
  254.  
  255.         SDB - a Simple Database System                        Page 6
  256.  
  257.  
  258.              3.  attribute - an attribute name optionally  qualified
  259.                  by a relation name
  260.  
  261.  
  262.         SDB - a Simple Database System                        Page 7
  263.  
  264.  
  265.         9.0  INTERACTIVE COMMAND DESCRIPTIONS
  266.  
  267.         Function:
  268.         _________
  269.  
  270.         Create a relation file
  271.  
  272.  
  273.         Format:
  274.         _______
  275.  
  276.         create <rname> ( <alist> ) <size>
  277.  
  278.  
  279.         Rules:
  280.         ______
  281.  
  282.              1.  <rname> is the name of the relation file
  283.  
  284.              2.  <alist> is a list of attribute definitions  of  the
  285.                  form:
  286.  
  287.                    <aname> { char | num } <size>
  288.  
  289.                  where:
  290.  
  291.                  1.  <aname> is the name of the attribute
  292.  
  293.                  2.  the type of the attribute is either  "char"  or
  294.                      "num"
  295.  
  296.                  3.  <size> is the number of bytes allocated to  the
  297.                      attribute value
  298.  
  299.  
  300.              3.  <size> is the maximum number of tuples the file  is
  301.                  to hold
  302.  
  303.  
  304.  
  305.         Example:
  306.         ________
  307.  
  308.         create checks (
  309.             number      num     4
  310.             date        char    8
  311.             payee       char    20
  312.             amount      num     8
  313.             category    char    5
  314.         ) 200
  315.  
  316.         This command creates a relation file named "checks.sdb" with
  317.         attributes   "number",   "date",   "payee",   "amount",  and
  318.         "category" and space to store 200 tuples.
  319.  
  320.         SDB - a Simple Database System                        Page 8
  321.  
  322.  
  323.         Function:
  324.         _________
  325.  
  326.         Insert tuples into a relation
  327.  
  328.  
  329.         Format:
  330.         _______
  331.  
  332.         insert <rname>
  333.  
  334.  
  335.         Rules:
  336.         ______
  337.  
  338.              1.  <rname> is the name of a relation
  339.  
  340.              2.  the user will be prompted for  the  values  of  the
  341.                  attributes for the tuple to be inserted
  342.  
  343.              3.  a  null  response  to  an  attribute  prompt   will
  344.                  terminate tuple entry
  345.  
  346.              4.  if a null value is desired, a single space  can  be
  347.                  entered
  348.  
  349.  
  350.         SDB - a Simple Database System                        Page 9
  351.  
  352.  
  353.         Function:
  354.         _________
  355.  
  356.         Delete tuples from a set of relations
  357.  
  358.  
  359.         Format:
  360.         _______
  361.  
  362.         delete <rse> ;
  363.  
  364.  
  365.         Rules:
  366.         ______
  367.  
  368.              1.  <rse> is a tuple selection expression
  369.  
  370.              2.  selected tuples are deleted
  371.  
  372.  
  373.  
  374.         Example:
  375.         ________
  376.  
  377.         delete checks where category = "junk";
  378.  
  379.         SDB - a Simple Database System                       Page 10
  380.  
  381.  
  382.  
  383.         Function:
  384.         _________
  385.  
  386.         Update the values of selected attributes in selected tuples
  387.  
  388.  
  389.         Format:
  390.         _______
  391.  
  392.         update { <attrs> | * } from <rse> ;
  393.  
  394.  
  395.         Rules:
  396.         ______
  397.  
  398.              1.  <attrs> is a list of attribute names to be updated
  399.  
  400.              2.  * means all attributes
  401.  
  402.              3.  <rse> is a tuple selection expression
  403.  
  404.              4.  for each  set  of  selected  tuples,  the  user  is
  405.                  prompted for new values for the selected attributes
  406.  
  407.              5.  a null response to an attribute prompt will  retain
  408.                  the previous attribute value
  409.  
  410.              6.  if a null value is desired, a single space  can  be
  411.                  entered
  412.  
  413.  
  414.  
  415.         Example:
  416.         ________
  417.  
  418.         update amount,category from checks where number > 10;
  419.  
  420.         SDB - a Simple Database System                       Page 11
  421.  
  422.  
  423.         Function:
  424.         _________
  425.  
  426.         Print a table of values of selected attributes
  427.  
  428.  
  429.         Format:
  430.         _______
  431.  
  432.         print [ using <fname> ] { <attrs> | * } from  <rse>  [  into
  433.         <fname> ] ;
  434.  
  435.  
  436.         Rules:
  437.         ______
  438.  
  439.              1.  using  <fname>  indicates  output  using   a   form
  440.                  definition file (.FRM)
  441.  
  442.              2.  <attrs> is a list of attribute names to be printed
  443.  
  444.              3.  * means all attributes
  445.  
  446.              4.  <rse> is a tuple selection expression
  447.  
  448.              5.  <fname> is the name of an file to which  the  table
  449.                  will be output (.TXT)
  450.  
  451.              6.  if the output file name is omitted,  output  is  to
  452.                  the terminal
  453.  
  454.              7.  for each set of selected tuples, a table  entry  is
  455.                  printed containing the selected attributes
  456.  
  457.  
  458.  
  459.         Example:
  460.         ________
  461.  
  462.         print payee,amount from checks where category = "junk";
  463.  
  464.         SDB - a Simple Database System                       Page 12
  465.  
  466.  
  467.         Function:
  468.         _________
  469.  
  470.         Import tuples from a file into a relation
  471.  
  472.  
  473.         Format:
  474.         _______
  475.  
  476.         import <fname> into <rname>
  477.  
  478.  
  479.         Rules:
  480.         ______
  481.  
  482.              1.  <fname> is the name of the input file (.DAT)
  483.  
  484.              2.  the input file contains the  values  of  the  tuple
  485.                  attributes with each on a separate line
  486.  
  487.              3.  <rname> is the name of a relation
  488.  
  489.              4.  tuples are appended to the named relation
  490.  
  491.  
  492.         SDB - a Simple Database System                       Page 13
  493.  
  494.  
  495.         Function:
  496.         _________
  497.  
  498.         Export tuples from a relation into a file
  499.  
  500.  
  501.         Format:
  502.         _______
  503.  
  504.         export <rname> [ into <fname> ] ;
  505.  
  506.  
  507.         Rules:
  508.         ______
  509.  
  510.              1.  <rname> is the name of a relation
  511.  
  512.              2.  <fname> is the name of the output file (.DAT)
  513.  
  514.              3.  if the output file name is omitted,  output  is  to
  515.                  the terminal
  516.  
  517.              4.  tuples are written to  the  output  file  with  one
  518.                  attribute value per line
  519.  
  520.  
  521.         SDB - a Simple Database System                       Page 14
  522.  
  523.  
  524.         Function:
  525.         _________
  526.  
  527.         Extract the definition of a relation into a file
  528.  
  529.  
  530.         Format:
  531.         _______
  532.  
  533.         extract <rname> [ into <fname> ] ;
  534.  
  535.  
  536.         Rules:
  537.         ______
  538.  
  539.              1.  <rname> is the name of a relation
  540.  
  541.              2.  <fname> is the name of the output file (.DEF)
  542.  
  543.              3.  if the output file name is omitted,  output  is  to
  544.                  the terminal
  545.  
  546.              4.  the definition of the relation is  written  to  the
  547.                  output file
  548.  
  549.  
  550.         SDB - a Simple Database System                       Page 15
  551.  
  552.  
  553.         Function:
  554.         _________
  555.  
  556.         Compress a relation file
  557.  
  558.  
  559.         Format:
  560.         _______
  561.  
  562.         compress <rname>
  563.  
  564.  
  565.         Rules:
  566.         ______
  567.  
  568.              1.  <rname> is the name of a relation file
  569.  
  570.              2.  tuples are copied toward the front of the  relation
  571.                  file  such  that  any  space  freed  by  previously
  572.                  deleted tuples becomes adjacent to the  free  space
  573.                  at the end of the file, thus becoming available for
  574.                  use in inserting new tuples
  575.  
  576.  
  577.         SDB - a Simple Database System                       Page 16
  578.  
  579.  
  580.         Function:
  581.         _________
  582.  
  583.         Sort a relation file
  584.  
  585.  
  586.         Format:
  587.         _______
  588.  
  589.         sort <rname> by <sname> { , <sname } ...  ;
  590.  
  591.  
  592.         Rules:
  593.         ______
  594.  
  595.              1.  <rname> is the name of a relation file
  596.  
  597.              2.  <sname> is the name of  an  attribute  to  sort  on
  598.                  followed optionally by "ascending" or "descending"
  599.  
  600.              3.  if a sort order  is  not  specified,  ascending  is
  601.                  assumed
  602.  
  603.              4.  tuples within the  relation  are  sorted  in  place
  604.                  using the attributes indicated
  605.  
  606.  
  607.         SDB - a Simple Database System                       Page 17
  608.  
  609.  
  610.         Function:
  611.         _________
  612.  
  613.         Define a macro
  614.  
  615.  
  616.         Format:
  617.         _______
  618.  
  619.         define <mname>
  620.  
  621.  
  622.         Rules:
  623.         ______
  624.  
  625.              1.  <mname> is the name of the macro being defined
  626.  
  627.              2.  if a macro with the specified name already  exists,
  628.                  it is replaced
  629.  
  630.              3.  after entering the define command, definition  mode
  631.                  is entered
  632.  
  633.              4.  definition  mode  is  indicated   by   the   prompt
  634.                  "SDB-DEF>"
  635.  
  636.              5.  all lines typed in definition mode are added to the
  637.                  macro definition
  638.  
  639.              6.  a blank line terminates definition mode
  640.  
  641.              7.  a macro can be deleted by entering a blank line  as
  642.                  the only line in the definition
  643.  
  644.              8.  after a macro is defined, every  occurance  of  the
  645.                  macro name is replaced by the macro definition
  646.  
  647.  
  648.         SDB - a Simple Database System                       Page 18
  649.  
  650.  
  651.         Function:
  652.         _________
  653.  
  654.         Show a macro definition
  655.  
  656.  
  657.         Format:
  658.         _______
  659.  
  660.         show <mname>
  661.  
  662.  
  663.         Rules:
  664.         ______
  665.  
  666.              1.  <mname> is the name of a macro whose definition  is
  667.                  to be shown
  668.  
  669.  
  670.         SDB - a Simple Database System                       Page 19
  671.  
  672.  
  673.         Function:
  674.         _________
  675.  
  676.         Print a short help message
  677.  
  678.  
  679.  
  680.         Format:
  681.         _______
  682.  
  683.         help
  684.  
  685.  
  686.         Rules:
  687.         ______
  688.  
  689.              1.  (none)
  690.  
  691.  
  692.         SDB - a Simple Database System                       Page 20
  693.  
  694.  
  695.         Function:
  696.         _________
  697.  
  698.         Exit from SDB
  699.  
  700.  
  701.         Format:
  702.         _______
  703.  
  704.         exit
  705.  
  706.  
  707.         Rules:
  708.         ______
  709.  
  710.              1.  (none)
  711.  
  712.  
  713.         SDB - a Simple Database System                       Page 21
  714.  
  715.  
  716.         10.0  PROGRAM INTERFACE
  717.  
  718.         SDB provides a callable program interface to allow  programs
  719.         written  in  DECUS-C  to access relation files.  In order to
  720.         use the call interface, the users program should  be  linked
  721.         with  the SDBUSR.OBJ object library.  Also, additional stack
  722.         space should be allocated at link  time  using  the  /BOTTOM
  723.         qualifier  on  the link command.  /BOTTOM:3000 seems to work
  724.         well, but it is probably possible to get away with less.
  725.  
  726.         Example:
  727.         ________
  728.  
  729.         #include <stdio.h>
  730.         #include "sdb.h"
  731.  
  732.         main()
  733.         {
  734.             DB_SEL *sptr;
  735.             char payee[100],amount[100];
  736.  
  737.             /* setup retrieval */
  738.             if ((sptr = db_retrieve("checks where amount > 25.00")) == NULL) {
  739.                 printf("*** error: %s ***\n",db_ertxt(dbv_errcode));
  740.                 exit();
  741.             }
  742.  
  743.             /* bind user variables to attributes */
  744.             db_bind(sptr,"checks","payee",payee);
  745.             db_bind(sptr,"checks","amount",amount);
  746.  
  747.             /* loop through selection */
  748.             while (db_fetch(sptr))
  749.                 printf("%s\t%s\n",payee,amount);
  750.  
  751.             /* finish selection */
  752.             db_done(sptr);
  753.         }
  754.  
  755.         SDB - a Simple Database System                       Page 22
  756.  
  757.  
  758.         Function:
  759.         _________
  760.  
  761.         Setup a tuple retrieval context
  762.  
  763.  
  764.         Format:
  765.         _______
  766.  
  767.         dbptr = db_retrieve(sexpr [ ,arg ]...)
  768.  
  769.  
  770.         Rules:
  771.         ______
  772.  
  773.              1.  sexpr is a pointer to a string containing an rse
  774.  
  775.              2.  arg is a "printf" argument
  776.  
  777.              3.  dbptr is a database context pointer
  778.  
  779.              4.  db_retrieve returns NULL on errors
  780.  
  781.              5.  on errors, the error code is in dbv_errcode
  782.  
  783.  
  784.         SDB - a Simple Database System                       Page 23
  785.  
  786.  
  787.         Function:
  788.         _________
  789.  
  790.         Fetch the next set of tuples from a retrieval context
  791.  
  792.  
  793.         Format:
  794.         _______
  795.  
  796.         db_fetch(dbptr)
  797.  
  798.  
  799.         Rules:
  800.         ______
  801.  
  802.              1.  dbptr is a database context pointer
  803.  
  804.              2.  updates the values of all bound user variables
  805.  
  806.              3.  db_fetch returns FALSE if no more tuples  match  or
  807.                  if an error occurs
  808.  
  809.              4.  on errors, the error code is in dbv_errcode
  810.  
  811.  
  812.         SDB - a Simple Database System                       Page 24
  813.  
  814.  
  815.         Function:
  816.         _________
  817.  
  818.         Update the current tuple within a retrieval context
  819.  
  820.  
  821.         Format:
  822.         _______
  823.  
  824.         db_update(dbptr)
  825.  
  826.  
  827.         Rules:
  828.         ______
  829.  
  830.              1.  dbptr is a database context pointer
  831.  
  832.              2.  db_update returns FALSE if an error occurs
  833.  
  834.              3.  on errors, the error code is in dbv_errcode
  835.  
  836.  
  837.         SDB - a Simple Database System                       Page 25
  838.  
  839.  
  840.         Function:
  841.         _________
  842.  
  843.         Store a new tuple within a retrieval context
  844.  
  845.  
  846.         Format:
  847.         _______
  848.  
  849.         db_store(dbptr)
  850.  
  851.  
  852.         Rules:
  853.         ______
  854.  
  855.              1.  dbptr is a database context pointer
  856.  
  857.              2.  db_store returns FALSE if an error occurs
  858.  
  859.              3.  on errors, the error code is in dbv_errcode
  860.  
  861.  
  862.         SDB - a Simple Database System                       Page 26
  863.  
  864.  
  865.         Function:
  866.         _________
  867.  
  868.         Bind a user variable to  the  value  of  a  tuple  attribute
  869.         within a retrieval context
  870.  
  871.  
  872.         Format:
  873.         _______
  874.  
  875.         db_bind(dbptr,rname,aname,value)
  876.  
  877.  
  878.         Rules:
  879.         ______
  880.  
  881.              1.  dbptr is a database context pointer
  882.  
  883.              2.  rname is a pointer to the relation name
  884.  
  885.              3.  aname is a pointer to the attribute name
  886.  
  887.              4.  value is a pointer to a character array to  receive
  888.                  the attribute value
  889.  
  890.              5.  db_bind returns FALSE if an error occurs
  891.  
  892.              6.  on errors, the error code is in dbv_errcode
  893.  
  894.  
  895.         SDB - a Simple Database System                       Page 27
  896.  
  897.  
  898.         Function:
  899.         _________
  900.  
  901.         Get the value  of  a  tuple  attribute  within  a  retrieval
  902.         context
  903.  
  904.  
  905.         Format:
  906.         _______
  907.  
  908.         db_get(dbptr,rname,aname,value)
  909.  
  910.  
  911.         Rules:
  912.         ______
  913.  
  914.              1.  dbptr is a database context pointer
  915.  
  916.              2.  rname is a pointer to the relation name
  917.  
  918.              3.  aname is a pointer to the attribute name
  919.  
  920.              4.  value is a pointer to a character array to  receive
  921.                  the attribute value
  922.  
  923.              5.  db_get returns FALSE if an error occurs
  924.  
  925.              6.  on errors, the error code is in dbv_errcode
  926.  
  927.  
  928.         SDB - a Simple Database System                       Page 28
  929.  
  930.  
  931.         Function:
  932.         _________
  933.  
  934.         Put the value  of  a  tuple  attribute  within  a  retrieval
  935.         context
  936.  
  937.  
  938.         Format:
  939.         _______
  940.  
  941.         db_put(dbptr,rname,aname,value)
  942.  
  943.  
  944.         Rules:
  945.         ______
  946.  
  947.              1.  dbptr is a database context pointer
  948.  
  949.              2.  rname is a pointer to the relation name
  950.  
  951.              3.  aname is a pointer to the attribute name
  952.  
  953.              4.  value is a pointer to the new value
  954.  
  955.              5.  db_put returns FALSE if an error occurs
  956.  
  957.              6.  on errors, the error code is in dbv_errcode
  958.  
  959.  
  960.         SDB - a Simple Database System                       Page 29
  961.  
  962.  
  963.         Function:
  964.         _________
  965.  
  966.         Discontinue usage of a retrieval context
  967.  
  968.  
  969.  
  970.         Format:
  971.         _______
  972.  
  973.         db_done(dbptr)
  974.  
  975.  
  976.         Rules:
  977.         ______
  978.  
  979.              1.  dbptr is a database context pointer
  980.  
  981.  
  982.         SDB - a Simple Database System                       Page 30
  983.  
  984.  
  985.         Function:
  986.         _________
  987.  
  988.         Translate an error code to an error message text
  989.  
  990.  
  991.         Format:
  992.         _______
  993.  
  994.         db_ertxt(errcode)
  995.  
  996.  
  997.         Rules:
  998.         ______
  999.  
  1000.              1.  errcode is an SDB error code
  1001.  
  1002.              2.  db_ertxt returns a pointer  to  the  error  message
  1003.                  text
  1004.  
  1005.  
  1006. ïvèD0ΣêDïF=  t%ïvï\Kë\à█x
  1007. ï ê0Σδ v vΦ╘■ïσδ╟FïvèD0Σ%0