home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / sources / misc / 4124 / dox / mbase.dox
Encoding:
Text File  |  1992-11-23  |  32.3 KB  |  554 lines

  1.     /\
  2.    /  \
  3. ../    \....METALBASE Version 5.0..............................................
  4.  /      \
  5. /        \  Written From October 1990 by Huan-Ti
  6. \        /
  7.  \      /   Revision 3.1 released December 10th 1990
  8.   \    /    Revision 3.2 released December 10th 1991
  9.    \  /     Revision 4.0 released Febuary 14th 1992
  10.     \/      Revision 4.1 released April 1st 1992
  11.             Revision 4.1a released May 10th 1992
  12.             Revision 5.0 released October 1st 1992
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19.        "And Calvin ate.  And Food Lion went out of business.  Amen."
  20.  
  21.                                                    --1st Calvin 4:8
  22.  
  23.  
  24. WHY_METALBASE_?________________________________________________________________
  25.  
  26.     The Amiga 500 multi-tasks.  Wow.  It has great graphics.  Yeah.  Phenomenal
  27. sound.  Yippee.  It costs $500.  I bought one.
  28.     A DBase package costs more than the computer.  So does Paradox.  And
  29. Informix.  And almost every other database package on the market.  I didn't
  30. buy one.
  31.     But I needed a database for my system--anybody who's ever worked with a
  32. database knows they're addictive; code that's written without a flexible
  33. database backing it up lacks something.  And DBase wants $600 to put that
  34. something back into programs.  No thanks.
  35.     That's why MetalBase was written... its forerunners (versions 1.0 and
  36. 2.0, not available) were designed by the same author with the Amiga line's
  37. needs specifically in mind:  relatively slow floppy drives (Compared to hard
  38. drives), so sparse read-head maneuvering was essential.  Relatively small
  39. memory, when compared with the amounts of memory required by most C compilers
  40. (Lattice needs roughly 300k just to run, for example), so the code had to be
  41. consise, pure, and use few variables.  Expansion was always available; hard
  42. drives, huge memory capacities, extra processors, ram drives -- so the system
  43. had to be readily expandible and flexible enough to meet the requirements of
  44. both a 512k, 1-drive machine and a 32-megabyte, 200-meg hard drive-driven
  45. setup.  And they were.
  46.     The problem was, Amigas can multi-task.  So what is the rest of the
  47. computer doing while a database runs around looking up records on one drive?
  48. Nothing.  Why not let it look up records on another drive?  Fine... that works.
  49. What about on the same drive... using, say, a ram disk, so there are no real
  50. read-heads to worry about positioning?  That would mean each relation would
  51. have to support multi-user access... a requirement around which MetalBase
  52. versions 3.0 and up focus.  Not only can any given terminal access many files
  53. at once, but on multi-terminal systems, each terminal can work simultaneously
  54. on any given file.  Terminals can each use as many relations as a system will
  55. allow, and each relation can be used by some sixty-four users at once.  The
  56. code used to create MetalBase 3.X and up is completely compatible with the
  57. Unix operating system and all of its derivatives, so its inherent multi-user
  58. ability places it in firm working footing on the most advanced systems on the
  59. market.
  60.     But the IBM users complained.  And the unix users complained.  And lo,
  61. even the Amiga people complained--the code didn't work all the time, and
  62. was generally crude.  So MetalBase 4.0 solved these troubles and more--a
  63. complete rewrite of the engine has provided even faster and more efficient
  64. algorithms, which keep MetalBase indices in AVL balance at all times.  More
  65. convenient functions and operations (such as build's ability to create header
  66. files for your code which reflect a schema's structure) have been added,
  67. along with several utility programs for maintaining your database.
  68.     Relations are designed by a user to match his/her exact requirements,
  69. indices placed as needed on single or composite fields, and records can be
  70. added, retrieved, changed, and deleted as any C programmer so desires.  The
  71. interface is as simple as possible, very fast in execution, and provides a wide
  72. range of error types for exact specification of problems.  A user on any
  73. terminal can choose to lock out other users from any number of relations, so
  74. sweeping changes in data will not be read by others before they can take
  75. place.  Automatic temporary locks are placed on a relation which is about
  76. to undergo a deletion or addition, strategically delaying other users' access
  77. to files for less than seconds, so that no data will be read until all indices
  78. have been updated correctly.  This process is entirely system-driven; users
  79. never need worry about it at all.  If one user is adding a record to a
  80. relation, any terminal requesting a record lookup will simply wait until the
  81. addition is complete before proceeding.  As records are deleted and added
  82. through normal use, the algorithms used to update indices automatically keep
  83. them at top operating speeds, so any given relation's number of records can
  84. grow exponentially while causing only a linear increase in look-up time.  Any
  85. relation can contain over four billion records (Nearly four billion more than
  86. most systems will ever need), and each record's length can be as large as its
  87. system's memory can handle.  In perspective, MetalBase is infinitely
  88. expandible, while requiring very little of the system on which it operates.
  89.  
  90. [ The actual number of records allowable is 4,294,967,296... if you were to
  91.   add one record a second, it would take over 136 years to reach this limit ]
  92.  
  93. RELATION_DESIGN________________________________________________________________
  94.  
  95.         A sample relation.  Data      Field # ->  1    2   3    4       5
  96.         is read by selecting one     Record #   _____ ___ ____ ___ ___________
  97.         record from the others by          1   |_____|___|____|___|___________|
  98.         various criteria, and              2   |_____|___|____|___|___________|
  99.         returning it to the user.          3   |Smith| 12| 114| A2|Houston, TX|
  100.         Record 3 (In this example--        4   |-----|---|----|---|-----------|
  101.         actual MetalBase records need
  102.         no such numbering system), if returned, would be placed in a structure
  103.         containing Smith,12,114,A2, and Houston,TX in the appropriate elements.
  104.  
  105.     A relation is a collection of records, each record consisting of the same
  106. number of fields--blocks of data whose individual lengths remain constant from
  107. record to record.  Each field need not have the same length as the others in
  108. any given record, but from record to record, a field's length will remain the
  109. same. The data the fields contain is, of course, the main purpose of a
  110. database--when thousands of records exist, a system without a database would
  111. need vast amounts of time to find any given record.  Databases decrease
  112. dramatically record retrieval time, while requiring as little additional time
  113. to add new and change old records as possible.
  114.     The key to a database is its indices--pointers arranged in such a fashion
  115. as to show the system where to look for the record for which it is searching.
  116. The more of these collections of pointers, or indices, a database has, the
  117. greater the number of different fields a system can search through in order to
  118. find a record meeting certain criteria for a field (Or fields... a single index
  119. can be used to first sort records by one field, and also sort duplicates with
  120. respect to a second field, etc.  MetalBase allows these composite indices to
  121. key off of as many as 999 different fields).  However, databases require time
  122. to update each index every time you add, delete, or change a field which has an
  123. index placed upon it.  So although retrieval criteria possibilites are expanded
  124. by using many indices, the amount of time required to change the existing
  125. records in a database will also increase.  For this reason, the number of
  126. indices a relation will have should be considered carefully--use what is
  127. needed, but no more.
  128.  
  129.     Relations are built from schema files, which decribe the relation in a
  130. more human-friendly syntax.  See build.dox for a more complete description of
  131. this process.
  132.  
  133. IMPLEMENTAION__________________________________________________________________
  134.  
  135.     A sample program implementing MetalBase follows:
  136.  
  137.      #include <mbase.h>
  138.      #include "equipment.h"
  139.  
  140.      main ()
  141.      {
  142.         relation *rel;
  143.  
  144.         if ((rel = mb_inc ("/usr/joe/equipment", strtokey("key"))) == RNULL) {
  145.            printf ("Can't open database - %s.\n", mb_error);
  146.            mb_exit (1);
  147.         }
  148.  
  149.         equipment_rec.price_code = 114.20;       /* Set up initial values */
  150.         strcpy (equipment_rec.part_numb, "117"); /* to search for...      */
  151.  
  152.         if (mb_sel (rel, 0, &equipment_rec, EQUAL, NULL) != 0) {
  153.            printf  ("%s.\n", mb_error);
  154.            mb_exit (1);
  155.         }
  156.  
  157.         /* Now that we've found a record, change it to something else... */
  158.  
  159.         equipment_rec.num_purch = 14;
  160.         strcpy (equipment_rec.customer,  "Su");
  161.         strcpy (equipment_rec.part_numb, "112");
  162.         strcpy (equipment_rec.shop_addr, "Dallas, TX");
  163.         equipment_rec.price_code = 12;
  164.  
  165.         mb_upd (rel, &equipment_rec);  /* Update the current selection */
  166.  
  167.         mb_rmv (rel); // Unnecessary before mb_exit(), but good practice.
  168.         mb_exit (0);  // Always a good idea to use mb_exit() with MetalBase.
  169.      }
  170.  
  171.     Manipulation of relations using MetalBase is simple... by including the
  172. MetalBase header file in your programs and compiling using the option "-lmb"
  173. (Or "library ..., mbase.lib;", depending on your compiler), you add extra
  174. commands to C.  A summary of these follows:
  175.  
  176.  - mb_inc (filename, int) -- this command includes a relation on your desktop,
  177.         so that it becomes accessable.  Any relation you wish to work with
  178.         must be included using this call.  If mb_inc returns RNULL ( defined
  179.         as (relation *)0 ), an error has occurred (The most likely one is that
  180.         the relation cannot be found under the given directory--mb_errno will
  181.         be set to an error number, and mb_error (global char*) will contain
  182.         text regarding the problem).  Note that "filename" does NOT include the
  183.         ".rel" suffix.  BUILD, in analog, does not require that you include the
  184.         ".s" suffix on the name of the schema you are working with, but the
  185.         schema file itself must end in ".s", as relations must end in ".rel",
  186.         forms in ".frm" and reports in ".rpt".
  187.  
  188.         The integer passed in is the encryption key for the relation--see the
  189.         section on encryption for more information.  Note that MetalBase 3.0,
  190.         as it does not support encryption, does not require this integer; all
  191.         versions 3.1 and up do.  Sorry for the inconvenience.
  192.  
  193.         I also STRONGLY recommend the use of the function strtokey() to
  194.         obtain this integer from an ascii string... all utility programs
  195.         shipped with MetalBase ask for "Encryption Key"s, and they expect
  196.         a string to hash up with strtokey().  So if you use encryption but
  197.         not this method of getting the integer, you're SOL when trying to
  198.         use vr or report.  In fact, I encourage this so strongly that, in
  199.         future releases, I may replace the integer argument with a string
  200.         argument and do away with strtokey() entirely.
  201.  
  202.  - mb_tst (filename) -- This function goes through all the steps needed to
  203.         make sure a given relation can be opened, but doesn't open it (thus
  204.         it doesn't need an encryption key).  vr uses this one to make sure
  205.         it can open a relation before asking for a key; that's pretty much
  206.         its only use.
  207.  
  208.  - mb_sel (file, index, buffer, action, comparison_buffer) -- this command
  209.         searches a given relation for the record you desire, described by
  210.         "action" and "comparison_value".  "file" is a pointer to the structure
  211.         returned by mb_inc... this structure is used in all other functions to
  212.         indicate which relation you intend to work with.  "index" is the index
  213.         number by which you wish to search... numbered sequentially by the
  214.         order in which they were defined in the schema, starting with the
  215.         number 0.  To save trouble when changing schema, it is recommended you
  216.         use the routine idxnum() to look up an index number by name.  "buffer"
  217.         is merely a structure (like &equipment_rec above) into which MetalBase
  218.         can return the record, when found.  A list of valid actions follows:
  219.            FIRST (or FRST) -- searches for the first record alphabetically.
  220.            LAST -- similarly, seeks the last record alphabetically.
  221.            NEXT -- searches for the next sequential record alphabetically.
  222.            PREVIOUS (PREV) -- as NEXT, searches for the previous record.
  223.            EQUAL (EQUL) -- seeks a record containing fields exactly those in
  224.                 "comparison_buffer".  If the index used allows duplicates and
  225.                 some exist, EQUAL returns the first of these: all duplicates
  226.                 can be found by subsequent "NEXT" searches.  Note that the
  227.                 comparison_buffer and the return buffer need not be the same
  228.                 space, although they may.
  229.            GTEQ -- EQUAL returns a NOT_FOUND error if a record cannot be found
  230.                 to precisely match the comparison.  GTEQ acts as EQUAL in all
  231.                 respects but this;  GTEQ will find the record greater
  232.                 alphabetically, or precisely equal to (if one exists), the
  233.                 comparison.  In the event that duplicates of the record exist
  234.                 ("Duplicate" being defined logically as a record whose fields
  235.                 used by the current index are precisely equal to another such
  236.                 record's fields for the same index), GTEQ returns the first
  237.                 of these: all duplicates can be found by subsequent "NEXT"
  238.                 searches.
  239.            GTHAN (GTHN) -- Acts as GTEQ, except GTHAN will ignore precise
  240.                 matches.  Useful if you wish to begin searching names, say,
  241.                 after the "Smith"'s.  Another way to accomplish this would be
  242.                 to use LTEQ + "Smith", followed by a NEXT...
  243.            LTEQ -- Searches for a record less alphabetically, or equal to (if
  244.                 one exists), the comparison.  In the event that duplicates of
  245.                 the record about to be returned exist, LTEQ returns the last of
  246.                 these: all duplicates can be found by subsequent "PREVIOUS"
  247.                 searches.
  248.            LTHN (LTHAN) -- Similar to LTEQ in all but one regard: LTHAN will
  249.                 not return a precise duplicate, instead searching to its
  250.                 left for the record before it.
  251.            CURR (CURRENT) -- After a record is found by a search, MetalBase
  252.                 remembers the location of the record.  Searching with the
  253.                 action CURRENT re-reads this most recent record, and returns
  254.                 it in its entirety.  As with FIRST, LAST, NEXT and PREVIOUS,
  255.                 the value of "comparison_value" is irrelevant in CURRENT --
  256.                 however, CURRENT is also oblivious to index used (As no
  257.                 actual searching takes place... MetalBase merely recalls a
  258.                 known record).
  259.         Please note that the above-described action names merely stand for
  260.         integers, and MetalBase will not understand if you use quotes around
  261.         the names.  These actions must also be written in upper-case.
  262.         "comparison_buffer" is a structure identical to "buffer", but any
  263.         data in any of the fields is used for comparison when searching for
  264.         EQUAL, GTEQ, LTEQ, GTHAN or LTHAN.  There are three ways to use that--
  265.         give it a new record...
  266.             sample_str   sample_rec, target_rec;
  267.             target_rec.num = 15;
  268.             mb_sel (rel, idxnum("ix_num"), &sample_rec, EQUAL, &target_rec)
  269.         or, the same one twice...
  270.             sample_str   sample_rec;
  271.             sample_rec.num = 15;
  272.             mb_sel (rel, idxnum("ix_num"), &sample_rec, EQUAL, &sample_rec)
  273.         or, what I do most, pass in NULL as the comparison (works just like
  274.         the one above):
  275.             sample_str   sample_rec;
  276.             sample_rec.num = 15;
  277.             mb_sel (rel, idxnum("ix_num"), &sample_rec, EQUAL, NULL)
  278.         All three of these would have the same effect.
  279.  
  280.  - mb_upd (file, new_rec) -- After a record is found, it may be updated
  281.         through mb_upd.  MetalBase simply replaces the old record's fields with
  282.         those indicated in "new_rec".  This process usually requires more time
  283.         than any other, as the record must be disconnected from each index in
  284.         turn, changed, and reconnected.  Occasionally, changing a record will
  285.         not change certain indices--when this occurs, the index is simply
  286.         skipped.  An update, like an add, will be aborted if the changes would
  287.         violate a no-duplicates-allowed index.
  288.  
  289.  - mb_del (file) -- After a record is found, it may be removed completely by
  290.         use of mb_del.  Once a record is deleted thus, it CANNOT be retrieved.
  291.         Pre-5.0 versions of MetalBase used a second argument for tracking the
  292.         current pointer; this code was broken and I removed it.  :)  So now
  293.         there's no second argument--again, sorry for changing things on ya.
  294.  
  295.  - mb_add (file, new_rec) -- This command adds a new record to a relation.  If
  296.         adding the record described by "new_rec" would violate a non-duplicate
  297.         index, the addition to the relation will be aborted and an error
  298.         returned (See the section on Errors, below).
  299.  
  300.  - mb_lck (file) -- If, as an example, a program reads a record from a relation
  301.         used by many terminals simulaneously, waits for a user to enter a new
  302.         value for one of its fields, and updates the record, it could prove
  303.         disastrous if the record was read by one terminal, then another...
  304.         updated on one & re-written, and re-updated by the second terminal.  To
  305.         prevent this type of scenario, mb_lck, when used, excludes other users
  306.         from reading or writing to a relation.  Every operation they try
  307.         (including mb_inc()) will return MB_LOCKED until the process which
  308.         called mb_lck() calls mb_unl().
  309.  
  310.  - mb_unl (file) -- Removes a lock placed on a relation by mv_lck.
  311.  
  312.  - mb_rmv (file) -- This command removes a relation from your desktop.  If the
  313.         file has been locked previously (via mb_lck), the lock is removed.
  314.  
  315.  - mb_die () -- This command removes all open relations from your desktop, as
  316.         if you'd called each one in turn with mb_rmv(file).
  317.  
  318.  - mb_exit (ret_code) -- Calls mb_die(), followed by exit(ret_code).
  319.  
  320.  - mb_num (file) -- Returns the number of records in a relation.  Wheeee...
  321.  
  322.  
  323. ERRORS_________________________________________________________________________
  324.  
  325. In addition, see the separate documentation on troubleshooting, under the name
  326. trouble.dox.  There's not much, but I tried...
  327.  
  328. Build / Errors :
  329.  
  330.       Cannot open <file.s>............The schema indicated to Build cannot
  331.                                         be found.
  332.       File <file.s> holds no schema...The schema indicated cannot be used
  333.         definition                      as a definition of a relation.  The
  334.                                         most likely cause is that the file is
  335.                                         empty.
  336.       Field <field> declared after....All fields must be declared before any
  337.         indices                        indices are declared.
  338.       Field <field> declared twice....Field names must be unique.  Spaces are
  339.                                         not allowed in field names.
  340.       No fields declared before.......A relation must contain fields, and these
  341.         end reached                     must be declared before any indices.
  342.       Incorrect syntax................The definition of a field's length has
  343.                                         been entered incorrectly.
  344.       Field <field> undefined.........An index has been placed on a non-
  345.                                         existant field.  Check spelling.
  346.       No fields declared before end...The schema definition is incomplete: it
  347.         reached                         must contain at least one field and
  348.                                         one index.
  349.       No indices declared before.....See the above error description.
  350.         end reached
  351.       Identifier <?> not recognized...The only valid words for the beginning
  352.                                         of a line are "relation" or a relation-
  353.                                         name (as the first line), "field",
  354.                                         "index", and (optionally) "end".
  355.       Cannot open relation............The file <file.rel> cannot be written...
  356.                                         possible causes are a media error or
  357.                                         write-protection on the file.
  358.       Relation is busy................Relations cannot be re-built until it is
  359.                                         not being worked with by any users.
  360.       The file about to be created....If you build a relation where a relation
  361.         already exists                  of the same name already exists, any
  362.                                         data in the existing relation will be
  363.                                         erased in favor of the new, empty
  364.                                         relation.
  365.  
  366. MetalBase / Errors :
  367.  
  368. MetalBase routines either return necessary information (such as, mb_inc()
  369. returns a relation-pointer, and mb_num() the number of records in a relation),
  370. or 0 to indicate success.  The global variable mb_errno will be set to MB_OKAY
  371. (0) on success, and another error number (in the 1000's) on failure; the
  372. variable mb_error is a character string which will always describe the most
  373. recent error.  Possible errors are:
  374.  
  375.         0..MB_OKAY............This is the generic no-problem return code.  All
  376.                                 functions except mb_inc should return 0 if
  377.                                 they have been able to function properly.
  378.      1001..MB_NO_ROOM.........Too many relations are open at once -- mb_inc
  379.                                 cannot allocate enough space for the new
  380.                                 relation.  This error can be prevented by
  381.                                 re-defining MAX_REL, as with build's warning
  382.                                 messages, to a value greater than its default
  383.                                 of 5.  In addition, having many files open at
  384.                                 once may require that you warn <stdio.h>
  385.                                 (or config.sys, if you're using MSDOS)...
  386.                                 consult your system manuals.
  387.      1002..MB_NO_MEMORY.......A malloc() has failed, and the task must be
  388.                                 aborted.  This is a bad, bad thing to happen.
  389.                                 How d'ya fix it?  Well, that's hard to say...
  390.                                 look around and make sure you're free()'ing any
  391.                                 memory you malloc().
  392.      1003..MB_NO_OPEN.........The file "file.rel", where "file" is the name
  393.                                 passed to mb_inc, cannot be opened.  In all
  394.                                 probability, it does not exist.
  395.      1004..MB_NO_READ.........The file <file.rel> cannot be read.  This error
  396.                                 is returned only from mb_inc, and is probably
  397.                                 caused by read-protection placed on the file.
  398.      1005..MB_FORMAT..........This is the generic this-shouldn't-have-happened
  399.                                 error.  Check out trouble.dox for a quick
  400.                                 explanation of what could cause it.
  401.      1006..MB_LOCKED..........This error is returned if another user has
  402.                                 locked the relation you're trying to access...
  403.                                 wait until they haven't, and you'll be fine.
  404.      1007..MB_BUSY............Only a certain number of users is allowed to
  405.                                 access a relation at any given time.  The
  406.                                 limits are:
  407.                                         MetalBase 3.1, 3.2.........120
  408.                                         MetalBase 4.0...............63
  409.                                         MetalBase 4.1, 4.1a, 5.0...255
  410.      1008..MB_BAD_REL.........This essentially means that the relation* you
  411.                                 passed to a function was not returned by
  412.                                 a call to mb_inc()... it's an invalid pointer.
  413.      1009..MB_NO_WRITE........This error is produced when the relation you've
  414.                                 opened can't be written to... perhaps you don't
  415.                                 have permission.
  416.      1010..MB_TIMEOUT.........A user has stopped a program during a record
  417.                                 addition, deletion, or update.  These functions
  418.                                 place temporary locks on a file, which are
  419.                                 removed at the end of their respective
  420.                                 procedures.  Normally other functions will
  421.                                 simply wait for the file to be unlocked, but if
  422.                                 the wait time becomes excessive, this error is
  423.                                 returned and the function aborted.  Try the
  424.                                 function again, and if you recieve this error
  425.                                 a second time, see the section on Utilites to
  426.                                 remove the lock manually.
  427.  
  428.                                 Note that this error is no longer used, as of
  429.                                 revision 4.1.
  430.      1011..MB_BAD_REC.........A null pointer to a record has been received.
  431.                                 So essentially, you've given NULL instead
  432.                                 of &rec.  Stupid thing to do.  :(
  433.      1012..MB_CORRUPT.........This relation has an error on an index.  See the
  434.                                 section on Utilites to repair it.  Try to find
  435.                                 which index you were working with at the time
  436.                                 of the error, in order to speed repair.
  437.      1013..MB_BAD_DUP.........The record that has been offered for addition/
  438.                                 update would violate an index that has been
  439.                                 declared not to allow duplicates.
  440.      1014..MB_NO_CURR.........In order to perform a delete or an update,
  441.                                 you must have already issued mb_sel() to
  442.                                 determine which record you wish to modify.
  443.                                 This error indicates you have not done so.
  444.      1015..MB_BAD_IDX.........A bad index number has been passed to mb_sel.
  445.                                 Valid numbers range 0 through the number of
  446.                                 indices in a relation, minus 1.
  447.      1016..MB_NO_SUCH.........Generic code returned when the record described
  448.                                 cannot be found in the relation searched.  If
  449.                                 you feel it should have been found, check the
  450.                                 index number, action, and comparison value used
  451.                                 in the search.
  452.      1017..MB_UNKNOWN.........A very unlikely error, receipt of this code
  453.                                 indicates you have passed a number greater than
  454.                                 12 or less than 0 to mb_sel as an action.
  455.      1018..MB_NO_FIELDS.......You're trying to create a new relation without
  456.                                 specifying any fields for it.  Stupid you.
  457.      1019..MB_NO_INDICES......You're trying to create a new relation without
  458.                                 specifying any inidces for it.
  459.      1020..MB_BAD_INDEX.......An index you're trying to create has no fields.
  460.                                 Remember that the format for indices being
  461.                                 created is "nnn,nnn,nnn" --no whitespace
  462.                                 allowed without using BUILD.
  463.      1021..MB_DISKFULL........This will only happen on mb_add() or when using
  464.                                 mbconv, the 4.0+ => 5.0 conversion utility,
  465.                                 and is returned whenever there isn't enough
  466.                                 free space on the drive to perform the
  467.                                 requested operation.
  468.      1022..MB_BAD_SERIAL......This will only happen on mb_upd(), if you've
  469.                                 changed the serial number of the record
  470.                                 you're trying to update.  You can't.  It won't
  471.                                 let you.
  472.      1023..MB_TMPDIR..........On some systems, MetalBase requires that you
  473.                                 have the environment variable "TMP" set to
  474.                                 an appropriate directory for temporary files;
  475.                                 for example, "TMP=/tmp; export TMP" or
  476.                                 "set TMP=C:\TMP".  If you prefer, you can
  477.                                 use the variable "TEMP" instead.
  478.      1024..MB_TMPERR..........MetalBase cannot work with the directory you've
  479.                                 defined as per error #1023 (see TROUBLE.DOX).
  480.  
  481. UTILITIES______________________________________________________________________
  482.  
  483.     Five utilities have been released with this package; one, called blast,
  484. removes user- and system-placed locks on a relation and sets the number of
  485. users the relation thinks are using it to zero.  Impromper closing of a
  486. relation (ie, not closing one) will cause the number of users to build up
  487. until it cannot be used any longer.
  488.  
  489.     The second utility included is called vr, for View Relation.  Please see
  490. the separate documentation under ../dox/vr.dox for its description and
  491. instructions for its use.
  492.  
  493.     The third utility is called report... it generates reports of a relation's
  494. contents.  There is sparse documentation under ../dox/report.dox; it might
  495. help, it might not.  Play with it and it'll work--honest.  :)
  496.  
  497.     The fourth, and newest utility, is called mbconv--it converts pre-5.0
  498. MetalBase relations to 5.0 syntax.  Note that the process is safe but
  499. irreversable; and your schema files may need semicolons added just to be
  500. complete.
  501.  
  502.     And, the final utility is called "form"--it compiles data-entry templates
  503. into .h files your programs include for data-entry.  There's practically
  504. no documentation; just the one example under ../sample.  Good luck to you.
  505.  
  506.     Other supporting utilities to MetalBase have not been released with this
  507. package, primarily because I have not bothered to write them yet.  See the
  508. ReadMe.Too file up one directory to see how to register yourself with me, as
  509. I'll write any of the following upon request once you're registered (and
  510. maybe before, if I have time).
  511.  
  512.     Future utilities:
  513.  
  514.        * Repair of bad indices and recover of unreclaimed space from
  515.          previous deletes
  516.  
  517.        * Utility to change a relation's schema without destroying its
  518.          contents (oh boy...)
  519.  
  520.        * Relation import/export from standard, Emailable text files.
  521.  
  522.  
  523. ENCRYPTION______________________________________________________________________
  524.  
  525.     MetalBase 3.1 and up (not 3.0) automatically encrypt all files unless
  526. told otherwise.  When a relation is opened (using mb_inc()), an integer
  527. encryption-key is passed in to MetalBase.  Any records which are added to that
  528. relation are encrypted using this key, and any records which are retrieved are
  529. decrypted similarly before they are returned.  In this way, any information
  530. which is physically stored is encrypted beyond recognition.  As long as this
  531. integer key is the same every time the relation is opened, the encryption is
  532. totally user-transparent: records are passed to mb_inc and mb_upd in normal
  533. text, and are retrieved in normal text, but are stored garbled.  If the key
  534. changes, however, the records retreived in the second session will be decrypted
  535. under the new key, whereas they were encrypted under the former... and the
  536. output will be meaningless, for numbers and strings alike.
  537.  
  538.     Note that the encryption is apparently working for ALL supported machines
  539. now--however, this has always been the hardest part to port between machines.
  540. If necessary (or if you simply want to), compile mbase.c (and vr.c/sample.c/
  541. whatever) with -DNOENCRYPT, and it'll be turned off.
  542.  
  543.     For a more thorough explanation of MetalBase's encryption process, see the
  544. separate documentation crypt.dox.
  545.  
  546. --
  547.             ___
  548.          .-','                                        /\
  549.         /  (_______.------------------.              /  \ Huan-Ti
  550.        (    _______|))))))))))))))))))|              \  /
  551.         )__(       `------------------'               \/
  552.        `----'                                richid@owlnet.rice.edu
  553.  
  554.