MQL is the Matrix Query Language. Just
like SQL, MQL consists of a set of statements
that help the administrator set up and test a Matrix
database quickly and efficiently. Basically MQL is a tool for building the matrix database.
we can also use MQL to add information to the existing database, and extract
information.
Example of MQL Query:
• Retrieving data into a tcl variable: set var sOut [mql print bus T N R select history]
• Retrieving data from a java program via ADK calls.
• Writing data into a file: print bus T N R select history output d:/temp/TNR_History.txt;
The interactive mode is useful if you have only a few commands to enter or want extensive freedom and flexibility when entering commands. However, interactive mode is very inefficient if you are building large databases or want to input large amounts of information. For this reason, Matrix enables you to use MQL in a script mode. When working in the script (or batch) mode, you use a text editor to build a set of MQL statements. These statements are contained in an external file, called a script, that can be sent to the Matrix command interface. A script passes a batch of MQL statements to the Matrix command interface for processing. The interface then reads the script, line by line, and processes the statements just a sit would in the interactive mode.
temp query bus 'part'
"SOGO1103" * where 'Modified >= 3/6/2015 10:11:37 PM' select
Modified from dump |;
MQL Modes: Interactive, Script and Tcl
Interactive Mode:-
In this mode, we type one MQL Satement at a time. As each statement is entered, our matrix processes it. MQL is not intended to be an end-user presentation/viewing tool, and as a consequence there are cases where some non-ASCII character sets (eg.some Japanese characters) will
have characters that do not display properly in certain cases, such as when a history record
is printed to the console in interactive mode. This is due to low-level handling of the byte
code when attempting to display. However, the data is intact when retrieved in any
programmatic way, such as:
• Retrieving data into a tcl variable: set var sOut [mql print bus T N R select history]
• Retrieving data from a java program via ADK calls.
• Writing data into a file: print bus T N R select history output d:/temp/TNR_History.txt;
The interactive mode is useful if you have only a few commands to enter or want extensive freedom and flexibility when entering commands. However, interactive mode is very inefficient if you are building large databases or want to input large amounts of information. For this reason, Matrix enables you to use MQL in a script mode. When working in the script (or batch) mode, you use a text editor to build a set of MQL statements. These statements are contained in an external file, called a script, that can be sent to the Matrix command interface. A script passes a batch of MQL statements to the Matrix command interface for processing. The interface then reads the script, line by line, and processes the statements just a sit would in the interactive mode.
Script Mode:-
Working in script mode has many advantages, particularly when you are first building a database. Some examples of advantages are:
• You have a written record of all your definitions and assignments. This enables you to
review what you have done and make changes easily while you are testing the
database. When you are first building the database, you may experiment with
different definitions to see which one works best for your application. A written
record saves time and aggravation since you do not have to print definitions when
there is a question.
• You can use text editor features to duplicate and modify similar definitions and
assignments. Rather than entering every statement, you can copy and modify only the
values that must change. This enables you to build large and complicated databases
quickly
• Testing and debugging the database is simplified. MQL databases can be wiped clean
so that you can resubmit and reprocess scripts. This means that you can maintain
large sections of the MQL statements while easily changing other sections. Rather
than entering statements to modify the database, you can simply edit the script. If you
are dissatisfied with any portion of the built database, you can change that portion of
the script without eliminating the work you did on other portions. (If you were
working interactively, you would have to track what had and had not changed.) Since
the script contains the entire database definition and its assignments, there is no
question as to what was or was not entered.
Tcl Mode:-
With Tcl (tool command language) embedded in MQL, common programming features such as variables, flow control, condition testing, and procedures are available for use with Matrix. The Tk toolkit is also included. Tcl and Tk are widely available and documented. The information in this section is simply an overview of functionality.