Tips_namingconventions   >   Column Names

Column Names

Column names are used for list and row datatype variables. In this document if list is specified you can usually assume we are talking about lists or rows.

Lists can have up to 400 columns. Column names are case-sensitive (at least you should assume they are).

Lists can be defined two different ways:

List Column Names

Lists which are defined from schema classes that are mapped to database tables will use the database column names.

Schema classes which are not mapped to the database (_listdef suffix) use lowercase column names. This is done to make it obvious to developers it is an internal list. Using lowercase column names also prevents code errors caused by case sensitive typos. (e.g. ListVar.SqlClassName vs. ListVar.SQLClassName can cause an error.)

Lists which contain data from Omnis class or object properties use the property name prefixed with the appropriate type.

For example of a list of methods would be defined as follows:

; Define the list
Do MethodsList.$cols.$add('classname',kCharacter,kSimplechar,100)
Do MethodsList.$cols.$add('methodname',kCharacter,kSimplechar,100)
Do MethodsList.$cols.$add('methodref',kItemref)

; Build the list of methods
Do rClass.$appendlist(MethodsList,rClass().$name,rMethod().$name,rMethod.$ref)

As you can see the class name is differentiated from the method name by prefixing the 'name' property as appropriate. In the past I did not prefix the Omnis properties with the appropriate type and it made the code very difficult to read code.

SQL Column Names

The range and variety of naming conventions used for database table and column names is huge. Changing existing database tables and columns is often impossible or not worth the hassle.

This section is provided purely for your information. I have been all over the map on database table and column names over the past years.

The database table naming conventions I am currently using are as follows:

The primary key and foreign key column naming conventions I am currently using are as follows:

Using the _fkey and _pkey suffix makes typing the query join text simple.

WHERE Book_fkey = Book_pkey AND Author_fkey = Author_pkey)

There are several administrative columns which I tend to include in many database tables:

There are several common column syntaxes which I tend to use where applicable.