[Top] [Contents] [Index] [ ? ]

The Documentation of LogicSQL

1. Introduction  
2. User's Guide  

2.1 Data Types  
2.2 Functions and Operators  
2.3 SQL Commands  
2.4 System Utility Commands  
2.5 XML Commands  
2.6 Security Model  
2.7 System Information and Information_schema  
2.8 SQL Syntax  
3. Database Administrator's Guide  

3.1 Installation  
3.2 Server Runtime Environment  
3.3 System Configuration  
3.4 Managing Database Server  
3.5 Managing Databases  
3.6 Database User's Management  
3.7 Database Recovery  
3.8 Tutorial for DBA  
4. Interfaces  

4.1 JDBC  
4.2 ODBC  
4.3 Embedded C Pre-compiler  
4.4 The C Language Interface  
5. Development Tools  

5.1 DBA Tools  
5.2 SQL*Face  
6. Database Tests  

6.1 SQL Conform Tests  
6.2 TPC-C Benchmark Tests  
Concept Index  
Bug Report and Contact Infomation  
Copyright (C) 2004 Shanghai Shifang Software, Inc.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1. Introduction

LogicSQL is an object relational database management system implemented with the advanced (formula-lock based) concurrency control protocol.

LogicSQL is designed to provide

  1. a reliable and secure database management system for applications ranging from small business applications to multiple-user, high-volume on-line transaction systems,
  2. cost-effective and easy-to-use database functionality that is compatible with the SQL99 standard and is supported with the standard user interfaces such as the JDBC, ODBC, and embedded C interface,

The functionality of LogicSQL is demonstrated by the Data Types, Functions and Operators, and SQL Commands it supports. In fact, LogicSQL supports

  1. all the basic SQL types, including date, blob, and clob,
  2. the query facility that is as expressive as any other commercial database management systems,
  3. secondary indexes, SQL views, SQL triggers and SQL sequences,
  4. the transaction management facility with the isolation level as high as serializability, and
  5. the security facility based on the discretionary access control mechanism.

The interfaces supported by LogicSQL include

  1. the standard Java interface JDBC,
  2. the standard C interface ODBC,
  3. the standard Embedded C Pre-compiler, and
  4. The C Language Interface.
LogicSQL also provides the following convenient developing tools
  1. DBA Tools, a graphic dba/user interface, and
  2. SQL*Face, an interactive access program.

The TPC-C Benchmark Tests demonstrate that LogicSQL performs extremely well, and in small computer systems, it outperforms almost all other commercial database management systems, thanks to its advanced system architecture. The system is designed to work with limited system resources. In fact, The server takes less than 10Mb disk space and works smoothly for as little as 20Mb memory. With 256 Mb memory, the server can easily handle more than 1000 concurrent clients.

The following table lists a recent TPC-C benchmark testing results. The test is conducted with a server on a Linux box (a PC running Linux with Pentium 3, 1 GHz, and 1 GB memory), and all clients are connected to the server through the Internet with ADSL connection. For comparison, the results for the Oracle 8 are also included. The performance is measured by the number of transactions per minute, the higher the better. The rollback ratio characterizes the ratio of roll-backed transactions over the committed transactions, and the lower the better.
number of
clients
number
warehouses
LogicSQL
performance

rollback (%)
Oracle 8
performance

rollback (%)
10 1 37 0.0 38 6.40
100 10 290 1.60 380 22.22
150 15 362 3.84 291 42.70

The table above demonstrates that LogicSQL outperforms Oracle 8, noting the high rollback ratio of Oracle 8. Since Oracle 8 cannot work smoothly when the number of clients exceeds 200, only three cases are listed here.

The following table lists another TPC-C benchmark testing results with a LogicSQL server running in the same Linux box as above. In the following tests, however, clients are connected to the server through the local network.

number of
clients
number of
warehouses
thinking/keying time
(% of the specified time)
performance
(transactions/minute)
10 1 0 1290
100 10 15 724
250 25 100 664
500 50 100 559
1000 100 100 396
2000 100 200 350

The above table shows that the LogicSQL server installed on a small computer system can easily handle requests from 1000 concurrent clients, which is an impossible task for any other commercial system. (The performance for 10 and 100 clients in this table is significantly higher than that of the previous table. This is because in these two cases we set the thinking time to zero to maximize the working load of the server.) Please note that the above system costs less than US$2000, and thus Price/Performance is around US$4.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2. User's Guide

2.1 Data Types  
2.2 Functions and Operators  
2.3 SQL Commands  
2.5 XML Commands  
2.4 System Utility Commands  
2.6 Security Model  
2.7 System Information and Information_schema  
2.8 SQL Syntax  


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.1 Data Types

Each literal, column value, or a stored procedure's argument manipulated by LogicSQL has a datatype. Each datatype is associated with a set of properties and thus will be treated accordingly.

When you create a table, you must specify a datatype for each of its columns, and when you create a stored procedure, you must specify a datatype for each of its argument.

LogicSQL has a rich set of predefined (base) data types available to users.

The following table summarizes LogicSQL's redefined datatypes.

LogicSQL Type SQL99 Type Description
char(size),
character(size)
char(size), character(size) character string having maximum length size bytes. The maximum size is 4096 (or StringSize as specified in configuration ) and the minimum is 1. The default size (when size is not given) is 1.
varchar(size),
char varying(size),
character varying(size)
varchar2(size)
varchar(size) variable-length character string with the size property the same as char above. Note that the internal data type for all variable-length character strings are varchar(size).
int, integer int, integer integers with value between -2147483648 and 2147483647, inclusive.
smallint smallint integers with value between -32768 and 32767, inclusive.
tinyint tinyint integers with value between -128 and 127, inclusive
bigint bigint integers
numeric(P, S),
numeric(P),
numeric,
number(P,S),
number(P),
number
numeric(P,S) The numeric datatype stores a fixed or floating number with precision P and scale S, where P < 38, and -15 < S < 15, defaults of P and S are 38 and 15 respectively. Note that the internal data type for all the numbers are numeric.
decimal(P, S),
dec(P, S),
real
decimal(P,S), etc. The number datatype stores a fixed or floating number with precision P and scale S, where P < 38, and -15 <S < 15, defaults of P and S are 38 and 15 respectively.
float(P), float float(P), float The number datatype stores a fixed or floating number with precision P and scale S, where P < 38, and -15 < S < 15, defaults of P and S are 38 and 15 respectively. (For now, float is treated the same as numeric.)
date date The datatype stores the date information in a string of form '2000-10-01' with the interval form the same as that of timestamps below.
time time The time type stores the time information in a string of form '18:09:50'.
timestamp timestamp The datatype stores the date and time information in a string of form '2000-10-01 18:09:50'.
blob blob(size) The blob datatype stores unstructured binary large objects. It can store up to 2 gigabytes of binary data, limited by available memory.
clob clob(size) The clob datatype stores single-byte character data. It can store up to 2 gigabytes of character data, limited by available memory.
long long character data of variable length, implemented using clob for backward compatibility
long raw long raw Raw binary data of variable length, implemented using blob for backward compatibility


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.1.1 CHAR Datatype

CHAR datatype specifies a fixed-length character string. When you create a table with a CHAR column, you supply the column length in bytes. LogicSQL subsequently ensures that all values stored in that column have this length. If you insert a value that is shorter than the column length, LogicSQL adds extra white-space, i.e., ' ', up to column length. If you try to insert a value that is too long for the column, LogicSQL returns an error. To compare a CHAR column with a given string, we compare the white-space padded column value with the given string. Therefore, one shall use a white-space padded column string to avoid any confusion.

Consider a table crated and populated by the following statements.

 
create table students (sid char(10), sname varchar(100));
insert into students values( '1234567890', 'Sarah');
insert into students values( '12345', 'Tom');

Then three queries below lead to different result tables.

 
LogicSQL> select * from students;

  sid           sname  
  ---------------------
  12345         Tom    
  1234567890    Sarah  

LogicSQL> select * from students where sid = '12345     ';

  sid           sname  
  ---------------------
  12345         Tom    

LogicSQL> select * from students where sid = '12345';

  sid    sname  
  --------------

Note that the last query fails to select any rows since a non-padded string is used for comparison.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.1.2 Large OBject (LOB) data types

The LOB datatype BLOB, CLOB can store large and unstructured data such as text, image, video, and spatial data up to 2 gigabytes in size. The LOB access methods are based on the following facts.

In general, one can create a table with any number of lob columns, populate the table with empty_clob/empty_blob values, and retrieve lob_locators using the standard CREATE, INSERT, and SELECT statements. But the lob values can be updated and retrieved only by either the C-functions or Java methods.

Consider the table employee created with the following statement

 
CREATE TABLE employee ( 
       e_id integer, 
       e_name varchar(30), 
       photo blob, 
       constraint employee_primary_key primary key( e_id ) 
); 

More examples can be found below


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.1.3 User-defined Data Types


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.2 Functions and Operators

This section describes operators and functions supported by LogicSQL. These functions and operators, including standard arithmetic operators such as addition and subtraction and logicsql operators such as AND and OR as well as less common functions such as char_length and absolute values, are methods of manipulating individual data items.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.2.1 Operators

An operator manipulates a given list of individual data items, called operands, and returns a value (result). Operators are represented by special characters or by keywords. For example, the multiplication operator is represented by an asterisk (*) and the logicsql conjunction is represented by a key word AND.

The list of all operators supported by LogicSQL is summarized in the following table.

Operator Classes Operators
Arithmetic Operators +, -, *, /
String Operators ||
Comparison Operators =, <>, >, <, >=, <=, =<, <=, IS NULL, IS NOT NULL
IN, NOT IN, BETWEEN, NOT BETWEEN, LIKE, NOT LIKE
Logic Operators NOT, AND, OR
SET Operators UNION, UNION ALL, INTERSECT, EXCEPT (MINUS)

We will describe all the operators in details.

Precedence

Precedence is the order in which LogicSQL evaluates different operators in the same expression. When evaluating an expression containing multiple operators, Operators with higher precedence will be evaluated before those with lower precedence. LogicSQL evaluates operators with equal precedence from left to right within an expression.

The following table lists the levels of precedence among SQL operators from high to low. Operators listed on the same line have the same precedence.

Operator Operation
+, - numeric sign
*, / multiplication, division
+, -, || addition, subtraction, concatenation
=, !=, <>, >, <, >=, =<, IS NULL, IS NOT NULL
IN, NOT IN, BETWEEN, NOT BETWEEN, LIKE, NOT LIKE
comparison
NOT logical negation
AND logical conjunction
OR logical disjunction
Table SQL Operator Precedence

Details and examples about how to use these operators shall be here.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.2.2 SQL Functions

Similar to an operator, an SQL function manipulates data items and returns a result. SQL functions differ from operators in the format in which they appear with their arguments. This format allows them to operate on zero, one, two, or more arguments:

