FrontBase Documentation |
Backtrack: Welcome! 6. Original Documentation |
Updated:
20-Nov-2000
prev next Table of Contents |
sql92 is a command line tool for execution of SQL 92 statements.
Command syntax
sql92 <options> [<filename>]If a <filename> is specified, sql92 reads and executed the SQL 92 statements stored in the named file. If the input file is omitted, SQL 92 statements are read from standard input. All output is written to standard output.
Options:
General
-s Silent. Do not print commands as they are executed. By default, statements are printed when the the input source is not a terminal device. -v Verbose. Print statements as they are executed. -i Ignore. Normally sql92 will exit when an error is encountered. When the ignore option is specified, sql92 does not exit. -e Exit on error. -p Prompt. By default sql92 will prompt for statements when the input source is a terminal device. When the prompt option is specified, sql92 will always prompt. -c Compare. Perform a test, compare the output with the input, write a passed comment if they are equal, and a failed when not. -u Input encoding. The argument specifies the encoding of the input files. The default is UTF8 which will also accept us-ascii.
An sql92 command is always terminated by a ';' character. When you type input to sql92 it will not interpret the statement until a ';' character is met. This allows an SQL 92 statement to span several lines. Most SQL 92 statements are interpreted by the FrontBase SQL server, but a number of commands are interpreted by sql92. These commands are typically dealing with connections to the server and administration of the input files.
Comments start a with '#' character or with the '--' string and is terminated by the end of line. The '#' as a comment delimiter allows you to write interpreters. Comments are considered part of the input and is thus part of the verbose output. Lines beginning with the character '>' is also regarded as comments, but is not regarded as part of the verbose output. Result from executing SQL 92 statements are written with lines beginning with '>'. This allows you to write test scripts, the output of the script is the same as the input, which again makes regression tests a hole lot simpler.
When sql92 is invoked it attempts to execute an initialization file, with the name .slq92rc.sql. sql92 searches the current working directory and the user's home directory.
The following commands are interpreted by sql92:
Connect
Syntax:
CONNECT TO <database-name> [DATABASE_PASSWORD <database-password>] [ON <host-name>] [AS <connection-name>] [USER <user-name>] [PASSWORD <password>]; CONNECT TO DEFAULT;
The first form establishes a connection to the database named <database-name> with the optional database password <database-password> on the host named <host-name>. If the <host-name> is not specified localhost is used. The connection is named with the connection name, which is also used as prompt value. If the connection name is specified, the connection is named with the name of the database name and the name of the host. The <user-name> specifies the authorization identifier used for the SQL 92 session established If the <user-name> is not specified the login name of the host operating system is used. The <password> specifies the user password. The connect command is an SQL 92 statement but is interpreted by slq92.
The second form establish the default connection.
Create Database
Syntax:
Create a new database with the name <database-name> on the host with the name <host-name>. If the host name is not specified the name of the local host is used.CREATE DATABASE <database-name> [ON <host-name>];
Define Blob
Syntax:
DEFINE BLOB <blob-name> LENGTH <length> VALUE {<hex-bytes>};
Define a blob object with the name <blob-name> the length <length> in bytes and the value which is a list of <hex-bytes>. A <hex-byte> is two hexadecimal digits. The list of <hex-bytes> may contain newline and white spaces. The blob object is defined and can be reference in subsequent SQL 92 statements. A reference has the form @'<blob-name>' and will create the blob object for that particular column. Blob objects are not intended to be created by hand, but is usually a result from debug output from the EOF adaptor or other tools. The blob object will disappear when the next commit or rollback is executed.
Define Clob
Syntax:
DEFINE CLOB <clob-name> LENGTH <length> VALUE {<hex-bytes>};
As define blob except that the object created is a character string.
Delete Database
Syntax:
DELETE DATABASE <database-name> [ON <host-name>];
Delete the database with the name <database-name> on the host with the name <host-name>. If the host name is not specified the name of the local host is used.
Disconnect
Syntax:
DISCONNECT <connection-name> DISCONNECT CURRENT; DISCONNECT ALL;
The first form disconnects the connection with the name <connection-name>. The second form disconnects the current connection, and the third form disconnects all connections.
Execute
Syntax:
EXECUTE <file-name>;
Reads and executes the sql92 commands from the file named <file-name>.
Exit
Syntax:
EXIT
Exits sql92. The EXIT command together with QUIT are the only ones not needing to be terminated with a ';'.
Quit
Syntax:
QUIT
Exits sql92. The QUIT command together with EXIT are the only ones not needing to be terminated with a ';'.
Set Connection
Syntax:
SET CONNECTION <connection-name>; SET CONNECTION DEFAULT;
The first form makes the connection with the name <connection-name> the current connection. The second form makes the default connection current connection.
Set Database Password
Syntax:
SET DATABASE_PASSWORD [<password>];
Sets the database password to. If <password> is omitted future connections will not require a password.
Set Default
Syntax:
SET DEFAULT LOCKING [OPTIMISTIC | PESSIMISTIC];
Set the default locking discipline that is used when a new session is created.
Set Password
Syntax:
SET PASSWORD [USER <user-name>] [OLD <old-password>] [NEW <new-password>];
Sets the password for the user with the name <user-name>. If the user already has a password it must be specified and the new password <password> is established for the user. If <new-password> is omitted, the user may log in without a pssword.
Show Connections
Syntax:
SHOW CONNECTIONS;
Show all the connections that have been established.
Start Database
Syntax:
START DATABASE <database-name> [ON <host-name>];
Start the database with the name <database-name> on the host with the name <host-name>. If the host name is not specified the name of the local host is used.
Stop
Syntax:
STOP;
Stop the database connected to the current connection.
Stop Database
Syntax:
STOP DATABASE <database-name> [ON <host-name>];
Stop the database with the name <database-name> on the host with the name <host-name>. If the host name is not specified the name of the local host is used.
If you have feedback or questions on this document, please send e-mail to doc-feedback@frontbase.com. Please reference the section number and topic. Thanks!!
©2000 FrontBase, Inc. All rights reserved.