OdxSQL is a console program used for creating and maintaining Omnidex environments, testing installations, prototyping queries, and exporting data. OdxSQL supports many functions designed to assist in creating fully optimized installations and queries including benchmarking and for executing explain plans to determine query performance.
OdxSQL allows the interactive or script processing of OdxSQL commands and Omnidex SQL Statements.
OdxSQL allows the interactive specification of Omnidex SQL statements as well as OdxSQL specific commands. OdxSQL is primarily used to:
OdxSQL connects to either an Omnidex Environment which can either be specified as a run time argument or via the CONNECT command once OdxSQL is running.
Run OdxSQL from the command line with the following syntax:
os>odxsql [Omnidex_Environment_filespec] | [-help | -? ] [ -version ] [ -use=filespec ] [ -cmd='cmd1;cmd2' ] [ -where='criteria' ] [ -exit ] [ -exit_on_error ] [ -nobanner ] [ -cloa ] [ -odbc ] [ -jdbc ] [ -odxnet [=port] ]
Type help at the command prompt with no arguments to see an alphabetical list of ODXSQL commands.
>help
…
Type help with the argument 'syntax' at the command prompt to see a list of commands with their syntax.
>help syntax
…
Type help followed by a specific command to see additional information about that command.
>help connect CONNECT Connect to an environment file Syntax: Connect [TO] filename [AS [user]/[password]] [WITH options]
See HELP in the OdxSQL Commands section for more information.
OdxSQL is used to process a wide range of Omnidex SQL Statements and OdxSQL specific commands.
The OdxSQL Commands and Omnidex SQL Statements are organized for quick review as follows:
OdxSQL Commands and Omnidex SQL Statements can be entered into OdxSQL in ether upper or lower case.
> connect myenv
> CONNECT myenv
The syntax for Omnidex SQL Statements entered into OdxSQL or processed in a script file is typically the exact same syntax and returns the exact same results.
There are a few exceptions such as CONNECT and VERSION.
In OdxSQL, CONNECT has two additional options of ON host:port and USING api that are not available in the Omnidex SQL CONNECT Statement. The api is not necessary has it is already known depending on the application type (ODBC or JDBC) and ON
In OdxSQL, the VERSION command displays the OdxSQL header and multiple lines of version information where the Omnidex SQL VERSION statement returns a single line.
The OdxSQL EXECSQL command can be used to verify if an Omnidex SQL Statement is processed exactly the same by OdxSQL as the Omnidex SQL parser.
> VERSION ODXSQL - Omnidex SQL Wed Dec 02 09:20:41 200 ... Omnidex Version 5.0 Build 2B Compilation Timestamp Oct 13 2009 08:57:09 Earliest Compatible ODBC Client 4.3 Build 4B Earliest Compatible JDBC Client 4.3 Build 4B Earliest Compatible Odx Kernel 5.0 Build 1B > EXECSQL VERSION OmniAccess version 50002 >
Setting | Option | Description |
---|---|---|
CURSORDISPLAY | ON/OFF |
>SET CURSORDISPLAY ON
>connect /users/garment.env Connected to /users/garment.env on instance 1, cursor 1
>connect / users/orders.env Connected to /users/orders.env on instance 2, cursor 2
SELECT COMPANY, CONTACT, PHONE FROM CUSTOMERS WHERE STATE='CO' ON CURSOR 2 ... INSERT INTO CUSTOMERS (COMPANY, CONTACT) VALUES ('New Wave', 'Mr. Smith') ON CURSOR 1 ...
Certain aspects of OdxSQL can be controlled through OS environment variables.
Environment Variable | Description |
---|---|
ODXSQL_API | Specifies which API to use: OA (default), ODBC or JDBC. |
OSXSQLHIST | Specifies a different history file for saving OdxSQL history. |
ODXSQLINIT | Specifies a text file of OdxSQL initialization commands. |
ODXSQL_API specifies which API to use, OA (default) or ODBC during this ODXSQL session.
If running ODXSQL on a client machine where the Omnidex server software has not been installed, this variable MUST be set to ODBC, since the OA API does not exist on the client.
Unix
export ODXSQL_API="OA"
Windows
set ODXSQL_API="ODBC"
ODXSQL_HIST_FILE points to an ODXSQL History File. By default, the ODXSQL command history is written to .odxsql_history. Use this variable to write the history to a different file.
Unix
export ODXSQLHIST="myhistoryfile.txt"
Windows
set ODXSQLHIST="myhistoryfile.txt"
ODXSQLINIT points to an OdxSQL Init File. This file can contain initialization settings that will be set when OdxSQL starts. This is very useful for set options.
Unix
export ODXSQLINIT="init_file.txt"
Windows
set ODXSQLINIT="init_file.txt"
OdxSQL is a console application for manually entering Omnidex SQL Statements and OdxSQL Commands or for processing scripts of Omnidex SQL statements.
Use OdxSQL for processing Omnidex SQL Data Definition Scripts to create Omnidex Environments and Indexes.
Use OdxSQL to test Omnidex SQL SELECTs and ODBC, JDBC and Network Services set up.
Use OdxSQL to prototype Omnidex Queries and use the Explain Command to review optimization.
Use OdxSQL on a client computer to access an Omnidex Environment on a remote server via OdxNet to test network response times.
os> odxsql os> odxsql envfile os> odxsql dsnfile -odxnet -odbc os> odxsql -? os> odxsql -use scriptfile
Running OdxSQL Explained:
odxsql | Run OdxSQL. Use the CONNECT command to connect to an Omnidex Environment |
odxsql envfile | Run OdxSQL and connect to the 'envfile' |
odxsql dsnfile -odxnet -odbc | Run OdxSQL and an OdxNET background process and connect to the DSN using ODBC |
odxsql -? | Displays OdxSQL command line options |
odxsql -use scriptfile | Run OdxSQL and read and process the scriptfile of OdxSQL Statements and Commands. |
Internal x [AUTOPSEUDOCOLUMNS <ON | OFF>] x [AUTORECONNECT <ON | OFF>] x [AUTOSUBPROCESS <n | NONE> x [STATISTICS_COMMENT "string"] x [PREPROCESSOR <ON | OFF>] x [PROGRESS <ON | OFF>] x [MEMORY_BASELINE] x [FILE_BASELINE]
SET DEBUG … SET OPTIMIZATION … SET REQUIRED_OPTIMIZATION SET CHAR … SET TIMEOUT … SET REDEFROWIDS … SET PSEUDOCOLUMNS … SET QUALIFY_MODE <ODXFIND | PARSER > SET AUTOPSEUDOCOLUMNS … SET PREPROCESSOR … SET SQL_LOGGING … SET SQL_LOGFILE …
The syntaxes of the SQL Logging SET commands are shown below:
set sql_logging <on | off>
This command activates SQL Logging for this process. By default, statements are logged to the $SQL_STATEMENTS file along with statistics about the execution of the command. The $SQL_STATEMENTS file is named “sqllog.tdf”, and is located in the same directory as the compiled environment file. This file is a standard tab-delimited file, and may be easily imported into other applications. The file may be flushed by simply removing the file; the file will be automatically recreated the next time logging is activated.
set sql_logfile <filename>
This command redirects the SQL logging for this process to a text file that only contains the statement, and does not contain any statistical information. If the file already exists, it will be appended to rather than overwritten.