FrontBase logo

FrontBase Documentation

FrontBase logo

Backtrack:
  Welcome!
    4. Administering a FrontBase Server
      4.3. Adminstration Tools
Updated: 20-Nov-2000
prevnext
Table of Contents

4.3.3. sql92

sql92 is a command line tool for execution of SQL 92 statements.

Command syntax

sql92 <options> [<filename>]

If a filename is specified, sql92reads and executes 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:

-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 <encoding> Input encoding. The <encoding> argument specifies the encoding of the input files. The default is UTF8 which will also accept us-ascii.

General

A sql92 command is always terminated by a ';' character. When you type input to sql92 it will not interpret the statement until a ';' character is input. This allows a 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 typically deal 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 are thus part of the verbose output. Lines beginning with the character '>' are also regarded as comments, but are 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 where the output of the script is the same as the input, simplifying regression testing.

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.

Commands interpreted by sql92:

Connect

Syntax:

CONNECT TO <database-name>
    [DATABASE_PASSWORD <database-password>]
    [ON <database-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, the local host is assumed. The connection is named with <connection-name>, which is also used as prompt value. If the connection name is not 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 sql92.

The second form establish the default connection.

Create Database

Syntax:

CREATE DATABASE <database-name> [ON <host-name>];

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.

Define Blob and Define Clob

Syntax:

DEFINE BLOB <blob-name> LENGTH <length> VALUE {<hex-bytes>};
DEFINE CLOB <clob-name> LENGTH <length> VALUE {<hex-bytes>};

Define a blob (or clob) object with the name <blob-name> (or <clob-name>), 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 white space (newlines, tabs, spaces, etc.). The blob (or clob) object is defined and can be referenced in subsequent SQL 92 statements. A reference has the form @'<blob-name>' (or @'<clob-name>') and will create the blob (or clob) object for that particular column. The blob (or clob) object will disappear when the next commit or rollback is executed.

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 local host is assumed.

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 and Quit

Syntax:

EXIT
QUIT

Exits sql92. The EXIT and QUIT commands are the only ones that do not need 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 <password>. 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 <new-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 local host is assumed.


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.