function(argument, argument, ...)

If you call a SQL function with an argument of a datatype other than the datatype expected by the SQL function, LogicSQL implicitly converts the argument to the expected datatype before performing the SQL function.

If you call a SQL function with a null argument, the SQL function automatically returns null.

There are two types of SQL functions:

The two types of SQL functions differ in the number of arguments and results returned. A scalar function returns a single result for the given list of arguments; an aggregate function is applied into a group of rows and returns a single result for each group of rows in the queried table.

Scalar functions can appear in select lists (if the SELECT statement does not contain a GROUP BY clause) and WHERE clauses.

Following SQL'99, aggregate functions can appear in select lists and HAVING clauses. If the GROUP BY clause is specified in a SELECT statement, LogicSQL divides the rows of a queried table or view into groups. In a query containing a GROUP BY clause, all elements of the select list which are not aggregate functions or constants must be included in the GROUP BY clause,

If you omit the GROUP BY clause, LogicSQL applies group functions in the select list to all the rows in the queried table or view. The having clause is used to eliminate groups from the output based on the results of the group functions, rather than on the values of the individual rows of the queried table or view.

The following table lists all the LogicSQL aggregate functions as specified in SQL99.

Aggregate Functions Result Returned
COUNT(*) the number of all rows
COUNT(expression ) the number of all non-null values for the given expression
COUNT(DISTINCT expression) the number of all non-null distinct values for the given expression
SUM(expression) the sum of all non-null values for the given expression
SUM(DISTINCT expression) the sum of all non-null distinct values for the given expression
AVG(expression) the average value of all non-null values for the given expression
AVG(DISTINCT expression) the average value of all non-null distinct values for the given expression
MAX(expression) the maximal value of all non-null values for the given expression
MIN(expression) the minimal value of all non-null values for the given expression

Table LogicSQL Aggregate Functions

Nested aggregate functions are not allowed. That is, aggregate functions are not allowed to appear in an expression inside an aggregate function.

Note that DISTINCT inside aggregate functions has not been implemented yet.

Scalar functions can be classified as the follows.

Numeric Functions

Function Result Returned
ABS(n) the absolute value of the numeric expression n
ACOS(n) the arc cosine of n in the range of -1 and 1. The result is in the range of 0 and \pi and is in radians.
ASIN(n) the arc sine of n in the range of -1 and 1.
ATAN(n) the arc tangent of n
CEIL(exps) the smallest integer greater than or equal to the numeric expression exps
COS(n) the cosine of n, where n is an angle expressed in radians
EXP(n) e to the power of n
FLOOR(n) the smallest integer greater than or equal n
LN(n) the natural logarithm of n, where n > 0
LOG(m, n) the logarithm, base m, of n, where m > 0, m != 1, and n >= 0
MOD(m,n) the remainder of m divided by n. It returns m when n = 0.
POWER(m,n) m raised to the nth power.
ROUND(n [,m]) n rounded to m places right to the decimal point; if m is omitted, to 0.
SIGN(n) the sign of n, i.e., -1, 0, or 1, depending if n<0, n = 0, or n > 0.
SIN(n) the sine of n (an angle expressed in radians)
SQRT(n) the square root of n, where n >= 0
TAN(n) the tangent of n (an angle expressed in radians)
TRUNC(n [,m]) n truncated to m decimal places; if m is omitted, to 0 places

Numeric Functions with Char/Datetime Arguments

The following table lists character functions that return number values.

Function Result Returned
ASCII(char) the decimal representation of the first character of char
CHAR_LENGTH(char), CHARACTER_LENGTH(char)
LENGTH(char)
the length of char
INSTR(char1,char2,[,n[,m]]) Searches char1 beginning with its nth character for the mth occurrence of char2
POSITION(char1 IN char2) the relative position of char1 in char2

Character (String) Functions

Function Result Returned
CHR(n) the character having the binary equivalent to n
CONCAT(char1, char2) char1 || char2
EXTRACT(field FROM d) extracted field value from d of date datatype
INITCAP(string) the string with the first letter of each word in uppercase, and all other in lowercase
LOWER(string) the string with all letters lowercase.
LPAD(char1,n [, char2]) char1, left-padded to length n with the sequence of char2
LTRIM(char [,set]) removes characters from char, with all the leftmost chars in set removed.
REPLACE(char, search_string [,replacement_string]) char with every occurrence of search_string replaced.
RPAD(char1,n [, char2]) char1, right-padded to length n with the sequence of char2
RTRIM(char [,set]) removes characters from char, with all the rightmost chars in set removed.
SUBSTRING(char FROM m [FOR n]) (SQL99) a substring of char, beginning at character m, n characters long
SUBSTR(char, m [,n]) it is different from SUBSTRING, but it is the same for now
TRIM([[LEADING|TRAILING|BOTH] [char2] FROM] char1 ) removes characters from char1, with char2 removed from
UPPER(char) char with all letters uppercase

Date and Time Functions

Date and time functions take the input of date/time datatype and returns a value of date/time datatype or an integer/string datatype.

Function Result Returned
ADD_MONTHS(d, n) the date d plus n months.
CURRENT_DATE the current date
CURRENT_TIME the current time
CURRENT_TIMESTAMP the current timestamp
LAST_DAY(d) the date of the last day of the month that contains d
NEW_TIME(d, timezone) d converted into the date/time for the specified time zone.
NEXT_DAY(d, char) the date d the first weekday named by char that is later than d
SYSDATE the current date and time
Date Arithmetic manipulate on the date values

Date Arithmetic

You can add and subtract number constants as well as other dates from dates. LogicSQL interprets number constants in arithmetic date expressions as numbers of days. For example, SYSDATE + 1 is tomorrow. SYSDATE - 7 is one week ago. SYSDATE + (10/1440) is ten minutes from now. Subtracting the HIREDATE column of the EMP table from SYSDATE returns the number of days since each employee was hired. You cannot multiply or divide DATE values.

Because each date contains a time component, most results of date operations include a fraction. This fraction means a portion of one day. For example, 1.5 days is 36 hours.

Cast Functions

Cast functions convert a value from one datatype to another.

Function Result Returned
TO_CHAR(d [,fmt ]) Converts d of DATE datatype to a value of VARCHAR datatype in the
format specified by the date format fmt, which is the same as that of strftime in time.h.
TO_CHAR(n [,fmt ]) Converts n of NUMERIC datatype to a value of VARCHAR datatype. The format is the same as that for printf in stdio.h.
TO_DATE(char ) Converts char of VARCHAR type to a value of DATE/TIME/TIMESTAMP datatype
TO_NUMBER(char) Converts char of VARCHAR datatype containing a number to a value of NUMERIC datatype.

Other Functions

Function Result Returned
CURRENT_USER the current user
USER the current user
NVL(Expr1, Expr2) If expr1 is NULL returns Expr2; otherwise return Expr1


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.2.3 CHR

Function: CHR


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.2.4 INSTR

Function: INSTR


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.2.5 NVL

Function: NVL


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.3 SQL Commands

This section describes, in alphabetical order, LogicSQL commands and statements.

All LogicSQL statements are classified into the following catagories:

Data Definition Language (DDL) statements are used to perform the following tasks

LogicSQL implicitly comments the current transaction after each DDL statements.

Data Manipulation Language (DML) statements are used to retrieve and update data stored in various database objects, including

Transaction Control statements controls the execution of transactions. It contains the following SQL statements

Session Control statements dynamically change the behavior of a user session.

Running Examples Through out this section, we will use a sample database with three tables listed below for demonstration.
 
   student(sid, name, major, gpa)
   course(cid, title, description)
   registration(cid, sid, grade)


LogicSQL> select * from student;

  sid      name     major     gpa  
  -------------------------------
  5500     Susan    Law            
  12001    Sarah    Math           
  12345    Peter                   
  54321    Bob      Buines         

LogicSQL> select * from course; 

  cid      title                   description              
  ---------------------------------------------------------
  AR100    Cartoon Drawing         A commic book            
  BS499    Marketing               How to make quick bucks  
  CS291    Introduction to DBMS    first database course    
  MA101    Calculus                An easy course    

LogicSQL> select * from registration;

  cid      sid      grade  
  ------------------------
  BS499    54321    B      
  CS291    12001           
  CS291    54321    A      
  MA101    12001    D      

The script file to set up the running database is given below.

 
/*
 *  to set up the initial database
 */
DROP TABLE student;
DROP TABLE course;
DROP TABLE registration;

CREATE TABLE student (
	sid    INT,
        name   VARCHAR(64) NOT NULL,
	major  VARCHAR(10),
	gpa    NUMERIC(5, 2),
     	PRIMARY KEY(sid)
);


CREATE TABLE course (
        cid    CHAR(5),
        title  VARCHAR(64) NOT NULL,
        description VARCHAR(1024),
 	PRIMARY KEY(cid)
);

CREATE TABLE registration (
       cid     CHAR(5),
       sid     INT,
     grade     CHAR(1),
     PRIMARY KEY(cid, sid),
     CONSTRAINT cid_foreign_key
       FOREIGN KEY (cid) REFERENCES course,

     CONSTRAINT sid_foreign_key
       FOREIGN KEY (sid) REFERENCES student,

     CONSTRAINT grade_constraint
        CHECK ( grade IN ('A', 'B', 'C', 'D', 'F'))
     
);

INSERT INTO student (sid, name, major) VALUES (12001,'Sarah', 'Math');
INSERT INTO student (sid, name, major) VALUES (12345,'Peter', null);
INSERT INTO student (sid, name, major) VALUES (54321,'Bob', 'Buines');
INSERT INTO student (sid, name, major) VALUES (5500, 'Susan', 'Law');

INSERT INTO course VALUES ('CS291','Introduction to DBMS','first database course');
INSERT INTO course VALUES ('MA101', 'Calculus', 'An easy course');
INSERT INTO course VALUES ('BS499', 'Marketing', 'How to make quick bucks');
INSERT INTO course VALUES ('AR100', 'Cartoon Drawing', 'A commic book');


INSERT INTO registration VALUES('CS291', 12001, null);
INSERT INTO registration VALUES('CS291', 54321, 'A');
INSERT INTO registration VALUES('MA101', 12001, 'D');
INSERT INTO registration VALUES('BS499', 54321, 'B');

The list of All LogicSQL statements.

