------------------
ddb reference card
------------------

 {tab} ← tname  ddb.create  defs    ·   ·   ·   ·   ⍝ Create table.
  {ex} ←        ddb.remove  table   ·   ·   ·   ·   ⍝ Remove table.

{size} ← table  ddb.append  vals    ·   ·   ·   ·   ⍝ Append row(s) to table.
{size} ← table  ddb.retain  rows    ·   ·   ·   ·   ⍝ Retain only selected rows.

 tab   ← {r/w}  ddb.open    table   ·   ·   ·   ·   ⍝ Open table {read/write}.
 defs  ←        ddb.defs    table   ·   ·   ·   ·   ⍝ Field definitions.

 vals  ← table  ddb.get     {rows} fields   ·   ·   ⍝ Get field(s) from table.
{vals} ← table  ddb.put     {rows} fields vals  ·   ⍝ Replace vals in field(s).

where:
    tname   character vector table file name.
    tab     handle for open table.
    table   either file name or handle.
   {size}   shy result: size of file in bytes.
    defs    (name type, shape ...) ...
    vals    vector of field value arrays.
   {rows}   optional boolean row selector.
    fields  simple or nested field name(s).
    {ex}    shy result: table existed.

defs:
    name    character vector field name.
    type    one of: 80 160 320 83 163 323 645.
    shape   +ive fixed axis, -ive variable axis.

-----
Notes
-----
ddb.create  Larg: Appends '.ddb' to file name, if no extension is given.
                  Returns a shy read-write handle.
ddb.remove  Rarg: Does not error if the file does not exist.
ddb.append  Rarg: Cell values for each field.
ddb.open    Larg: Optional access 'r' (default) or 'w'.
ddb.get     Rarg: Simple or nested character vector field name(s). The simple
ddb.put           boolean mask vector applies in parallel to all fields.


Example   tab←'mytab' ddb.create ('name' 80 ¯6) ('age' 83)  ⍝ create table.
-------           tab ddb.append ('Box'  'Cox') (53 49)     ⍝ append values.
                  tab ddb.put    (1 0) 'age' 54             ⍝ replace one item.
                  tab ddb.get    tab.names                  ⍝ get all fields.
              Box   Cox   54 49
                  tab ddb.retain 0 1                        ⍝ delete first row.
                  tab ddb.get    tab.names                  ⍝ get all fields.
              Cox   49
                      ddb.remove tab                        ⍝ delete table.

   Error Message     ACDGOPMT ← Append Create Defs Get Open Put reMove reTain
   -------------     --------
11 BAD FIELD TYPE    ·⎕······   Type not one of: 80 160 320 83 163 323 645.
22 BAD TABLE NAME    ⎕⎕⎕⎕⎕⎕⎕⎕   Table file does/does not exist.
19 READ-ONLY TABLE   ⎕····⎕·⎕   Table opened without 'w' left argument.
19 TABLE OPEN        ······⎕⎕   Too many handles for this table.
06 BAD NAME field    ···⎕·⎕··   Mis-spelled field name.
11 BAD VALUE in ...  ⎕····⎕··   Value type conversion fails.
11 BAD TYPE in ...   ⎕····⎕··   Improper type conversion.
10 BAD SIZE in ...   ⎕····⎕··   Value array too big for field.
04 BAD RANK in ...   ⎕····⎕··   Value rank conflicts with field definition.
11 BAD DEPTH in ...  ⎕····⎕··   Value depth conflicts with sign of field type.

Back to: Contents