The fastest easiest way to get it right.

Columns

Andromeda defines columns differently than you might expect if you are used to hand-coding CREATE TABLE commands. This section explains how this works.

Columns Are Defined Outside of Tables

In regular SQL, a CREATE TABLE command contains the complete description of each column, including the type and, if required, the precision and scale. The major conceptual drawback to regular SQL is that a programmer can deliberately use the same column name in different tables for columns with different types, precisions and scales. This is in itself confusing and can only lead to confusion in code.

In Andromeda a column name is used only once to define a column, and that column is then placed into one or more tables. This ensures that the columns of the same name are always exactly the same in all tables.

Defining a Column

Columns are defined as top-level elements. That means that column definitions have an indent level of zero. Here is an example column definition:

column example:
    description: A Numeric Value
    type_id: numb
    colprec: 10
    colscale: 5

The basic column definition has these properties:

  • The name is always "column -name-:", the keyword column, a space, the name of the column, and a colon.
  • The property description becomes the caption for the column whenever it appears on a form.
  • The property type_id can be any of char, vchar, numb, int, money, or text.
  • The property colprec is the same as SQL's "precision", it means the total number of characters in the value. It applies to char, vchar, and numb.
  • The property colscale is the same as SQL's "scale", it applies only to type "numb" and counts the digits to the right of the decimal. A column that is numb(5,2) will have 5 total digits, 3 to the left of the decimal, and 2 to the right.

Allowed Types

The table be

Type colprec colscale Notes
char Required ignored Equivalent to SQL type 'char'
vchar Required ignored Equivalent to SQL type 'varchar'
int ignored ignored Equivalent to SQL type 'int'
numb Required Required Equivalent to SQL type 'numeric'
text ignored ignored Equivalent to SQL type 'text' or 'clob'
cbool ignored ignored "Character Boolean", accepts Y or N
gender ignored ignored Accepts M, F, or U
date ignored ignored A date-only field (no time)
time ignored ignored A number from 0-1440, minutes since midnight.
datetime ignored ignored Called either 'timestamp' or 'datetime' on various platforms.
money ignored ignored Shortcut for numb(14,2)

User Comments

There are no user comments yet on this page.


Add A Comment

Comments will not appear until after they are moderated. Comments are usually moderated within a few hours on weekdays, but may take longer on weekends and holidays.

Name or nickname: (This will appear with your comment)


Email (this will never be displayed)


Enter your comment here. Use [b] and [/b] for bold, [i] and [/i] for italic, and [pre] and [/pre] for code samples. All literal HTML and PHP that you enter will be escaped out and displayed as you enter it.


Home |  Documentation |  Download |  Credits |  Contact |  Login
Andromeda © Copyright 2004-2010, Licensed under the GPL Version 2