2.3.1 ABORT  Abort the current operation
2.3.2 ALTER USER  Alter the user password
2.3.3 CLOSE CURSOR  Close a given cusor
2.3.4 COMMIT  Commit the current transaction
2.3.5 CREATE DATABASE  Create a new database
2.3.6 CREATE DATATYPE  To be implemented
2.3.7 CREATE INDEX  Create an index for a given table
2.3.8 CREATE PROCEDURE  Create a stored procedure
2.3.9 CREATE ROLE  Create an authorization role
2.3.10 CREATE SCHEMA  Create tables and views and perform multiple grants in a single transaction
2.3.11 CREATE SEQUENCE  Create a sequence of integers
2.3.12 CREATE TABLE  Create a new table
2.3.13 CREATE TRIGGER  Create a new trigger
2.3.14 CREATE USER  Create a new user
2.3.15 CREATE VIEW  Create a view
2.3.16 DECLARE CURSOR  Declare a session cursor
2.3.17 DELETE  Delete rows from a table
2.3.18 DROP DATABASE  Remove an existing database
2.3.19 DROP INDEX  Remove an existing index
2.3.20 DROP PROCEDURE  Remove a stored procedure
2.3.21 DROP ROLE  Remove an existing role
2.3.23 DROP SEQUENCE  Remove a existing sequence
2.3.24 DROP TABLE  Remove an existing table
2.3.25 DROP TRIGGER  Remove an existing trigger
2.3.26 DROP USER  Remove an existing user
2.3.27 DROP VIEW  Remove an existing view
2.3.28 EXECUTE PROCEDURE  Execute a stored procedure
2.3.29 FETCH  FETCH a row from the result set pointed by the given cursor
2.3.30 GRANT PRIVILEGE  Grants access privilege
2.3.31 GRANT ROLE  Grants roles to users and roles
2.3.32 INSERT  Inserts new rows into a table
2.3.33 OPEN CURSOR  Open a cursor
2.3.34 REVOKE PRIVILEGE  Revoke access privilege
2.3.35 REVOKE ROLE  Revoke roles from users and roles
2.3.36 ROLLBACK  Aborts the current transaction
2.3.37 SET ROLE  Set the role for the current SQL session
2.3.38 SELECT and Subquery  Query the database
2.3.41 SET AUTO_COMMIT  Set the auto_commit on/off for the client
2.3.40 SET SESSION USER  Set the current session user
2.3.39 SET TRANSACTION  Set the isolation level of the current transaction
2.3.42 UPDATE  Update column values of a table


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.3.1 ABORT


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.3.2 ALTER USER


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.3.3 CLOSE CURSOR

See also DECLARE CURSOR, OPEN CURSOR, and FETCH statements.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.3.4 COMMIT


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.3.5 CREATE DATABASE


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.3.6 CREATE DATATYPE

not implemented


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.3.7 CREATE INDEX


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.3.8 CREATE PROCEDURE


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.3.9 CREATE ROLE


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.3.10 CREATE SCHEMA


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.3.11 CREATE SEQUENCE

See also DROP SEQUENCE.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.3.12 CREATE TABLE

Note that one may specify foreign key constraints but they have yet been enforced.

Also note that one cannot create a table with a lob column without specifying its primary key.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.3.13 CREATE TRIGGER


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.3.14 CREATE USER


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.3.15 CREATE VIEW

A view created using a query expression (QE) is updatable if all of the following conditions are satisfied.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.3.16 DECLARE CURSOR

A cursor can be classfified by one of the following properties.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.3.17 DELETE


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.3.18 DROP DATABASE


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.3.19 DROP INDEX

One can not drop an index without CREATE INDEX schema privilege on the schema or CREATE INDEX system privilege.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.3.20 DROP PROCEDURE

See Also: CREATE PROCEDURE


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.3.21 DROP ROLE


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.3.22 DROP SCHEMA

Only a system user (system ) is authorized to use this command.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.3.23 DROP SEQUENCE


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.3.24 DROP TABLE


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.3.25 DROP TRIGGER


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.3.26 DROP USER

You must have the DROP ANY USER system privilege to use this command.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.3.27 DROP VIEW


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.3.28 EXECUTE PROCEDURE


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.3.29 FETCH

If the cursor is not in the open state then an exception is raise: invali cursor state.

See also DECLARE CURSOR, OPEN CURSOR, and CLOSE CURSOR.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.3.30 GRANT PRIVILEGE


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.3.31 GRANT ROLE


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.3.32 INSERT


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.3.33 OPEN CURSOR

See also DECLARE CURSOR, CLOSE CURSOR, and FETCH statements.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.3.34 REVOKE PRIVILEGE


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.3.35 REVOKE ROLE


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.3.36 ROLLBACK


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.3.37 SET ROLE


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.3.38 SELECT and Subquery


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.3.39 SET TRANSACTION


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.3.40 SET SESSION USER


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.3.41 SET AUTO_COMMIT


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.3.42 UPDATE


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.4 System Utility Commands

System Utility statements are LogicSQL commands used by a system user to perform system operations, such as RECOVER DATABASE and SHUTDOWN the server. It is also called System Utility Commands.

2.4.1 SET CHECKPOINT  Set the check point
2.4.2 SET ADMISSION  Set admission control level
2.4.3 RECORD SNAPSHOT  Record the snapshot in the log system
2.4.4 RECOVER DATABASE  Recover the database after crash
2.4.5 SHUTDOWN  Shutdown the database server


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.4.1 SET CHECKPOINT


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.4.2 SET ADMISSION

Note that (1) a system user does not subject to the admission control, and (2) all requests will be rejected if it is not allowed at the current admission control.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.4.3 RECORD SNAPSHOT

Note that (1) a system user does not subject to the admission control, and (2) all requests will be rejected if it is not allowed at the current admission control.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.4.4 RECOVER DATABASE


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.4.5 SHUTDOWN


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.5 XML Commands

( It is currently under development. )

