Reference: see Appendix B about the SQL statements supported by Ovrimos. |
---|
<Ovrimos root dir>/bin/sqlapp4 <host-computer>|localhost <database name>|<SQL port number> <user> <password> <[script]>
or, alternatively
<Ovrimos root dir>/bin/sqlapp4
[-server <server>|localhost]
[-db <db>|<portnum>]
[-user <userid>]
[-passwd <passwd>]
[-script <input>]
[-ciphersuites <ciphersuites>]
[-cert <certfile>]
[-key <keyfile>]
[-trust <casfile>]
<host-computer> : either the name of the computer with the installed product or its IP
address. It may also be localhost if Ovrimos is running on
the user's computer.
<SQL port number> : as an alternative to the database name you can enter the SQL port number
corresponding to the database.
<[script]>: this is optional. In case all the SQL statements you want to execute are
included in a script, you enter its path and name.
<ciphersuites> : the security level. May be something of the form HIGH:MEDIUM:LOW:EXP
<cert> : The file where the certificate resides. For example cert.pem
<key> : The file where the encryption key resides.
<trust>: The file where the trusted CAs resides. For example cas.pem.
At first time installation, the only available user is admin with User Name admin and password pegasus .
It is not obligatory to have SQL Query Tool under <Ovrimos root dir>/bin directory. Since it
doesn't need any client-side installation, it can be copied into any directory and run from any
host computer. When running SQL Query Tool, a file named session.log
is generated automatically in the current directory.
SQLAPP4 Session opened 1999-11-04 12:54:17 local time for admin on server10 Type ':help;' for help on directives SQL(1) |
Output on user's screen after invoking SQL Query Tool. It is assumed that user
admin has logged in 'server10'
To exit SQL Query Tool you should type quit;.
To control SQL Query Tool's operation, a list of available directives is provided by typing :help; as shown below.
:<directive>?; shows the current value of each directive.
:info on; provides detailed information about how Ovrimos executes each SQL
statement. If the directive info is on, an execution plan is displayed
for every SQL statement you execute. To turn off this option, type :info off;.
The directive :bloblength <length>; instructs SQL Query Tool to display the contents of all LONG columns (LONG VARBINARY and LONG VARCHAR) as if they were ordinary CHAR or BINARY data of the length specified. The default length is 0 (zero) which means that no data are displayed.
SQL(1) :help;
Directives are :cursor <name>; :navigation on|off; (permits scrolling through the cursor or normal tabular output) :pause; (waits for keypress) :pause on|off; (waits between rows in tabular output) :bloblength <length>; (length to retrieve for BLOBS - default=0) :info on|off; (shows execution plan) :cgi [bare|table|list|select]; (output format in cgi scripts) and also ":<directive>?;" to display current value @somefile; reads from file 'somefile' |
---|
Available directives for controlling SQL Query Tool's operation.
SQL(1) select CNAME, CITY from customers where CID<=2006;
Column 0: 'CNAME' varchar(30) nullable Column 1: 'CITY' varchar(20) nullable CNAME |CITY -----------------------------+------------- 'Hanson' |'Helsinki' 'Gerard' |'Athens' 'Longman' |'Rome' 'Gable' |'London' 'Conrad' |'Helsinki'SQL(1) |
---|
Example of interactive operation: a SELECT statement has been executed and the results are displayed on the screen.
When you exit SQL Query Tool, the last uncommitted transaction will be committed.
The directive !<new statement> opens a new statement handle.
The directive :pause; suspends processing of an SQL script. To continue the script's execution, press Enter.
When you exit SQL Query Tool, the last uncommitted transaction will be committed.
Below is an example of sql script execution.
SQL(1) @e:
ovrimos
test.sql;
select CID, CNAME, CITY from customers; Column 0: 'CID' integer nullable Column 1: 'CNAME' varchar(30) nullable Column 2: 'CITY' varchar(20) nullable CID | CNAME | CITY ---------+--------------------------------+--------- 2001 |'Hanson' |'Helsinki' 2002 |'Gerard' |'Athens' 2003 |'Longman' |'Rome' 2004 |'Gable' |'London' 2006 |'Conrad' |'Helsinki' 2007 |'Carlton' |'Paris' 2008 |'Peterson' |'New York' insert into customers (CID, CNAME, CITY, RATING, SID) values (2009, 'Holmes', 'Berlin', 300, 1005); 1 row inserted update customers set CITY='Zurich' where CID=2001; 1 row updated select CID, CNAME, CITY from customers where CITY='Berlin'; Column 0: 'CID' integer nullable Column 1: 'CNAME' varchar(30) nullable Column 2: 'CITY' varchar(20) nullable CID |CNAME |CITY ----------+-----------------------------+----------- 2009 |'Holmes' |'Berlin'SQL(1) |
---|
Output on user's screen after the SQL script test.sql has been executed
If you have specified :navigation off; (default status),
all the retrieved rows are displayed.
If you have specified :navigation off; and :pause on;, then, one row at a
time is displayed. By pressing Enter, you can fetch the next retrieved row.
When the directive navigation on; has been specified, the user has the following options: fetch the first row of the
result set (type f), move to the next retrieved row (press Enter or type
n), move to the previous row (type p), fetch the last row of the result
set (type l). In any of these options, only one row is displayed at a time.
To name a cursor, use the directive :cursor<name>;. To quit the cursor, type
q.
The script's results which appear on the browser's window can be formatted by using the :cgi directive with one of the optional parameters bare | table | list | select. These optional parameters determine the HTML formatting to be used. Default option is table.
The following sample SQL scripts demonstrate the use of the :cgi; directive. The output of each script on user's browser is shown in the corresponding figure.
Alternatively, you can view their results yourself (e.g. the output of planet1.sql):
Reference: Chapter 8 provides additional information about the HTTP server and the dynamically produced Web content. |
---|
planet1.sql - Displaying results in table, bare (plain text) or list format. |
--!<h1>Planets and Satellites</h1> --!<h3>Table of the planets</h3> :cgi table; select name, serial, descr from planets order by serial; --!<p> :cgi bare; select descr from planets where name='Saturn'; --! is the select serial from planets where name='Saturn'; --!th planet from the sun. --!<p>Here are some of the planet's satellites: --!<UL> :cgi list; select name from satellites where planet='Saturn'; --!</UL>
Figure 9.1 shows the results of executing the above script.
planet1.sql - Comments on the script's listing |
;
--!
, providing an easy
way to insert verbatim HTML in the SQL script.
Similarly, you may execute a script that displays the results in menu form.
planet2.sql - Displaying results as a list of choices |
--!<h1>Planets of the solar system</h1> --!<p><h3>Select the planet you want to find out more --!information about</h3> -- This demonstrates output in menu form. --!<form method=get action="planet3.sql"> :cgi select; --!<select name="planet"> select name from planets order by 1; --!</select> --!<input type=submit value="Fetch more data"> --!</form>
Figure 9.2 shows the results of executing the above script.
When selecting the menu item (planet) for which to fetch more data, one more script, planet3.sql will be executed.
planet3.sql - Fetched data on a selected planet, after planet2.sql is executed |
--! <h3>Data on {planet}</h3> -- This demonstrates bare output. :cgi bare; --! The planet {planet}, " select descr from planets where name='{planet}'; --! ", the # select serial from planets where name='{planet}'; --! planet from the sun orbits select distance_mmiles from planets where name='{planet}'; --! million miles away.<hr> select image(big_pic) from planets where name='{planet}';
Figure 9.3 shows the results of executing the above script.
planet2.sql and planet3.sql - Comments on scripts listing |
--
and are therefore ignored.