home *** CD-ROM | disk | FTP | other *** search
/ Il CD di internet / CD.iso / SOURCE / CONTRIB / MBASE / MBASE50.TAR / mbase / dox / format.dox < prev    next >
Encoding:
Text File  |  1992-10-25  |  4.3 KB  |  104 lines

  1. Relation Format                                                   MetalBase 5.0
  2. -------------------------------------------------------------------------------
  3.  
  4.               Number   Enum Name    Storage    Typedef From
  5.               ------  -----------  ---------  --------------
  6.                  0.....T_CHAR.......char []....
  7.                  1.....T_SHORT......short......
  8.                  2.....T_USHORT.....ushort.....unsigned short
  9.                  3.....T_LONG.......long.......
  10.                  4.....T_ULONG......ulong......unsigned long
  11.                  5.....T_FLOAT......float......
  12.                  6.....T_DOUBLE.....double.....
  13.                  7.....T_MONEY......double.....
  14.                  8.....T_TIME.......mb_time....long
  15.                  9.....T_DATE.......mb_date....long
  16.                 10.....T_SERIAL.....long.......
  17.                 11.....T_PHONE......mb_phone...char[20]
  18.  
  19.  
  20. FIELD DESCRIPTIONS ------------------------------------------------------------
  21.  
  22.  
  23. Bits in time field:
  24.    00000000 hhhhhmmm mmmsssss suuuuuuu --h=hour,m=min,s=sec,u=microseconds
  25.  
  26. Bits in date field:
  27.    00000000 00yyyyyy yyyyyyym mmmddddd --y=year,m=month,d=day
  28.  
  29. Money:
  30.    Money is treated exactly as double, but is rounded to 2 decimal places
  31.    before being written.
  32.  
  33. Serial:
  34.    Serial fields are automatically filled before an 'add' instruction (not
  35.    before updates), by the system--the number starts with 0 (unless specified
  36.    otherwise in the schema) and increments on each successive add.  It never
  37.    decrements (even if a record is deleted), nor is the same number ever used
  38.    twice.
  39.  
  40. Phone:
  41.    Phone number fields are stored as pure text; there's only a special field
  42.    because scn_phone() and fmt_phone() are there, and it's awfully convenient.
  43.  
  44.  
  45. RELATION FORMAT ---------------------------------------------------------------
  46.  
  47.  
  48. Pos  #/Bytes   Description
  49.  
  50.   0   1.......(char)50 : 5.0 signature
  51.   1   1.......Unused in MB 5.0 (was number of users on the system, 0 == none)
  52.   2   2.......Unused in MB 5.0 (was PID of temporary lock, 0 == none)
  53.   4   2.......Unused in MB 5.0 (was PID of exclusive lock, 0 == none)
  54.   6   4.......Pointer to fields' decriptions  => :A
  55.  10   4.......Pointer to indices' decriptions => :B
  56.  14   4.......Pointer to record 0             => :C
  57.  18   4.......Number of records
  58.  22   4.......Next serial field value
  59.  26   2.......Number of fields
  60.  28   2.......Number of indices
  61.  30   4*I.....Pointers to index-heading records (top rcd in each tree)
  62.  A:   var*F...Fields' descriptions:
  63.                  byte    0 : Type (0-10, as listed above)
  64.                  bytes 1-2 : Size (short/ used only for char fields)
  65.                  bytes 3-? : Name (max len = 20, terminated by '|')
  66.  B:   var*I...Indices' descriptions:
  67.                  byte    0 : Type (0-1, 0==nodups, 1==dups)
  68.                  bytes   1 : Number of fields in this index
  69.                  bytes 2-? : Name (max len = 20, terminated by ':')
  70.                        --- : Each field's sequential # (as short, 0-based)
  71.       1.......Separator ('\n')
  72.  
  73.  ?:   128.....Unused in 5.0 (reserved space for later MB versions)
  74.                 (at runtime, this position is pointed to by {rel->hack})
  75.  
  76.  C:   var*R...Records:
  77.                  13 bytes for each index: Index information
  78.                     Bytes  0-3 : Left-child (record #)
  79.                     Bytes  4-7 : Right-child (record #)
  80.                     Bytes 8-11 : Parent (record #)
  81.                     Byte    12 : Balance (';'=-2 '<'=-1 '='=0 '>'=1 '?'=2)
  82.                  recsize bytes: Record information (no field separators)
  83.                  1 byte separator ('\n')
  84.  
  85.  
  86. LOCKFILE FORMAT ---------------------------------------------------------------
  87.  
  88.  
  89. There is exactly one lockfile for each relation, kept in a common temporary
  90. directory.  You can delete the lockfile at any time, as long as you're sure
  91. there is no one using the relation at the time (this would be a Bad Thing to
  92. delete if the relation is in use).  Deleting the lockfile will erase any
  93. remaining exclusive lock, and reset the number of users on the relation to
  94. zero.
  95.  
  96. Pos  #/Bytes   Description
  97.  
  98.   0   2.......Number of users on relation, 0 == none
  99.   2   2.......PID of exclusive lock, 0 == none
  100.   4   6.......Three hacklock PIDs (see lock.dox)
  101.  10  60.......Thirty temporary-lock queue positions (see lock.dox)
  102.  70  30.......Thirty temporary-lock strobes (see lock.dox)
  103.  
  104.