2.5.1 SELECT RETURN  Search the SQL database and return a table
2.5.2 FOR WHERE  
2.5.3 FOR WHERE RETURN  Search the XML database and return an XML document


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.5.1 SELECT RETURN


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.5.2 FOR WHERE


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.5.3 FOR WHERE RETURN

 
  <constructor> ::=  < element constructor> |
                     < xml comment> |
                     < xml processing instruction> | 
                     < c data section>  


  <element constructor> ::= "<" < q name> < attribute list> "/>" | 
            "<" < q name> < attribute list> ">" {< element content>} "</" < q name> ">"


  <element content> ::= < char> |
                        <"{{"> |
                        <"}}"> |
                        < element constructor> |
                        < enclosed expr> |
                        < c data section> |
                        < char ref> |
                        < predefined entity ref> |
                        < xml comment> |
                        < xml processing instruction> 


  <xml comment> ::= "<!--" < string> "-->"


  <xml processing instruction> ::= "<?" < pi target> < string> "?>"


  <c data section> ::= "<![CDATA[" < string> "]]>"


  <pi target> ::= < identifier>


  <predefined entity ref> ::= "&" < IT | GT | AMP | QUOT | APOS > ";"


  <char ref> ::= "&#"< integer> | "x"< hex integer>


  <enclosed expr> ::= { < expr sequence> }


  <expr sequence> ::= { < expr> {, < expr> }


  <expr> ::= Xquery expression


  <q name> ::= [:] < identifier> { : < identifier>}


  <attribute list> ::= {  q name "=" < attribute value> }


  <attribute value> ::=


  <string> ::= {< char>}

  <char> ::=  a specified subset of ASCII letters


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.6 Security Model

LogicSQL implements the discretionary security model as outlined in SQL99.

The discretionary security model governs the access of uses to the information on the basis of the authorization identity and of rules that specify, for each user and object in the system, the types of access the user is allowed for the object.

Assume, for instance, that the database contains a user with the identifier one_hiker, and a table named credit_card under the schema banks.

Without an explicit authorization from the boss as follows:

GRANT SELECT ON banks.credit_cars TO one_hiker,

one_hiker cannot examine the table.

In this example, one_hiker is an authorization identify, banks.credit_card is a database object, SELECT ON is an action. The above statement then grants the access rule, called privilege, that authorizes the selection on the specified table to the user.

LogicSQL provides a set of statements that can be used to grant and revoke authorization for any user to access any database object.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.6.1 Authorization Identity

All accesses to LogicSQL are through SQL-sessions, and thus the security control is through the restrictions on the accesses of SQL-sessions.

An SQL-session spans the execution of a sequence of consecutive SQL-statements invoked by a single user from a single SQL-agent.

The authorization of an SQL-session is then identified by its authorization identity.

Two types of authorization identity are classified:

User Identifier

Each SQL-session has a user identifier called the SQL-session user identifier. When an SQL-session is initiated by a connect statement through any LogicSQL interface, such as SQL*Face or sql_connection in the C-Interface, LogicSQL set the SQL-session user identifier to the user specified in the connection statement.

The SQL-session user identifier is also referenced as the current user (CURRENT_USER) or the session user (SESSION_USER). The value of the current user can be determined by current_user or session_user. It can also be queries by using

SELECT CURRENT_USER FROM INFORMATION_SCHEMA.dual.

Role Name

A role is identified by a role name, and an SQL-session has a set of roles, called the current roles. A role can be granted to a user or a role by a GRANT PRIVILEGE statement. When an SQL-session is initiated, LogicSQL set the default set of current roles as the set of all roles that have been granted directly to the current user.

The set of all roles that have been granted directly to the current user and the set of all roles that have been granted to the current user througth other roles can be viewed in views INFORMATION_SCHEMA.ADMINISTRABLE_ROLE_AUTHORIZATIONS and INFORMATION_SCHEMA.APPLICABLE_ROLES respectively.

Changes of authorization identity

The current user of an SQL-session can be modified by SET SESSION USER statement. The set of current roles of an SQL-session can be changed with SET ROLE statement.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.6.2 Privileges

A privilege is a rule that authorizes a given category of object actions to be performed on a specified database object (by a specified authorization identifier, a user identifier or a role).

A privilege can only be granted to a user or a role by an GRANT PRIVILEGE statement.

A privilege is specified by two elements, i.e., the action to be performed and the database object on which the action will be performed.

The actions that can be specified are

Almost all the information stored in LogicSQL databases are in a form of database objects. For instance, he access to the following objects requires a privilege, i.e., an explicit authorization:

According to its scope, privileges can be classified as

For obvious reasons, the following object and schema privileges are granted to all users on all objects in their own schema, that is, the schema whose owner is the current user.

select, insert, delete, update, create table.

When a user is created, the connect privilege is usually granted. A user, however, cannot connect into the LogicSQL server if ones connect privilege has been revoked.

All privileges can be granted or revoked through GRANT PRIVILEGE and REVOKE PRIVILEGE statements.

Examples

When a LogicSQL database is first established, one super user identifier, named system, is created with all the authority. Without explicit authorization from system, no one else can do anything about the database.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.6.3 Privilege Domains

An SQL-session has a current user identifier and a set of current roles. The privilege domain of an SQL-session contains all privileges granted explicitly to the current user and all current roles. The SQL-session can then perform any operations authorized by the privileges in the privilege domain.

Changing the Privilege Domain

During an SQL-session, the current user can change the privilege domain of the session with the SET ROLE command, which changes the roles currently enabled for the session. One can change the enabled roles any number of times during a session. The number of roles that can be concurrently enabled is limited by the configuration parameter MaxEnabledRoles which is bounded by the compilation constant MAX_ENABLED_ROLES.

The current user can use the SET ROLE command to enable or disable any of the following roles:

One, however, cannot use the SET ROLE command to enable roles that have not been granted either directly or through other roles.

The current privilege domain is also changed in the following cases:

If none of the above conditions occur and one does not issue the SET ROLE command, the current privilege domain remains in effect for the duration of the SQL-session. In the last two cases, the change in the privilege domain does not take effect until the current user log on to LogicSQL again or issue a SET ROLE statement.

You can determine which roles are in the current privilege domain at any time by examining INFORMATION_SCHEMA.ENABLED_ROLES view.

Example I

To enable the role GARDENER for your current session, issue the following statement:

SET ROLE gardener;

Example II

To enable all roles granted to you for the current session, issue the following statement:

SET ROLE ALL;

Example III

To enable all roles granted to you except BANKER, issue the following statement:

SET ROLE ALL EXCEPT banker IV;

Example IV

To disable all roles granted to you for the current session, issue the following statement:

SET ROLE NONE;

All security-related SQL statements are listed below:


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.7 System Information and Information_schema

The Information Schema, named INFORMATION_SCHEMA, is specified by LogicSQL (based on SQL'99), to provide the user all relevant meta data. The schema contains a list of views and base tables that describe detailed information of tables, data types, table constraints, privileges, etc. The views of the Information Schema are viewed tables defined in terms of the base tables of the Definition Schema.

The Information Schema views are defined as being in a schema named INFORMATION_SCHEMA, enabling these views to be accessed in the same way as any other tables in any other schema. SELECT on most of these views is granted to PUBLIC WITH GRANT OPTION, so that they can be queried by any user and so that SELECT privilege can be further granted on views that reference these Information Schema views. No other privilege is granted on them, so they cannot be updated.

For example, any user can access INFORMATION_SCHEMA.TABLES using
 
LogicSQL> select table_schema, table_name,table_type,table_degree 
          from information_schema.tables where table_schema = 'information_schema';

  table_schema          table_name                           table_type    table_degree  
  -------------------------------------------------------------------------------------
  information_schema    administrable_role_authorizations    view          3             
  information_schema    applicable_role_authorizations       view          3             
  information_schema    catalog_name                         view          4             
  information_schema    columns                              view          8             
  information_schema    dual                                 view          1             
  information_schema    element_types                        view          24            
  information_schema    enabled_roles                        view          1             
  information_schema    indexes                              view          5             
  information_schema    key_column_usage                     view          8             
  information_schema    procedures                           view          4             
  information_schema    role_authorizations                  view          3             
  information_schema    schemata                             view          7             
  information_schema    sequences                            view          9             
  information_schema    sqlstate_message                     view          3             
  information_schema    system_property                      view          2             
  information_schema    table_constraints                    view          9             
  information_schema    table_privileges                     view          8             
  information_schema    tables                               view          6             
  information_schema    triggers                             view          15            
  information_schema    users                                view          3             
  information_schema    views                                view          6   

LogicSQL> 

Note: For lack of space, in the printout above, we omitted the column table_type, which is of type view throughout. Also, ad_role_authorizations and app_role_authorizations stand for administrable_role_authorizations and applicable_role_authorizations, respectively

INFORMATION_SCHEMA.TABLES contains one row for each table that is allowed to be selected by the user. This includes the tables in any schema that is owned by the user and tables on which SELECT is granted either to the user or to 'PUBLIC'. As a matter of fact, the above table lists all the views/tables in INFORMATION_SCHEMA that are accessible to any user.

The detailed descriptions of these INFORMATION SCHEMA views are given below (to be completed).


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.8 SQL Syntax

Follow the standard SQL99 syntax.

<identifier> ::= < simple Latin letter> [{ < digit> | < simple Latin letter> | _ }... ]

<password string> ::= a string (a sequence) of letters, numbers, and '_' that shall start with a letter and shall not resemble any sequence of words in any language, and shall at least 5 characters long. Like any string, it should be quoted by two single quotations

<derived column> ::= < item reference> | < set function specification> | < value expression> [ [AS] < correlation name> ]

<set function specification> ::= <COUNT(*)> | < aggregate function( item reference)>

<aggregate function> ::= AVG | MIN | MAX | SUM | COUNT

<set clause list> ::= < column name> = < value expression> [ {, < column name> = < value expression>}...]

<search condition> ::= < boolean value expression>

<value expression> ::= < numeric value expression> | < string value expression> | < boolean value expression> | < datetime value expression>

<unsigned value specification> ::= < literal value> | USER |CURRENT_USER

<string value expression> ::= < value expression primary> || < value expression primary>

<numeric value expression> ::= < term> | < numeric value expression> '+'|'-' < term>

<term> ::= < factor> | < boolean term> '*'|'/' < factor>

<factor> ::= ['-'|'+' ] < value expression primary>| < numeric value function>

<value expression primary> ::= < unsigned value specification>| < item reference>

<numeric value function> See Numeric Functions

<datetime value expression> ::= < datetime term> | < datetime value expression> <'+'|'-'> < integer>

<datetime term> ::= < datetime factor>

<datetime factor> ::= < datetime primary> [AT TIME ZONE < time zone>]

<datetime primary> ::= < datetime literal>| < item reference> | < datetime value function>

<datetime literal> ::= DATE < date string>|< timestamp string> | TIME < time string> | TIMESTAMP < timestamp string>

<date string> ::= <quote><digit><digit><digit><digit>'-'<digit><digit>'-'<digit><digit><quote>

<time string> ::= <quote><digit><digit>':'<digit><digit>':' <digit><digit><quote>

<timestamp string> ::= <quote><digit><digit><digit><digit>'-'<digit><digit>'-' <digit><digit> ' ' <digit><digit>':'<digit><digit>':' <digit><digit><quote>

<datetime value function> See Date and Time Functions

<time zone> ::= BEIJING | GMT | EST | CST | MST | PST | GMT <'+'|'-'> <integer>

<boolean value expression> ::= < boolean term> | < boolean value expression> OR < boolean term>

<boolean term> ::= < boolean factor> | < boolean term> AND < boolean factor>

<boolean factor> ::= [ NOT ] < boolean primary>

<boolean primary> ::= < predicate>

<predicate> ::= < comparison predicate> | < in predicate> | < between predicate> | < like predicate>

<comparison predicate> ::= < value expression> < comparison operator> < value expression>

<comparison operator> ::= = | <> | < |=< | <= | > | >= | =>

<like predicate> ::= < string value expression> [NOT] LIKE < string value expression> [ESCAPE < string value expression>]

<between predicate> ::= < value expression> [NOT] BETWEEN < value expression> AND < value expression>}

<in predicate> ::= < value expression> [NOT] IN ( < value expression> [{, < value expression>} ] )

<relational algebra operator> ::= UNION | UNION ALL | EXCEPT | MINUS | INTERSECT

<table reference> ::= < table primary | joined table>

<table primary> ::= < table name | view name> [ [AS] < correlation name> ]

<joined table> ::= < table reference> [ INNER | <LEFT|RIGHT|FULL>[OUTER] ] JOIN < table primary> [ON < search condition>]

<catalog name> ::= < identifier>

<schema name> ::= < identifier> | < catalog name>.< identifier>

<sequence name> ::= < identifier> | < schema name>.< identifier>

<table name> ::= < identifier> | < schema name>.< identifier>

<cursor name name> ::= < identifier> | < schema name>.< identifier>

<procedure name> ::= < identifier> | < schema name>.< identifier>

<argument name> ::= < identifier>

<variable name> ::= < identifier>

<trigger name> ::= < identifier> | < schema name>.< identifier>

<user name> ::= < identifier>

<view name> ::= < identifier> | < schema name>.< identifier>

<index name> ::= < identifier> | < schema name>.< identifier>

<column name> ::= < identifier> | < table name>.< identifier>

<column list> ::= < column name> [{, < column name> }]

<item reference> ::= < column name>

<constraint name> ::= < identifier >

<correlation name> ::= < identifier >

<privileges> ::= < system privileges> | < schema privileges> | < object privileges>

<system privileges> ::= ALL SCHEMA PRIVILEGES | CREATE ANY TABLE | CREATE ANY VIEW | CREATE ANY INDEX | CREATE ANY TRIGGER | CREATE ANY ROLE

<schema privileges> ::= < schema action> [{< schema action> ...} ] ON < schema name>

<object privileges> ::= ALL PRIVILEGES | < object action> {, < object action> } ON [TABLE] < table name>

<schema action> ::= CREATE TABLE | CREATE VIEW | CREATE INDEX | CREATE TRIGGER

<object action> ::= SELECT | DELETE | INSERT | UPDATE

<trigger event> ::= DELETE | INSERT | UPDATE

<grantee> ::= PUBLIC | < identifier >

<data type> ::= INT | INTEGER |VARCHAR( < integer > ) | NUMBER( < integer, integer > ) | DATE | BLOB | CLOB |LONG| LONG RAW | SQL_IDENTIFIER

<variable list> ::= : variable name | [{<: variable name> ... }]

<variable name> ::= identifier

<signed integer> ::= ['+'|'-'] < integer>

<hex integer> ::= < digit|a| ... |f> [{< digit|a|...|f>}...]

<quote> ::= '

<digit> ::= 0|1|2|3|4|5|6|7|8|9

<simple Latin letter> ::= a|b|c|d| ... |x|y|z

<integer> ::= [+|-] < digit> [ { < digit> ... } ]

<numeric number> ::= [+|-] [ { < digit> ... }] ['.' < digit> [ { < digit> ... }] ] | < integer> E ['+'|'-' < integer>

<literal value> ::= all valid literal values for the data type.

Note that all ASCII characters less than 13 cannot be used in a string literal.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3. Database Administrator's Guide

3.1 Installation  
3.2 Server Runtime Environment  
3.3 System Configuration  
3.4 Managing Database Server  
3.5 Managing Databases  
3.6 Database User's Management  
3.7 Database Recovery  
3.8 Tutorial for DBA  


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.1 Installation

The proper installation of LogicSQL takes the following steps:

Pre-installation

Installation of the System Code

All documents and programs are contained in the directory LogicSQL_Dist in the distribution package. The LogicSQL can be easily installed from the distribution package in the following two simple approaches.

  1. Automatic Installation

    Change into the distribution directory (Distribution) and then start the Java Intaller by entering

    ./auto_run.sh

    A graphic user interface will then be displayed. Follwing the instruction, one can install the system code and set up the values for all the system configuration variables.

  2. Manual Installation

    This is done by simply copying all files and directories in the distriution directory LogicSQL_Dist into the installation directory, which will complete the installation of the system code.

Installation of Application Tools

All development tools and application interfaces can be intalled from LogicSQL_Dist in the distribution package, with or without installation of a LogciSQL server.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.2 Server Runtime Environment

LogicSQL user account As with any other server daemon that is connected to the world at large, it is advisable, though not necessary, to run LogicSQL under a separate user account. This user account should only own the data itself that is being managed by the server, and should not be shared with other daemons. To add a user account to your system, look for a command useradd or adduser. The user name "logicsql" is often used but by no means required.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.3 System Configuration

Before you create the initial database and/or start your LogicSQL server, you must configure the system according to your needs by editing the system configuration file $LOGICSQL/config/logicsql.conf.

The LogicSQL installer used to intall the LogicSQl may also be used to set up desired values for the configuration variables.

In the sequence, by setting a configuration variable to be a specified value, we mean editing the line (or inserting a new line) that contains the variable such that the line will starts with the variable, followed by the value with one white space in between. For example, by setting ServerPort to be 8000, we edit the line that contains ServerPort to the following

ServerPort 8000

The following table summaries the basic task of configuration.

The following table lists the configuration variables that specify the limit of the underling SQL statements.

Note that MaxClients is bound by FD_SETSIZE = 4096, the maximum number of sockets permitted in the system. FD_SETSIZE has been set before the compilation of the system code, and cannot be changed without re-compilation.

The following table list the configuration variables that specify the parameters used by the underlying Berkeley DBs file structures.

All the configuration variables that specify the system limitation can be retrieved from the meta table system.definition_schema.system_limitation, as demonstrated below.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.4 Managing Database Server

.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.4.1 System Creation

The initial database system can be created using

% logicsql -c

This will create the initial database system in the database cluster, and the log files. This will also automatically create a system user named 'system' with the default password 'manager'.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.4.2 Starting the LogicSQL server

You must start the LogicSQL server before anyone can access the database using logicsql.

To start the logicsql, use

% logicsql

Normally, you will want to start the database server when the computer boots up. This is not required; the LogicSQL server can be run successfully from non-privileged accounts without root intervention.

For each database cluster, only ONE database server should be started at any time. A separate LogicSQL user account and the corresponding database cluster must be set up if you wish to run two servers in one computer system.

Command Line Options of logicsql

logicsql is used to create the initial database as well as start the server. It may also take some command line options, as listed below. Note that the command line option will override the configuration values if applicable.

 
logicsql -h

Usage: logicsql [-options]

where options include
   -p <port_number>    specify the port number used by the server, 
                       the default is specifed by the configuation file
   -c                  create the initial database
   -h                  print this message

Server Startup Failures

There are several common reasons for the failure. Some of possible reasons are: the socket is busy with other applications; the inappropriate setup of environment variables. Check the log file db_err.log in the log area for details.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.4.3 Shutting down the LogicSQL server

The LogicSQL server can be shut down with

% shutdown_server

There are several command line options for shutdown_server to specify the port number, user name, host machine, etc. Enter shutdown_server -h for details.

The server can also be shutdown with an SQL command shutdown. (See SHUTDOWN.)

Note that using shutdown_server will not release the database socket used by the server immedicately. If you wish to shutdown and then start the server right way, you may use the SQL statement shutdown instead.

By an SQL command, we mean an SQL statement that can be executed by sending it to a LogicSQL server using any standard SQL interface, such as SQL*Face and/or DBA Tools, while by a system command, we mean a command that can be executed by entering its name and options in your operation system. LogicSQL provides only a few system commands, such as logicsql, shutdown_server, and sqlface, but supports almost all standard SQL commands. Thus, almost all commands introduced below are SQL statements, not a system command.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.5 Managing Databases

A database is a named collection of SQL objects ("database objects"); every database object (schema, tables, function, etc.) belongs to one and only one database. An application that connects to the database server specifies with its connection request the name of the database it wants to connect to. It is possible for an application to access more than one database per connection, as long as the application enjoys the access privilege.

Note: SQL calls databases "catalogs", but there is no difference in practice.

Databases are created and removed with the SQL query language command

CREATE DATABASE

and

DROP DATABASE

respectively.

There are two different ways to store all the database objects in disk files. In the mono-file mode, all the objects of a database will be stored in one disk file of the form: database_name.db, and the multi-file mode, a database will take one directory under the database area, and each database object will be stored as one file under the directory. The mono-file mode is suitable only for those small databases whose objects will take the space less than 2G. For those big databases, you must use the multi-file mode.

The storage mode of a database shall be specified when it is created.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.6 Database User's Management

Managing database users and their privileges is in concept similar to that of Unix operating systems, but then again not identical enough to not warrant explanation.

There are two groups of database users, that is, a group of system users and a group of database users.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.7 Database Recovery

Database recovery concerns the recoverability of the database. There are several components in database recovering, and the most critical component of database recovering is to how to store update logs into a stable storage system.

It is the database administrator's responsibility to make sure the log cluster, i.e., the directory as specified by LogDirectory, is stored in a secured disk system that is separated from the data cluster.

For your convenience, A Typical Recovery Schema is presented at the end of this section.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.7.1 The Schemes of the Backup Logs

LogicSQL provides facilities for storing backup log files at different disk file systems and/or different locations with three different options when initializing the database server with logicsql.

  1. NO_LOG

    There is no backup log and therefore, no recovery is possible.

  2. LOCAL_LOG

    The backup log is stored in the log area of the same computer system. The database can be recovered using the local log tables. Therefore, the log area shall be located in a different disk file system to avoid disk failure.

    The local_log backup schema is very efficient and reliable. Since the backup log is in the same computer system, it is prone catastrophic failures such as fire and earthquake.

  3. STANDBY_DB_LOG This schema stores the backup log in a separate LogicSQL database system, and therefore, increases the recoverability after catastrophic failures.

    In this schema, the standby database system can be set up in anywhere as long as the system is connected to the server by the network. To use this schema, the configuration file must provide the following information for the standby database system, i.e., the the IP address, the port number, and the password of the system, through the configuration variables StandbyDatabaseHost, StandbyDatabasePort, and StandbyDatabasePassword respectively.

  4. BOTH_LOGS

    This is the combination of both LOCAL_LOG and STANDBY_DB_LOG. That is, the update log is stored in the log area of the same computer system as well as in a separate LogicSQL database system, and therefore, it enjoys advantages of both schemas.

The schema of the backup log is specified when initializing the database server using logicsql with an appropriate option. If the STANDBY_DB_LOG is used, please make sure the standby database server is working properly before start the LogicSQL server.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.7.2 The Types of Recovery

A standard recovery process is to redo all updates of committed transactions. The database first scans the log system to construct the list of all committed transactions that need to be redone, and then execute all updates of the transactions in the list.

Depending on the type of crash and the availability of the backup log files. there are different types of recovery

  1. No Recovery There is no need for recoverability and/or there are no backup log files (i.e., NO_LOG was specified when the database was initialized).

    In this case, you can either restart the database or recreate an initial database first and then restart the database using logicsql.

  2. Catastrophic Recovery. A failure that requires catastrophic recovery is a failure where the database has been destroyed or corrupted. For example, catastrophic failure includes the case where the disk drive on which the database has been physically destroyed, or when the systems normal recovery is unable to bring the database to a consistent state. This is often difficult to detect, and perhaps the most common sign of the need for catastrophic recovery is when the normal recovery procedures fail.

    To recover the database into the most recent consistent state after catastrophic failure, the system needs to redo updates of all committed transactions recorded on the backup log system using RECOVER DATABASE SINCE LAST SNAPSHOT.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.7.3 Snapshot of the Database

For crash recovery, it is critical to keep a snapshot of the database that is consistent.

The database state is uniquely determined by two data directories, i.e., Data Cluster and Lob Cluster. Consequently, a snapshot of the database consists of a copy of these two directories. To make a snapshot of the database is thus to make a copy of these two directories. The copying itself is straightforward and system-dependent, which will not be discussed here.

The main concern is how to make a consistent snapshot of the database. That is, we have to make sure the two directories represent a consistent database state before we make the snapshot, and we also have to make sure no database accesses during the coping.

This can be done using a system utility command SET ADMISSION as a system user in three steps.

  1. First, SET ADMISSION LEVEL WITHIN TRANSACTION will enable the system to process only requests from active transactions.
  2. A few seconds later(depending on the load of the system), SET ADMISSION LEVEL BLOCK will block all requests.
  3. Finally, SET CHECKPOINT will be used to force write all updates to the database.
The execution of these three commands guarantees that the database is consistent and no one, except system users, can access the server. A consistent snapshot of the database can then be obtained by simply coping the directories into ones backup media.

After the snapshot is secured, SET ADMISSION LEVEL OPEN will restore the system to its normal state.

It is recommended that the snapshot is made on the daily basis, which will speed up the crash recovery when it is needed.

To reduce the size of the log system, we may clear all the log records once for a while, as long as we have a consistent snapshot secured.

The log system can be cleared as follows.

  1. First, take a snapshot as discussed above.
  2. Instead of restoring the system into a normal state using SET ADMISSION LEVEL OPEN, use SHUTDOWN to take the system down.
  3. After the system is shut down, delete all the log files in the log_area.
  4. Finally, restart the server using logicsql.
The clearance of the log system will significantly reduce the size of the log files which not just saves the disk space but also speed up the recovery process.
[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.7.4 Recovery Procedures

In this subsection, we present the detailed procedures for database recovery.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.7.5 A Typical Recovery Schema

For your convenience, a typical recovery schema is presented this section, The main feature of this schema is the following
  1. The LOCAL_LOG is used for the backup schema.
  2. The snapshot is taken on the daily basis, incorporating with the system backup procedure if possible. To minimizing disturbance to the operations of the system, the snapshot should be taken around the lowest working load, usually around 2:00 AM.
  3. The clearance of the log system is conducted on weekly basis.
A user-friendly interface for this typical recovery schema is currently under development and will be available soon.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.8 Tutorial for DBA

This section provides a simple tutorial for database administrators about how to manage LogicSQL systems.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4. Interfaces

There are several approaches to access the LogicSQL database server.

4.1 JDBC  
4.2 ODBC  
4.3 Embedded C Pre-compiler  
4.4 The C Language Interface  


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.1 JDBC

A JDBC driver for the LogicSQL database, Release 1.0, is included in the distribution package.

LogicSQL's JDBC drivers implement the standard JDBC (Java Database Connectivity) interface as defined by JavaSoft, except the following ones, and an SQLException will be thrown out if a method used has not been implemented.

The public interfaces in java.sql that have not been implemented are:

A description of JDBC can be found at http://www.javasoft.com

The JDBC driver is located as $LOGICSQL/jdbc/lib/logicsql_jdbc.jar. It can be installed by simply defining CLASSPATH to include the driver.

For more details, read The Introduction to LogicSQL JDBC Driver.

Examples of Applications Using JDBC

The following is a simple example of using the JDBC driver to insert a tuple with Blob. More examples of using the JDBC driver and Java Servlets can be found at http://luscar.cs.ualberta.ca:8080/yuan/servlets/logicsql.html.

 
import java.io.*;
import java.sql.*;

/**
 *  A simple example to demonstrate how to use JDBCs PreparedStatement
 *  to insert a Blob into a table. The table PICTURE used in the example
 *  is created with
 *    create table picture (
 *        photo_id integer, 
 *        title varchar(48), 
 *        place varchar(48),
 *        sm_image blob,
 *        image blob,
 *        constraint picture_primary_key_constraint primary key(photo_id) )
 *
 *  @author  Li-Yan Yuan
 *
 */
public class InsertLobs {

    public static void main( String[] args)  {

	//  change the following parameters to connect to other databases
	String username = "yuan";
	String password = "******";
	String drivername = "com.shifang.logicsql.jdbc.driver.LogicSqlDriver";
	String dbstring = "jdbc.logicsql@luscar.cs.ualberta.ca:2000:database";

	// two local files of pictures
	String file1 = "PEiffelTower.jpg";
	String file2 = "EiffelTower.jpg";

	try {
          // to connect to the database
	  Connection conn = 
	    getConnected(drivername,dbstring, username,password);

	  //  create a preparedStatement with 
	  //   ?  represents the lobs to be inserted
	  PreparedStatement stmt = conn.preparedStatement(
              "insert into pictures values (20,'Eiffel Tower','Paris',?,? )" );

	  // Set the first parameter 
	  File file = new File( file1 );
          stmt.setBinaryStream(1,new FileInputStream(file),(int)file.length());

	  // set the second parameter
	  file = new File(file2);
	  stmt.setBinaryStream(2,new FileInputStream(file),(int)file.length());

	  // execute the insert statement
	  stmt.executeUpdate();
	  System.out.println( "the execution succeeds");

	  conn.close();
	} catch( Exception ex ) { 
	    System.out.println( ex.getMessage());
	}
    }

    /*
     *   To connect to the specified database
     */
    private static Connection getConnected( String drivername,
					    String dbstring,
					    String username, 
					    String password  ) 
	throws Exception {
	Class drvClass = Class.forName(drivername); 
	DriverManager.registerDriver((Driver) drvClass.newInstance());
	return( DriverManager.getConnection(dbstring,username,password));
    }
} 


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.2 ODBC

The Open DataBase Connectivity (ODBC for short) is a standard database API (Application Programming Interface) first developed by the SQL Access Group (SAG). The goal of ODBC is to make it possible to access any data from any application, regardless of which database management system (DBMS) is used to store and retrieve data. ODBC manages this by inserting a middle layer, called a database driver , between an application and the DBMS. The purpose of this layer is to translate the application's data queries into commands that the DBMS understands. For this to work, both the application and the DBMS must be ODBC-compliant -- that is, the application must be capable of issuing ODBC commands and the DBMS must be capable of responding to them.

The LogicSQL ODBC driver implements almost all the public interfaces specified by Microsoft Open DataBase Connectivity

For more details, see The User Manual of LogicSQL ODBC Driver.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.3 Embedded C Pre-compiler

The LogicSQL's Embedded C Pre-compiler (or LogicSQL prec for short) based on the SQL standard is a pre-compiler tools that allows you to embed SQL statements in a C source program.The prec accepts the source program as input, translates the embedded SQL statements into standard runtime library calls, and generates a modified C source program that you can compile, link, and execute against a LogicSQL Database in the usual way.

For more details, see The User Manual of LogicSQL Embedded C Precompiler.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.4 The C Language Interface

The C interface is designed to facilitates the development of LogicSQL-embedded C programs, i.e., the programs that can access any LogicSQL server directly.

The C Interface included in the distribution package consists of two files, i.e., lsql_c.h located in $LOGICSQL/include and liblsql_c.a located in $LOGICSQL/lib. To use it, one needs only to store them into their respective proper directories such that your C-compiler know where to find them.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.4.1 Tutorial for the C Interface

The C interface is designed to facilitates the development of LogicSQL-embedded C programs, i.e., the programs that can access any LogicSQL server directly.

The interface focuses on two central data types:

The file descriptor represents the connection between the program and the database server. To connect to a database server, a clients program needs to establish a file descriptor such that all the interactions between the client and the server are carried out through the file descriptor.

After the connection established, a client sends all requests to the database server to the file descriptor, and receive all the response from the same file descriptor.

The RSET, standing for Result Set, is a struct define to storing the set of all the answers to an SQL query

Each RSET uses a buffer to sequentially store all the table components in the form of a string such that two components are separated by a SEPARATOR, and has two pointers, one pointing to the first component and other the current component. Because the buff has no other mechanisms for tracking down the table components, The only way to access the components in a RSET is sequential access.

Example One can use sql_connection to establish the connection to a database server by providing the following information:

Here is what the code to call sql_connection looks like:

 
   int ret, fd, port;
   char hostname[BUFSIZE], dbname[BUFSIZE];
   char username[BUFSIZE], password[BUFSIZE];

   strcpy( hostname, "localhost");
   strcpy( dbname, "database");
   strcpy( username, "yuan");
   strcpy( password, "yuan");
   port = 8000;  

   /*
    *  to connect to the database server with the given parameters
    */
   if ((fd=sql_connection(hostname,port,dbname,username,password))<0) {
     printf("the connection failed\n");   
     return(-1);
   }

   /*
    *  to close the connection
    */ 
   close_connection( fd );

Example With the connection established, one can use sql_execution to send any SQL command to the database server for execution and receive the response back.

Here is what the code to call sql_execution looks like:

 
   char command[BUFSIZE], response[BUFSIZE];
   int fd, rset;
   
   ...
   
   /*
    *  use sql_execution to create a table
    */
   strcpy(command,"create table student (s_id int,s_name varchar(20))");
   if ( (ret = sql_execution(fd, command, response, BUFSIZE )) < 0 ) {
     printf("the execution failed\n");
     return(-1);
   }
   else {
     if ( response[0] == '1' )
       printf("response: %s\n", &(response[1]));
     else 
       printf("Error:  %s\n", &(response[1]));
   }

Note that the response of the LogicSQL to any SQL command is a string starting with either 1 or 0, where 1 standing for the success of the execution while 0 for the failure of the execution.

Example Function sql_execution can be used to execute any SQL command, including SELECT statements. However, it is much better to use sql_selection to execute SELECT statements because the answer returned by sql_execution is just a string while the answer returned by sql_selection is a RSET.

Here is what the code to call sql_selection looks like:

 
   int ret;
   RSET result_set;
   char command[BUFSIZE];


   /*
    *   to establish the connection to the database server
    */

   ...

   /*
    *   the result_set must be initialized before its use
    */
   rset_create( &result_set );

   /*
    *   to select all the tuples in student table
    */
   strcpy( command, "select * from student");
   if ( ( ret = sql_selection( fd, command, result_set )) < 0 ) {
     printf("the selection failed\n");
     return(-1);
   }

Example The following program first connects to the database server, and then creates a table named student and inserts one tuple into the newly created table. Finally, the program uses sql_selection to retrieve all the tuples in the table, and displays the result.

 
/*
 *  A simple program to demonstrate how to use C interface
 */
#include <stdio.h>
#include "lsql_c.h"

#define BUFSIZE 1024

int main ( int argc, char *argv[] ) {
   int ret, index, fd, port, len;
   char command[BUFSIZE], response[BUFSIZE], hostname[BUFSIZE];  
   char dbname[BUFSIZE], username[BUFSIZE], password[BUFSIZE];
   char buf[BUFSIZE], cell[BUFSIZE];
   char *ptr;

   RSET *result_set;

   strcpy( hostname, "localhost");
   strcpy( dbname, "database");
   strcpy( username, "yuan");
   strcpy( password, "yuan");

   port = 8000;  
   ptr = buf;

   /*
    *  to connect to the database server with the given parameters
    */
   if ((fd=sql_connection(hostname,port,dbname,username,password))<0) {
     printf("the connection failed\n");   
     return(-1);
   }

   /*
    *  use sql_execution to create a table
    */
   strcpy(command,"create table student(s_id int,s_name varchar(20))");
   if ( (ret = sql_execution(fd, command, response, BUFSIZE )) < 0 ) {
     printf("the execution failed\n");
     return(-1);
   }
   else {
     if ( response[0] == '1' )
       printf("response: %s\n", &(response[1]));
     else 
       printf("Error:  %s\n", &(response[1]));
   }

   /*
    *  to insert a tuple into the newly created table
    */
   strcpy(command,"insert into student values(1234,'Harry Potter')");
   if ( (ret = sql_execution(fd, command, response, BUFSIZE )) < 0 ) {
     printf("the execution failed\n");
     return(-1);
   }
   else {
     if ( response[0] == '1' )
       printf("response: %s\n", &(response[1]));
     else 
       printf("Error:  %s\n", &(response[1]));
   }

   strcpy( command, "insert into student values( 5678, 'Peter Pan')");
   if ( (ret = sql_execution(fd, command, response, BUFSIZE )) < 0 ) {
     printf("the execution failed\n");
     return(-1);
   }
   else {
     if ( response[0] == '1' )
       printf("response: %s\n", &(response[1]));
     else 
       printf("Error:  %s\n", &(response[1]));
   }

   /*
    *   the result_set must be initialized before its use
    */
   rset_create( &result_set );

   /*
    *   to select all the tuples in student table
    */
   strcpy( command, "select * from student");
   if ( ( ret = sql_selection( fd, command, result_set )) < 0 ) {
     printf("the selection failed\n");
     return(-1);
   }
   printf("\n\n");

   /*
    *   display the column name
    */
   for (index=1; index<=result_set->get_degree(result_set);index++ ) {
     len = result_set->get_column( result_set, index, &ptr );
     strncpy( cell, ptr, len );
     cell[len] = '\000';
     printf("     %s        ", cell);
   }
   printf("\n----------------------------------\n");

   /*
    *   display all the rows in result_set
    */
   len = 1;
   while ( len > 0 ) {
     for (index=1; index<=result_set->get_degree(result_set);index++) {
       len = result_set->get_next( result_set, &ptr );
       if ( len < 1 )
	 break;
       strncpy( cell, ptr,len );
       cell[len] = '\000';
       printf("     %s        ", cell);
     }
     printf("\n");
   }
   printf("\n\n");

   /*
    *  to close the connection
    */
   close_connection( fd );
}

The output of the above program is given below.

 
response:  the table is created.
response:  the tuple has been inserted
response:  the tuple has been inserted


     s_id             s_name        
----------------------------------
     1234             Harry Potter        
     5678             Peter Pan     

Running the above program second time will generate the following output.

 
Error:   CREATE TABLE: the table exists
Error:   INSERTION: the tuple exists
Error:   INSERTION: the tuple exists


     s_id             s_name        
----------------------------------
     1234             Harry Potter        
     5678             Peter Pan   

The following program demonstrate how to create a table with a lob column and how to populate it.

 
  /*
   *  A simple program to demonstrate how to use lobs_operation
   */
#include <sys/types.h>
#include <stdio.h>
#include <getopt.h>
#include "lsql_c.h"

#define ROWSIZE 1024
#define BUFSIZE 65536

int main ( int argc, char *argv[] ) {

  int ret, index, fd, port, len;
  char command[ROWSIZE], response[ROWSIZE], hostname[ROWSIZE];  
  char dbname[ROWSIZE], username[ROWSIZE], password[ROWSIZE];
  char buf[ROWSIZE], cell[ROWSIZE], lob_locator[ROWSIZE];
  char *ptr;

  RSET *result_set;

  strcpy( hostname, "localhost");
  strcpy( dbname, "database");
  strcpy( username, "yuan");
  strcpy( password, "yuan");

  port = 8000;  
  ptr = buf;

  /*
   *  to connect to the database server with the given parameters
   */
  if ((fd=sql_connection(hostname,port,dbname,username,password))<0) {
     printf("the connection failed\n");   
     return(-1);
  }

  /*
   *  use sql_execution to create a table
   */
  strcpy( command, 
  "create table photos (photo_id int, title varchar(96), image blob, 
   constraint photos_primary_key_constraint primary key(photo_id) )");

  if ( (ret = sql_execution(fd, command, response, ROWSIZE )) < 0 ) {
    printf("the execution failed\n");
    return(-1);
  }
  else {
    if ( response[0] == '1' ) 
      printf("response: %s\n", &(response[1]));
    else {
      printf("Error:  %s\n", &(response[1]));
    }
  }

  /*
   *  to insert a tuple into the newly created table
   */
  strcpy( command, "insert into photos values( 1234, 'test', empty_blob )");
  if ( (ret = sql_execution(fd, command, response, ROWSIZE )) < 0 ) {
  printf("the execution failed\n");
     return(-1);
  }
  else {
    if ( response[0] == '1' )
      printf("response: %s\n", &(response[1]));
    else 
      printf("Error:  %s\n", &(response[1]));
  }
     
  /*
   * to update the empty_blob with a lob value stored in a local file
   * with name "id.jpg"
   */
  put_one_lob( fd, "photos", "image", "where photo_id = 1234", "id.jpg", 0);

  /*
   *  to close the connection
   */
  close_connection( fd );
}


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.4.2 sql_connection

#include <lsql_c.h>

int
sql_connection(char *host, int port, char *dbname, char *user, char *passwd);

Description

This function makes a new connection to the LogicSQL server. A valid file descriptor is returned on success and a negative error number is returned if otherwise.

Parameters

Errors

HOST_NOT_FOUND, NO_FD_ERROR, FAIL_TO_SEND, FAIL_TO_RECEIVE, AUTHORIZATION_FAILED


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.4.3 close_connection

#include <lsql_c.h>

int close_connection( int fd );

Description

This function closes the current connection through the given fd to the LogicSQL server.

Parameters

Note that fd must be the descriptor returned by sql_connection.

Errors

HOST_NOT_FOUND, NO_FD_ERROR, FAIL_TO_SEND, FAIL_TO_RECEIVE, AUTHORIZATION_FAILED


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.4.4 sql_execution

#include <lsql_c.h>

int
sql_execution( int fd, char *command, char *buf, int buf_size );

Description

This function sends a command to the server to execute and stores the returned message from the server in buf. The function returns the length of the message received from the server on success and -1 on failure.

The success of this function does not necessarily imply the success of the execution.

The success of the execution depends on the first char in buf. In fact, the execution succeeds if *buf == '1' and fails if *buf == '0' . Therefore, buf stores the error message returned from the server if *buf == '0'.

Parameters


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.4.5 sql_selection

#include <lsql_c.h>

int
sql_selection( int fd, char *command, RSET *result_set );

Description

Similar to sql_execution, sql_selection, as its name suggested, executes an SQL selection command. If the execution succeeds, the function assigns the answer to the result set, and returns 1. If the execution fails, the function returns 0. The function returns -1 if it fails.

Parameters


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.4.6 put_one_lob

#include <lsql_c.h>

long
put_one_lob(int fd, char *table, char *column, char *where, char *file, int flags );

Description

The function is used to update a lob value (usually an empty lob) with a new lob value stored in the given file. The function is based on a system command

UPDATE table SET column = new_lob WHERE condition.

The function returns the size of the lob value if the execution succeeds, and -1 if it fails.

The function must be used as an atomic operation. It will return -1 if it is used within an active transaction ( between set transaction and commit ).

Parameters

Current Status Only the FILE_TO_LOB mode is implemented and thus file must be the name of a local file, and flags must be 0.

Because of the size of lob values and the time for access, this function should be implemented with a child process. We also need to consider the concurrency control of multiple accesses to the lob values.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.4.7 get_one_lob

#include <lsql_c.h>

long
get_one_lob( int fd, char *table, char *lob_locator, char *file_name, int flags ):

Description

The function is used to retrieve the lob value pointed by the lob locator from the given table. The function returns the size of the lob value if the execution succeeds, and -1 if it fails.

Parameters

Current Status

To be implemented.

Because of the size of lob values and the time for access, this function should be implemented with a child process. We also need to consider the concurrency control of multiple accesses to the lob values.

To do list


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.4.8 RSET

Description

RSET is the struct designed to store all the information of the answer to a selection query.

 
typedef struct {

  int degree;
  int no_tuples;
  int crt;          

  DBR buf;

  char *columns;
  char *types;
  char *table_name;
  char *error;
} RSET;


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.4.9 rset_create

#include <lsql_c.h>

int
rset_create( RSET **result_set );

Description

RSET is the struct designed to store all the information of the answer to a selection query. A result set of RSET cannot be used unless all the buffers in it have been created.

This function will create a RSET result_set and allocates memory for the buffers in the result_set. You must use this function to initialize a result set of RSET before it can be actually used to store answers.

Parameters


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.4.10 rset_display

#include <lsql_c.h>

int
rset_display( RSET *result_set );

Description

This function is used to display the given result_set on screen. It is mainly used for interactive accesses to LogicSQL, like SQL*FACE, but not very useful for development of application programs. Parameters


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.4.11 RSET->clear


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.4.12 RSET->release


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.4.13 RSET->get_degree


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.4.14 RSET->get_no_tuples


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.4.15 RSET->get_next


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.4.16 RSET->get_previous


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.4.17 RSET->get_component


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.4.18 RSET->get_column


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.4.19 RSET->get_type


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.4.20 RSET->get_error


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.4.21 RSET->reset


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

5. Development Tools

5.1 DBA Tools  
5.2 SQL*Face  


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

5.1 DBA Tools

LogicSQL's enterprise manager is a graphic tool for managing the LogicSQL database servers. It is Java-based and thus can be used in various plantforms.

The manager can be used to

Please read The User Manual of LogicSQL Enterprise Manager to learn how to use this wonderful tool.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

5.2 SQL*Face

The SQL*Face program is an interactive program that enables its users to execute SQL commands to store and retrieve data in LogicSQL. Through SQL*Face, one can

Guideline to SQL*FACE

A brief description of SQL*Face is given below. For more details, please read the The User Manual of LogicSQL's SQL*Face.

Installation of SQL*Face

The SQL*Face is a simple program that runs on many different kinds of computer systems with many different operating systems.

After the Installation of LogicSQL, the binary code for Linux and that for Windows are located at $LOGICSQL/bin, where $LOGICSQL is the installation directory for LogicSQL.

How to Start SQL*Face

To use SQL*Face to access a LogicSQL database, you need LogicSQL server specific information, including the host name (or the IP address) of the server, the database name, the port number of the socket that listens to client requests, a user name and the password.

To run SQL*Face, you may just enter, in your computer system (we assume that your search PATH includes the directory containing sqlface.

% sqlface

You will then be prompted to enter the database host name, socket number, database name, user name, and password, as follows:

 
% sqlface  
 
Please Enter the followings. ( Hit return if its the default in ( )  
  host name (local host):       
      port number (8000): 
database name (database):      
               user name:      
                password:     
  

With proper information entered, you will be greeted with the following:

 
% sqlface system/manager
===================================================================
 
           Welcome to the LogicSQL system
 
===================================================================
Enter an sql command ending with ';', or any of the following letter
  h)elp,  q)uit, s)tart a file of commands
 
logic sql>      

SQL*Face can also be started by entering the following

% sqlface user_name/password@database_name:server_host_name:port_number

where the meaning of the parameters are self explained.

SQL*Face Commands

The SQL*Face can be used to interactively execute all the following SQL*Face commands, including all SQL commands:

QUIT  Quit the SQL*Face
HELP  Display a help screen
START  Execute all the SQL commands in a file
SWITCH  Switch to a different user account
2.3 SQL Commands  all the SQL commands

Enter any SQL*Face command ending with ';' after the prompt logic sql, and the result will be displayed.

List of SQL*Face commands

Examples

Example 1 As a system manager, one needs to find all current users for the LogicSQL database installed in luscar.cs.ualbertra.ca with the port number 2000. We assume the password for system is still the default 'manager'.

 
% sqlface system/managerluscar.cs.ualberta.ca:2000
 ===================================================================
 
              Welcome to the LogicSQL system
 
 ===================================================================
Enter an sql command ending with ';', or any of the following letter
  h)elp,  q)uit, s)tart a file of commands
 
