Some of the 4GL program elements have to be referenced by name in statements and specifications. The table below lists the most common application entities that need names, or identifiers, specification:
program entity |
identifier specification |
functions and their arguments |
FUNCTION statement |
program variables |
|
reports and their arguments |
REPORT statements |
screen arrays |
ATTRIBUTE form file section or graphical form file properties section |
screen forms |
OPEN FORM statement |
screen records |
INSTRUCTIONS form file section or graphical form file properties section |
statement labels |
LABEL statement |
table aliases |
TABLES form file section or graphical form file properties section |
windows |
OPEN WINDOW statement |
Besides the entities given above, the names are needed for database objects and SQL entities.
A program entity identifier is a character string, created with the following rules being taken into considerations:
To use non-ASCII characters, you should set up the CLIENT_LOCALE so that they are specified in the locale code set. In Asian locales with non-alphabetic symbols (Chinese, Japanese, etc.) 4GL identifiers don’t have to start with a letter.
Rules of SQL identifiers specification are mostly similar to those of the 4GL identifiers and correspond to generally applied rules for SQL identifiers.
Querix 4GL allows SQL identifiers to include non-English characters, if they are supported by the system locale settings, the database and its connectivity tools.
SQL identifiers may match 4GL identifiers, but in this case their scopes of reference should be kept in mind carefully in order to prevent unexpected performance.
By default, a prepared object or a cursor is visible from the DECLARE or PREPARE statement where it occurs to the respective FREE statement or to the end of the module where it is specified. The DECLARE and PREPARE statements, following the FREE statement in the same module, cannot be used to specify the same name as a previously freed object had.
Any other SQL identifier is of a global scope of reference.
Global database elements (index, column, table, etc.) cannot be referenced, if their database is not opened or is inaccessible. Neither can they be referenced after the application executed the DROP statement with their identifier.
If an application has matching 4GL and SQL identifiers referable in the same context, the 4GL gets the higher precedence. The @ symbol can be placed before the columns and tables names to distinguish them from 4GL identifiers.