Miscellaneous Notes
Table of Contents

How it works, helpful hints


Tools you can use
If you haven't already, I recommend using my Euphoria Database Browser (EDB). It runs on Windows. Check out my web page or the RDS archives for downloads and updates.

Speed
EuSQL is not extremely fast relative to commercial databases, however, there are some things you can do to speed up operations (meanwhile, I'll work on optimizing everything).

How it works
EuSQL needs to have an extra table, named "TABLEDEF" created in the database it is to use. This stores the structures of records in your tables. This is automatically created when you use create_db. It will also create the table "INDEXDEF", which is used to store indices created on tables.

The keys [of TABLEDEF] are the names of the tables, and the first field contains a sequence which describes the structure and field names for each table. Each field is described a sequence with two elements:

  1. The field name
  2. The contents/subfields

The contents of the field could be described by either an empty sequence, or by one or more field names. This way, we preserve the flexibility of deeply nested sequences, while making it easy to use the data.

Other fields [in TABLEDEF] keep track of field datatypes and indices for each table.

Example: Suppose table MAIL contains information about people on a mailing list, where the records have the structure (the first field is actually the table/EDS key, which can also be composed of multiple subfields):

{
  { "ID",   {} }
  { "Name",
        {
         {"First", {}},
         {"Last",  {}},
        }
  },
  { "Address",
          {
           {"Street", {}},
           {"City",   {}},
           {"State",  {}},
           {"ZIP",    {}}
          }
  }
}
Then to refer to a field in a SQL statement (EuSQL is case insensitive):

First Name :  "name.first"
    Street :  "address.street"
   Address :  "address"
          -- actually a sequence:
          -- { Address.Street, Address.City, Address.State, Address.ZIP }
      etc.
Using this method, it is possible to grab a single field, or a more complex, nested sequence of fields.