logic sql> select * from system.definition_schema.users;
 
user_name          password  user_id  date_created
---------------------------------------------------------
definition_schema  manager   12       2002-09-11:20:39:17
logman             logman    13       2002-09-11:20:39:17
system             manager   10       2002-09-11:20:39:16
tpc100             tpc100    16       2002-09-11:20:39:17
tpcone             tpcone    14       2002-09-11:20:39:17
 
logic sql> 

Note that, as per SQL99 specification, all meta tables are owned by the schema system.definition_schem'. The default database name is 'database' and can be omitted.

Example 2 A file with the name 'tpc_create.sql' contains all the SQL statements used to create all table schemas and indexes of a sample TPC-C database. The following illustrates how to execute all the commands in this file using SQL*Face. Note that the initial database creates a user with the user name 'tpcone' in the database with name 'tpc_db'.

 
% sqlface tpcone/tpcone@tpc_db
 ==================================================================

           Welcome to the LogicSQL system

 ==================================================================
Enter an sql command ending with ';', or any of the following letter
  h)elp,  q)uit, s)tart a file of commands

logic sql> start tpc_create.sql;
Answer:  DROP TABLE: the table dropped
 ...
Answer:  CREATE TABLE: warehouse created
 ...

Example 3 To find the list of all table names owned by 'tpcone', enter the following:

 
% sqlface tpcone/tpcone@tpc_db
 =================================================================

           Welcome to the LogicSQL system

 =================================================================
