Terminal monitors interactively enter, edit, and execute individual queries or files containing queries. Terminal monitors also allow operating system level commands to be executed.
Windows: Ingres character-based utilities like Terminal Monitor will display characters correctly only if run under the supplied Ingres command prompt, which has the correct code page and font settings.
UNIX: Ingres character-based utilities like Terminal Monitor will display characters correctly only if the console window on which they are run has the correct code page set, which must match the character set value set in II_CHARSETxx for the database.
There are two releases of the Terminal Monitor:
This appendix describes the line-based release, and includes instructions on how to invoke the Terminal Monitor and issue queries interactively.
For information about the forms-based release of the Terminal Monitor, see the Character-Based Querying and Reporting Tools User Guide.
To access terminal monitors, you must type the following command at the operating system prompt:
sql [flags]
This sql command accepts a variety of flags that define how the Terminal Monitor and the DBMS Server operate during your session.
The following is a list of available flags and their descriptions:
Disables the autoclear function. This means that the query buffer is never automatically cleared; it is as if the \append command was inserted after every \go. This flag requires the query buffer to be cleared using \reset after every query.
Turns off the display of the dayfile (a text file that displays when the Terminal Monitor is invoked).
Suppresses status messages. All messages except error messages are turned off, including login and logout messages, the dayfile, and prompts.
Sets the column separator to the character specified by X. The default is the vertical bar (|).
Defines the user password.
Defines the role name and optional role password. Separate the name and password with a slash (/).
Invokes the terminal monitor with history recall functionality. The recall functionalities include the following:
Browses the line entered.
Erases a character to the left of the cursor.
Retrieves the history of the commands typed in this session.
Erases the line.
Erases the line from the cursor to the end.
Note: The history recall feature is only available on Linux platforms.
In the Terminal Monitor, each query that is typed is placed in a query buffer, rather than executed immediately. The queries are executed when the execution command (\go or \g) is typed. The results, by default, appear on your terminal.
For example, assume you have a table called, employee, that lists all employees in your company. If you want to see a list of those employees who live in a particular city (cityA), enter the following statement:
select name from employee where city=cityA
\g
The query is placed in the query buffer and executed when you enter \g. The returned rows display on your terminal. (If you type \g twice, your query is executed twice.)
Several other operations can also be performed on the query buffer, including:
After a \go command the query buffer is cleared if another query is typed in, unless a command that affects the query buffer is typed first. Commands that retain the query buffer contents are:
\append or \a
\edit or \e
\print or \p
\bell
\nobell
For example, typing:
help parts
\go
select * from parts
results in the query buffer containing:
select * from parts
Whereas, typing:
help parts
\go
\print
select * from parts
results in the query buffer containing:
help parts
select * from parts
This feature can be overridden by executing the \append command before executing the \go command, or by specifying the -a flag when issuing the sql command to begin your session.
Terminal Monitor commands can manipulate the contents of the query buffer or your environment. Unlike the SQL statements that are typed into the Terminal Monitor, terminal monitor commands are executed as soon as the Return key is pressed.
All Terminal Monitor commands must be preceded with a backslash (\). If a backslash is entered literally, it must be enclosed in quotes. For example, the following statement inserts a backslash into the Test table:
insert into test values('\')\g
Some Terminal Monitor commands accept a file name as an argument. These commands must appear alone on a single line. The Terminal Monitor interprets all characters appearing on the line after such commands as a file name. Those Terminal Monitor commands that do not accept arguments can be stacked on a single line. For example:
\date\go\date
returns the date and time before and after execution of the current query buffer.
Terminal Monitor commands include:
Erases the entire query (reset the query buffer). The former contents of the buffer are lost and cannot be retrieved.
Prints the current query. The contents of the buffer are printed on the user terminal.
Windows and UNIX:
\e or \ed or \edit or \editor [filename]
Enter the text editor of the operating system (designated by the startup file). Use the appropriate editor exit command to return to the Terminal Monitor. If no file name is given, the current contents of the query buffer are sent to the editor, and upon return, the query buffer is replaced with the edited query. If a file name is given, the query buffer is written to that file. On exit from the editor, the file contains the edited query, but the query buffer remains unchanged.
VMS:
Enter the text editor. See the VAX EDT Editor Manual. Use the EDT command exit or the sequence of commands, write followed by quit, to return to the Terminal Monitor. If no file name is given, the current contents of the query buffer are sent to the editor, and upon return, the query buffer is replaced with the edited query. If a file name is given, the query buffer is written to that file, and on exit from the editor, the file contains the edited query, but the workspace remains unchanged
Processes the current query. The contents of the buffer are transmitted to the DBMS Server and run.
Prints the current time and date.
Appends to the query buffer. Typing \append after completion of a query overrides the auto-clear feature and guarantees that the query buffer is not reset until executed again.
UNIX:
\s or \sh or \shell
Escape to the UNIX shell (command line interpreter). Pressing Ctrl+D exits the shell and returns to the Terminal Monitor.
VMS:
\s or \sh or \shell
Escape to the command line interpreter to execute VMS commands. The VAX command line interpreter (DCL) is initiated. Subsequently, typing the logout command exits DCL and returns to the Terminal Monitor.
Exits the Terminal Monitor
Changes the working directory of the monitor to the named directory.
Reads the named file into the query buffer. Backslash characters in the file are processed as they are read.
Writes the contents of the query buffer to the named file.
Write/stops writing the subsequent SQL statements and their results to the specified file. If no file name is supplied with the \script command, output is logged to a file called script.ing in the current directory.
The \script command toggles between logging and not logging your session to a file. If a file name is supplied on the \script command that terminates logging to a file, the file name is ignored.
This command can be used to save result tables from SQL statements for output. The \script command in no way impedes the terminal output of your session.
Tells the Terminal Monitor to suppress/not suppress the printing of the resulting data that is returned from the query
Tells the Terminal Monitor to include (\bell) or not to include (\nobell) a bell (that is, Ctrl+G) with the continue or go prompt. The default is \nobell.
Tells the Terminal Monitor to continue statement processing on error or not to continue (nocontinue). In either case, the error message displays. The command can be abbreviated to \co (\continue) or \noco (\nocontinue). The default action is to continue. This command can be used to change that behavior. The default can also be changed by setting II_TM_ON_ERROR. For information about II_TM_ON_ERROR, see the Database Administrator Guide.
The Terminal Monitor has a variety of messages to keep you informed of its status and that of the query buffer.
When logging in, the Terminal Monitor prints a login message that tells the release number and the login time. Following that message, the dayfile appears.
When the Terminal Monitor is ready to accept input and the query buffer is empty, the message go appears. The message, continue, appears instead if there is something in the query buffer.
The prompt >>editor indicates that you are in the text editor.
When non-printable ASCII characters are entered through the Terminal Monitor, the Terminal Monitor replaces these characters with blanks. Whenever this occurs, the Terminal Monitor displays the message:
Non-printing character nnn converted to blank
where nnn is replaced with the actual character.
For example, if you enter the statement:
insert into test values('^La')
the Terminal Monitor converts the ^L to a blank before sending it to the DBMS Server and displays the message described above.
To insert non-printing data into a char or varchar field, specify the data as a hexadecimal value. For example:
insert into test values (x'07');
This feature can be used to insert a newline character into a column:
insert into test values ('Hello world'+x'0a');
This statement inserts 'Hello world\n' into the test table.
On output, if the data type is char or varchar, any binary data are shown as octal numbers (\000, \035, and so on.). To avoid ambiguity, any backslashes present in data of the char or varchar type are displayed as double backslashes. For example, if you insert the following into the test table:
insert into test values('\aa')
when you retrieve that value, you see:
\\aa
The Help statement displays information about a variety of SQL statements and features. For a complete list of help options, see Help in the chapter "SQL Statements."
Important!: In VMS environments, do not type Ctrl+Y and Ctrl+C while escaped to an editor (unless the editor assigns its own meaning to Ctrl+C) or VMS. VMS does not properly signal these events to the initiating process.