Understanding Recital Databases

From Recital Documentation Wiki
Jump to: navigation, search

Understanding Recital Databases

What Are Database Tables and What Are Free Tables

Databases provide the means of organizing the tables and associated files for a particular application or system. They are implemented as directories with a catalog file which contains information, including full path details, about all the files that belong to that particular database. Opening a database gives an application access to all that database's files - operating system and data dictionary protection and security permitting - in whichever directory on the system they reside and database commands can target the files as a single unit. Databases are searched for in the sub-directories of the directory defined in the DB_DATADIR environment variable set in the recital.conf configuration file.

Free tables are not associated with a database; they are accessed via their physical disk location. To open a free table, the table must be in the current working directory or path or the full path name of the table itself must be specified. Free tables can be added to an existing database using the SQL add table statement.

What is a Cursor

At any given time, a particular cursor is active and selected. When you use a table in a selected cursor, an alias name may be optionally specified. If none is specified, the table basename can also be used as the alias as can the cursor letter A to Z. The alias 'm' is reserved for memory variables and cannot be used to reference a cursor. This alias name gives the cursor an identification, so that you can reference fields in cursors other than the currently selected one, by preceding the field name with the alias name followed by '->' or '.' followed by the field name. This construction is known as an alias pointer.

Each cursor contains the context for the table that has been opened in that cursor. The current record pointer, the current record, the format file, the index files, the filter condition, and the relationships to other cursors. The select command is used to select a particular cursor.