Enter an sql command ending with ';', or any of the following letter
  h)elp,  q)uit, s)tart a file of commands

logic sql> select table_name from information_schema.tables;

 
  table_name
  --------------
  customercolumns            
  element_types      
  key_column_usage   
  schemata           
  table_constraints  
  table_privileges   
  tables      
  district
  history
  item
  new_order
  orders
  stock
  warehouse     

Note that we assume the LogicSQL server is installed on the same computer system using the default port 8000; and the database name for 'tpcone' is 'tpc_db'.

The result displayed shows that the schema owns three default views and all the tables in a TPC database.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

6. Database Tests

This chapter presents two different types of database tests to facilitate the users to understand the behavior and performance of LogicSQL.

6.1 SQL Conform Tests  
6.2 TPC-C Benchmark Tests  


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

6.1 SQL Conform Tests

The SQL Conform Test is based on the SQL Test Suite (Version 6.0), which was developed jointly by the U.S. National Institute of Standards and Technology (NIST), National Computing Centre Limited (NCC) in the U.K, and Computer Logic R&D in Greece.

The SQL Test Suite is used to validate commercial SQL products for conformance to ISO, ANSI, and FIPS SQL standards. The results of the validation service are listed in an online Validated Products List. The software for the SQL Test Suite can be downloaded from the Web pages of the NIST Software Diagnostics and Conformance Testing Division. To download this conformance testing software, go to: http://www.itl.nist.gov/div897/ctg/software.htm and select SQL.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

