Database Engines:odbc

Naming conventions for fields and aliases Professional

Due to the nature of ODBC and its capability to connect to a variety of server systems and/or file-based data sources, different rules exist for the naming of symbols. For example, MS Access supports blank spaces in field names. When a field is accessed by its symbolic name using a programming language as Xbase++, the blank space is illegal in the field symbol. Another example is an SQL SELECT statement issued via the USE command. This command has the ALIAS clause to access the used work area via a symbolic alias name lateron. However, this clause is optional and a default alias name is generated from the table name in Xbase++. What is the default alias name when USE receives a complex SQL SELECT statement?

These are just two examples for problems solved by implicit naming conventions applied by the ODBCDBE. If an ODBC driver delivers symbolic names which are illegal in Xbase++, the symbols are converted to legal names according to the following rules:

All non-alpha-numeric characters and all white spaces are replaced with an underscore.
The @ sign is removed when it is the first character in a table name.
Opening and closing square brackets are removed when they are the first and last character in a field name.

Examples

A. White spaces in field names are replaced with an underscore character.

// First field is "Customer Name" 
// Xbase++ symbol is 
? FieldName(1)       // --> Customer_Name 

B. In data dictionary requests without ALIAS clause, the @ sign is removed and the period replaced with an underscore in the default alias name:

USE "@Sales.TABLES" 
? Alias()            // --> SALES_TABLES 

C. Duplicate alias names are not allowed. When the same table is opened multiple times without specifying an alias name, the default alias is composed of the symbolic name, an underscore and the numeric ordinal of the corresponding work area.

USE Customer NEW 
USE Orders NEW 
USE Orders NEW 
? Alias()            // --> ORDERS_3 

D. If the USE command received an SQL SELECT statement, the default alias name is created from the first table name in the select expression and the characters "_DDS" (dynamic dataset) are appended.

cSQL := "SELECT * FROM Customer WHERE Country='US';" 
USE (cSQL) 
? Alias()            // --> CUSTOMER_DDS 

Feedback

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.