This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
oaenv:home [2009/12/07 18:26] tdo |
oaenv:home [2012/10/26 14:46] (current) |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| {{page>:top_add&nofooter&noeditbtn}} | {{page>:top_add&nofooter&noeditbtn}} | ||
| - | <html><div align="center"><span style="color:red">DRAFT</span></div></html> | + | |
| ====== OMNIDEX Environment Catalog Syntax ====== | ====== OMNIDEX Environment Catalog Syntax ====== | ||
| The Omnidex Environment Catalog is the starting point for constructing an Omnidex application. It is the primary source of information used by Omnidex to access a database and the Omnidex indexes. | The Omnidex Environment Catalog is the starting point for constructing an Omnidex application. It is the primary source of information used by Omnidex to access a database and the Omnidex indexes. | ||
| + | |||
| + | * [[oaenv:examples:home | Sample Environment Catalogs]] | ||
| An Environment Catalog is a collection of information, objects that include descriptions of databases, tables, columns and indexes, as well as Omnidex specific information like optimization options and configuration details. Omnidex uses this information to determine how to access the databases. It can also store supplemental information about the databases, that can enhance Omnidex's ability to optimize queries. | An Environment Catalog is a collection of information, objects that include descriptions of databases, tables, columns and indexes, as well as Omnidex specific information like optimization options and configuration details. Omnidex uses this information to determine how to access the databases. It can also store supplemental information about the databases, that can enhance Omnidex's ability to optimize queries. | ||
| Line 11: | Line 13: | ||
| In the case of flat-file databases, the Environment Catalog plays a special role. Since plain flat-files rarely have meta-data stored in them, Omnidex acts as the database management system, using the Environment Catalog to describe the tables and columns and their relationships to each other, there by allowing standard SQL, ODBC and JDBC access to the data. | In the case of flat-file databases, the Environment Catalog plays a special role. Since plain flat-files rarely have meta-data stored in them, Omnidex acts as the database management system, using the Environment Catalog to describe the tables and columns and their relationships to each other, there by allowing standard SQL, ODBC and JDBC access to the data. | ||
| + | |||
| ===== Create an Environment Catalog ===== | ===== Create an Environment Catalog ===== | ||
| An Omnidex Environment begins as an environment source file, a text file containing all the environment definitions, then is compiled into a binary file, the Environment Catalog used by Omnidex. | An Omnidex Environment begins as an environment source file, a text file containing all the environment definitions, then is compiled into a binary file, the Environment Catalog used by Omnidex. | ||
| Line 253: | Line 256: | ||
| == TABLE table_name == | == TABLE table_name == | ||
| - | |||
| - | table_name | ||
| table_name represents a non-ambiguous table or view name. table_name must be unique within the database statement but can be ambiguous within the environment. However, any reference to an ambiguous table_name in an application will have to be qualified by the database name: database_name.table_name | table_name represents a non-ambiguous table or view name. table_name must be unique within the database statement but can be ambiguous within the environment. However, any reference to an ambiguous table_name in an application will have to be qualified by the database name: database_name.table_name | ||
| Line 380: | Line 381: | ||
| [CARDINALITY n] | [CARDINALITY n] | ||
| + | == COLUMN column_name == | ||
| + | |||
| + | [[[environment_name.]database_name.]table_name.]column_name[(start, length)] | ||
| + | |||
| + | column_name represents a non-ambiguous column or portion of a column. | ||
| + | |||
| + | column_name MUST BEGIN WITH A LETTER, A-Z (case insensitive) and may contain up to 32 characters including letters, numbers and allowed special characters. | ||
| + | |||
| + | If column_name contains any reserved words or allowed special characters, it must be enclosed in single or double quotes. | ||
| + | |||
| + | start is the starting byte within column relative to one. | ||
| + | |||
| + | length is the number of characters after the starting byte to include. | ||
| + | |||
| + | |||
| + | |||
| + | == INTERNAL == | ||
| + | |||
| + | The INTERNAL section is Required, however the keyword INTERNAL is optional. It is a section identifier for the INTERNAL section of the COLUMN definition. INTERNAL refers to the actual data as it is stored in the DBMS. | ||
| + | |||
| + | Use of the keyword when also using an Omnidex section improves the readability of the Environment Catalog source code. | ||
| + | |||
| + | |||
| + | |||
| + | == DATATYPE datatype_spec == | ||
| + | |||
| + | Required. Declares the data type format of the defined column. The DATATYPE keyword is required. See Supported Datatypes for a list of supported datatypes. | ||
| + | |||
| + | |||
| + | |||
| + | == LENGTH n == | ||
| + | |||
| + | Required. Declares the storage length (as n) of the column in bytes. | ||
| + | |||
| + | C String data is terminated by a null character. Therefore, length must be increased by 1 to accommodate the null character. For example, a two character State field defined as a C String will have a length of 3: two for the abbreviated state and one for the null character. | ||
| + | |||
| + | |||
| + | |||
| + | == SCALE n == | ||
| + | |||
| + | Optional. Sets the magnitude of numeric values. OmniAccess does not format data based on SCALE. SCALE is reported in the Environment file and the System Catalog. SCALE is used by the Omnidex ODBC and JDBC drivers as well as for meta-data purposes. | ||
| + | |||
| + | |||
| + | |||
| + | == PRECISION n == | ||
| + | |||
| + | Optional. Specifies the number of decimal places in numeric values. OmniAccess does not format data based on PRECISION. PRECISION is reported in the Environment file and the System Catalog. PRECISION is used by the Omnidex ODBC and JDBC drivers as well as for meta-data purposes. | ||
| + | |||
| + | |||
| + | |||
| + | == FORMAT format_spec == | ||
| + | |||
| + | Optional. Applies to Omnidex date class data types only. This means this setting will only apply to flat file databases, since a flat file database is the only database that will contain an Omnidex date class data type. Refers to the granularity of the date data stored in the database. | ||
| + | |||
| + | This setting DOES NOT affect the appearance of returned data. | ||
| + | |||
| + | |||
| + | |||
| + | == PHYSICAL "native_column_name” == | ||
| + | |||
| + | Optional. This is a quoted string of up to 255 characters that maps the logical column name to the native column's name. This refers to native columns. Expressions and functions are not allowed. | ||
| + | |||
| + | |||
| + | |||
| + | USAGE usage_spec | ||
| + | USAGE [ASCENDING] [AUTO] ROWID | ||
| + | |||
| + | Optional. Defines a column as the id column. Use AUTO for columns where the id value is automatically assigned by the DBMS. Use ASCENDING only when the id value is 100% guaranteed to be sequentially ascending from 1. | ||
| + | |||
| + | |||
| + | |||
| + | CENTURY THRESHOLD n | ||
| + | Optional. Specifies the year cutoff for determining the century in 2 digit years. For example, if the century threshold is set to 60, a 2 digit year of 45 would be translated to 2045 and a 2 digit year of 61 would be translated to 1961. This setting over-rides the century threshold setting in the environment section. | ||
| + | |||
| + | |||
| + | |||
| + | OMNIDEX | ||
| + | Optional. The OMNIDEX section is used to index data in a format other than its native format. The keyword OMNIDEX is a section identifier for the OMNIDEX section of the COLUMN statement and is required if an OMNIDEX section is declared. Definitions in this section apply to the Omnidex indexes only. | ||
| + | |||
| + | This section is used ONLY if you want to override the way the indexes are stored by default. Most applications will not have an OMNIDEX section. | ||
| + | |||
| + | |||
| + | |||
| + | DATATYPE datatype_spec | ||
| + | Optional. Declares the data type format of the defined column. The DATATYPE keyword is required. See Supported Datatypes for a list of supported datatypes. | ||
| + | |||
| + | |||
| + | |||
| + | LENGTH n | ||
| + | Required. Declares the storage length (as n) of the column in bytes. | ||
| + | |||
| + | C String data is terminated by a null character. Therefore, length must be increased by 1 to accommodate the null character. For example, a two character State field defined as a C String will have a length of 3: two for the abbreviated state and one for the null character. | ||
| + | |||
| + | |||
| + | |||
| + | FORMAT format_spec | ||
| + | Optional. Applies to date class data types only. Refers to the granularity of the date data stored in the index files. NOTE: This setting DOES NOT affect the appearance of returned data. | ||
| + | |||
| + | |||
| + | |||
| + | AS "select_item" | ||
| + | Optional. Generates Pseudo-columns using SQL standard expressions and functions, with limitations. Pseudo-columns allows columns to be included in the environment file that do not exist in the native database. | ||
| + | |||
| + | select_item can be an expression or function. The pseudo-column is read/write. | ||
| + | |||
| + | |||
| + | |||
| + | SQL SELECT "string" | ||
| + | Optional. Generates Pseudo-columns using native database functions and expressions. Values are read-only. | ||
| + | |||
| + | Unless the column data can only be generated through native database functions that are not supported by Omnidex, DISC highly recommends that the AS select_item (above) clause be used instead of the SQL SELECT string clause. | ||
| + | |||
| + | SQL SELECT clauses support any of the following tokens that represent the current DATABASE, TABLE or COLUMN. | ||
| + | |||
| + | %d represents the DATABASE wherever it appears in the string. | ||
| + | %t represents the TABLE wherever it appears in the string. | ||
| + | %c represents the COLUMN wherever it appears in the string. | ||
| + | To pass double quotes ( " ) in a rule to the native database, enclose the string in single quotes ( ' ). The converse is true for single quotes. Mixing double quotes and single quotes within strings is not supported. The following illustrates a few valid examples: | ||
| + | |||
| + | SQL SELECT "to_char(%t.%c)" | ||
| + | |||
| + | SQL SELECT "%t.%c + %t.AMOUNT" | ||
| + | |||
| + | SQL SELECT "%t.%c * 1.0725" | ||
| + | |||
| + | |||
| + | |||
| + | PROMPT "string" | ||
| + | Optional. This is a string of up to 32 characters used when setting a prompt for a value for the field. Prompt is for meta-data purposes only. It is not used by Omnidex in any way but is included as meta-data with some info calls. | ||
| + | |||
| + | |||
| + | |||
| + | HEADING "string" | ||
| + | Optional. This is a string of up to 32 characters used when setting a heading or name for a field appearing above the column being reported. Heading is for meta-data purposes only. It is not used by Omnidex in any way but is included as meta-data with some info calls. | ||
| + | |||
| + | |||
| + | |||
| + | == LABEL "string" == | ||
| + | |||
| + | Optional. This is a string of up to 32 characters used when setting a label or name for a field, appearing to the left of the column being reported. Label is for meta-data purposes only. It is not used by Omnidex in any way but is included as meta-data with some info calls. | ||
| + | |||
| + | |||
| + | |||
| + | == CARDINALITY n == | ||
| + | |||
| + | The cardinality of a column is the number of distinct values in the column. This number should be near the actual column cardinality. Omnidex uses this number to better optimize some queries. | ||
| + | |||
| + | |||
| + | |||
| + | |||
| ===== INDEX ===== | ===== INDEX ===== | ||
| + | INDEX index_name | ||
| + | TYPE index_type_spec | ||
| + | AS column_spec [, column_spec...] | ||
| + | [PHYSICAL "native_index"] | ||
| + | |||
| + | == INDEX index_name == | ||
| + | |||
| + | [[environment_name.]database_name.]index_name | ||
| + | |||
| + | index_name represents a non-ambiguous index or view. | ||
| + | |||
| + | index_name MUST BEGIN WITH A LETTER, A-Z (case insensitive) and may contain up to 32 characters including letters, numbers and allowed special characters. | ||
| + | |||
| + | If index_name contains any reserved words or allowed special characters, it must be enclosed in single or double quotes. | ||
| + | |||
| + | If the underlying database contains native indexes for any of the tables defined in the Omnidex Environment Catalog, you must declare these indexes in this section. If not declared, data retrievals will either be performed by serial read or return incorrect data. | ||
| + | |||
| + | |||
| + | |||
| + | == TYPE index_type_spec == | ||
| + | |||
| + | Required when declaring an INDEX index and can declare any one of these values: | ||
| + | |||
| + | INVERTED | ||
| + | HASHED | ||
| + | SORTED | ||
| + | LINKED LIST | ||
| + | |||
| + | |||
| + | == AS column_spec [, column_spec...] == | ||
| + | |||
| + | Required when declaring an INDEX index. This string, up to 32 characters long, uniquely identifies the column defined within the Environment to which the native index corresponds. | ||
| + | |||
| + | |||
| + | |||
| + | == PHYSICAL "native_index" == | ||
| + | |||
| + | Optional. This is a quoted string of up to 255 characters which references the underlying database's native name for the index. | ||
| ===== NODE ===== | ===== NODE ===== | ||
| NODE nodename | NODE nodename | ||
| Line 389: | Line 578: | ||
| CLUSTER table | CLUSTER table | ||
| [PARTITION BY criteria_expression | [PARTITION BY criteria_expression | ||
| + | ===== MESSAGE ===== | ||
| + | |||
| + | [MESSAGE message_name | ||
| + | { [TEXT] "string" | FILE "filespec"}] | ||
| + | |||
| + | == MESSAGE message_name == | ||
| + | |||
| + | Messages are optional. If defining a message, the MESSAGE keyword and message name are required. This is a string of up to 64 characters (or numbers) that uniquely identifies the specified message in the Environment. The message is accessible by the OmniAccess API function call oamessage. | ||
| + | |||
| + | |||
| + | == [TEXT] "string" | FILE "filespec" == | ||
| + | |||
| + | Required. The text sting is a quoted string of up to 255 characters specifying the desired message. The TEXT keyword is optional. | ||
| + | |||
| + | OR | ||
| + | |||
| + | Use an external file that contains a message. filespec is a quoted string up to 255 characters in length and may contain any valid filename as well as appropriate path information and password information. The enclosing quotes may be single or double quotes. The FILE keyword is required. | ||
| + | |||
| + | ===== RULE ===== | ||
| + | |||
| + | [RULE rule_name | ||
| + | {"string" | FILE "filespec"}] | ||
| + | |||
| + | == RULE rule_name == | ||
| + | |||
| + | Rules are optional. If defining a rule, the RULE keyword and rule name are required. | ||
| + | |||
| + | This is an unambiguous name, up to 64 characters and can contain letters, A - Z (case insensitive) or numbers. | ||
| + | rule_name must begin with a letter. | ||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | == "string" | FILE "filespec" == | ||
| + | |||
| + | Required. The string is a quoted string of up to 255 characters defining the "rule". | ||
| + | |||
| + | OR | ||
| + | |||
| + | Use an external file that contains the rule definition. filespec is a quoted string up to 255 characters in length and may contain any valid filename as well as appropriate path information and password information. The enclosing quotes may be single or double quotes. The FILE keyword is required. | ||
| + | |||
| ===== Example - Creating a simple Omnidex Environment Flatfile database with simulated Networked ODBC ===== | ===== Example - Creating a simple Omnidex Environment Flatfile database with simulated Networked ODBC ===== | ||