6.2 TPC-C Benchmark Tests

The TPC-C benchmark test is a comprehensive database test (see http://www.tpc.org for details). LogicSQL has been tested according to the TPC-C benchmark specification. Our tests are conducted with the LogicSQL server installed on Linux box, i.e., on a PC running Linux. We will test its performance on higher end servers in the near future.

One may conduct his/her own tests in the following steps:

  1. create the initial TPC database,
  2. conduct the test,
  3. record and analyze the testing results.

1. Creation of the initial TPC database

First, one has to create an initial database for the test. For your convenience, a script file has been included in the directory named $LOGICSQL/bin. Within this directory, simply typing

% sqlface system/manager < tpc_input

will create a catalog, named tpc_db, a user name tpcone, and all the necessary tables.

After creating all the table schemas, one may populate the initial TPC database in tpc_db, using

% tpcload tpcone 8000 10,

where tpcone is the schema, 8000 is the socket number of the server, and the last parameter indicates the number of warehouses to be populated. To populate the database with 100 warehouses, simply change 10 to 100. An initial database with 100 warehouses takes around 10GB disk space and will be populated in 15-20 hours.

2. Testing

After the population of the initial TPC database, the testing can be initialized with

% tpctest

The tpctest can be called with the following options:

 
  -m <host_name>      specify the host name with default as localhost
  -p <port_number>    specify the port number with default as 8000
  -u <user_name>      specify the user name and default is tpcone
  -d <password>       specify the password and default is the same as 
                      user name
  -w <no. warehouses> specify the number of warehouses, default is 1
  -c <no. clients>    specify the number of clients, default is 1
  -t <no. transact>   specify the number of transactions, default is 1
  -l                  print out all the queries and answers, default 
                      is off
  -b <block factor>   the percentage of thinking time, default is 100%
  -n <network delay>  the network delay time, default is 0
  -h                  print this message

For example, the following command

% tpctest -u tpcone -w10 -c100 -t100000

will start the test that accesses to the TPC-C database in the LogicSQL server on the same machine. The user name is tpcone, the database consists of 10 warehouses, and the thinking/keying time is 100%, i.e., the same as per TPC-C specification. There will be 100 clients in the test, and 10000 transactions per client.

The number of transactions per clients should be large enough so the test can last at least one day (24 hours).

One may start the testing from different machines.

By the TPC-C specification, the test result should be obtained after a certain period of time since the testing starts, and for the duration of 30 minutes, between two checkpoints. A program, called dba_tools, is provided in directory $LOGICSQL/bin to automatically set checkpoint. Just enter

% dba_tools&

and the program will be running in the background and issues set checkpoint every 30 minutes or so. To know how to use this too, just enter dba_tools -h.

3. Analysis of Test Results

The command set checkpoint will not only set the checkpoint but also record the test parameters in a system table system.definition_schema.checkpoint_record.

One can use sqlface (or any other interface such as Java Interface using JDBC) to display all the tuples in the above table. For example, one can use select * from system.definition_schema.checkpoint_record under sqlface, as follows:

 
% sqlface definition_schema/manager

 ==================================================================
 
            Welcome to the LogicSQL system
 
 ==================================================================
Enter an sql command ending with ';', or any of the following letter
  h)elp,  q)uit, s)tart a file of commands

logic sql> select * from system.definition_schema.checkpoint_record;


chk_time        clients transactions roll_backs committed  transaction_per_minute
---------------------------------------------------------------------------------
2002-08-29:14:40:50  2       5            0          7          0
2002-08-29:14:42:35  201     75           0          43         42
2002-08-29:14:43:48  201     490          5          469        402
2002-08-29:15:17:09  201     17282        90         17231      518
2002-08-29:15:47:09  201     15617        54         15569      520
2002-08-29:16:17:12  201     15732        64         15669      524
2002-08-29:16:47:14  201     15783        55         15716      526
2002-08-29:17:17:14  201     15933        55         15881      531
2002-08-29:17:47:14  202     15619        67         15532      520
2002-08-29:18:17:14  202     15832        57         15797      527
2002-08-29:18:47:14  202     15827        80         15754      527           

The above table shows that the test has 202 concurrent clients, it has processed 15827 transactions during the period of 30 minutes, of which 80 rolled back and 15754 committed. Therefore, the performance is 527 transactions/minute while the rollback ratio is 0.038%.

Note that the above test was conducted with the LogicSQL server installed on a PC Pentium 3, 1GHs, with one Gb memory, and clients are connected to the server through the local network.

It is not difficult to notice that the average response time for the test is under 1 second, which does satisfy the TPC-C specification.

The correctness of the concurrency control mechanism of LogicSQL can be easily checked after tpctest using

tpccheck -u user_name.

This will check all ten consistency conditions specified by the TPC-C specification.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

Concept Index

Jump to:   B   C   D   E   F   G   I   L   O   R   S   T   U  

Index Entry Section

B
backup log status3.3 System Configuration

C
CHR2.2.3 CHR
CHR2.2.5 NVL
close cursor2.3.3 CLOSE CURSOR
commit2.3.4 COMMIT
crash recovery2.4.4 RECOVER DATABASE
create database2.3.5 CREATE DATABASE
create datatype2.3.6 CREATE DATATYPE
create index2.3.7 CREATE INDEX
create procedure2.3.8 CREATE PROCEDURE
create role2.3.9 CREATE ROLE
create schema2.3.10 CREATE SCHEMA
create sequence2.3.11 CREATE SEQUENCE
create table2.3.12 CREATE TABLE
create trigger2.3.13 CREATE TRIGGER
create user2.3.14 CREATE USER
create view2.3.15 CREATE VIEW
cursor2.3.16 DECLARE CURSOR

D
data area3.3 System Configuration
database cluster3.3 System Configuration
database cluster3.3 System Configuration
database logs3.3 System Configuration
Database Tests6. Database Tests
DBA Tools5.1 DBA Tools
delete2.3.17 DELETE
Development Tools5. Development Tools
drop database2.3.18 DROP DATABASE
drop index2.3.19 DROP INDEX
drop procedure2.3.20 DROP PROCEDURE
drop role2.3.21 DROP ROLE
drop schema2.3.22 DROP SCHEMA
drop sequence2.3.23 DROP SEQUENCE
drop table2.3.24 DROP TABLE
drop trigger2.3.25 DROP TRIGGER
drop user2.3.26 DROP USER
drop view2.3.27 DROP VIEW

E
execute procedure2.3.28 EXECUTE PROCEDURE

F
fetch2.3.29 FETCH

G
grant privilege2.3.30 GRANT PRIVILEGE
grant role2.3.31 GRANT ROLE

I
insert2.3.32 INSERT
INSTR2.2.4 INSTR

L
lobs area3.3 System Configuration
logicsql3.4.2 Starting the LogicSQL server

O
OPEN cursor2.3.33 OPEN CURSOR
Outer Joins2.3.38 SELECT and Subquery

R
revoke privilege2.3.34 REVOKE PRIVILEGE
revoke role2.3.35 REVOKE ROLE
rollback2.3.36 ROLLBACK
RSET4.4.8 RSET

S
server3.4.2 Starting the LogicSQL server
server port3.3 System Configuration
server shut down3.4.3 Shutting down the LogicSQL server
server startup failures3.4.2 Starting the LogicSQL server
set autocommit2.3.41 SET AUTO_COMMIT
set checkpoint2.4.1 SET CHECKPOINT
set role2.3.37 SET ROLE
set session user2.3.40 SET SESSION USER
set transaction2.3.39 SET TRANSACTION
shutdown2.4.5 SHUTDOWN
Shutting down the LogicSQL server3.4.3 Shutting down the LogicSQL server
SQL Conform Tests6.1 SQL Conform Tests
Starting the LogicSQL server3.4.2 Starting the LogicSQL server
system creation3.4.1 System Creation

T
TPC-C Benchmark Tests6.2 TPC-C Benchmark Tests
Tutorial for the C Interface4.4.1 Tutorial for the C Interface

U
update2.3.42 UPDATE
user account3.2 Server Runtime Environment

Jump to:   B   C   D   E   F   G   I   L   O   R   S   T   U  


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

Bug Report and Contact Infomation

Please report all the bugs at the following webpage How to Report bugs of LogicSQL


[Top] [Contents] [Index] [ ? ]

Footnotes

(1)

By $LOGICSQL we mean the installation directory.


[Top] [Contents] [Index] [ ? ]

Table of Contents


[Top] [Contents] [Index] [ ? ]

Short Table of Contents

1. Introduction
2. User's Guide
3. Database Administrator's Guide
4. Interfaces
5. Development Tools
6. Database Tests
Concept Index
Bug Report and Contact Infomation

[Top] [Contents] [Index] [ ? ]

About this document

This document was generated on January, 25 2005 using texi2html

The buttons in the navigation panels have the following meaning:

Button Name Go to From 1.2.3 go to
[ < ] Back previous section in reading order 1.2.2
[ > ] Forward next section in reading order 1.2.4
[ << ] FastBack previous or up-and-previous section 1.1
[ Up ] Up up section 1.2
[ >> ] FastForward next or up-and-next section 1.3
[Top] Top cover (top) of document  
[Contents] Contents table of contents  
[Index] Index concept index  
[ ? ] About this page  

where the Example assumes that the current position is at Subsubsection One-Two-Three of a document of the following structure:

This document was generated on January, 25 2005 using texi2html