Download List of features implemented in Sculptor 6 SQL

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

DBase wikipedia , lookup

Oracle Database wikipedia , lookup

Tandem Computers wikipedia , lookup

Database wikipedia , lookup

Microsoft Access wikipedia , lookup

Btrieve wikipedia , lookup

Relational algebra wikipedia , lookup

Ingres (database) wikipedia , lookup

Microsoft Jet Database Engine wikipedia , lookup

Extensible Storage Engine wikipedia , lookup

Clusterpoint wikipedia , lookup

Entity–attribute–value model wikipedia , lookup

Join (SQL) wikipedia , lookup

Database model wikipedia , lookup

Null (SQL) wikipedia , lookup

Microsoft SQL Server wikipedia , lookup

Relational model wikipedia , lookup

Open Database Connectivity wikipedia , lookup

SQL wikipedia , lookup

PL/SQL wikipedia , lookup

Transcript
Sculptor SQL Engine Features
Version: 6.0.3
Date: 24 Oct 2011
Changes made to this document since the previous version are shown in blue.
Introduction
The Sculptor SQL implementation is based entirely on the SQL-92 standard.
The entire SQL-92 parser has been coded but the engine is still under development and not all
constructions are currently implemented.
Summary - Implemented
Data Query Language (DQL)

SELECT
Partially implemented. See below for details.
Data Manipulation Language (DML)

UPDATE
Change records.

INSERT
Create records.

DELETE
Delete records.
Summary – Not yet implemented
Data Definition Language (DDL)

CREATE
Create a new table, a view of a table or other object in a database.

ALTER
Modify an existing database object, such as a table.

DROP
Delete an entire table, a view of a table or other object in the database.
Data Control Language (DCL)

GRANT
Give a privilege to a user.

REVOKE
Take back privileges granted to a user.
Database elements - Implemented

Catalogs

Schemas

Tables

Transaction Management
Database elements – Not yet implemented

Views

Users

Privileges

Domains

Stored procedures

Constraints, Assertions and Referential Integrity

Cursors (except for the "order by" part which is implemented)
Sculptor to SQL data type mappings
Sculptor
SQL
a#
CHAR(#)
u1
TINYINT
i2
SMALLINT
i4
INTEGER
r8
REAL
i4/dn
DATETIME
n4.0/my
SMALLMONEY
n8.0/my
MONEY
Identifiers
Because field names in Sculptor are case sensitive, Sculptor SQL is not following the SQL-92 identifier
standard. In Sculptor SQL identifiers are always case sensitive, so it is not necessary to use double
quotes to make them case sensitive. A future implementation may provide an option to choose the
behaviour.
Since SQL does not support array fields, Sculptor array fields are mapped to multiple SQL fields with
names derived as follows:
Sculptor Array SQL Equivalent Fields
myfield[n]
myfield_1, myfield_2, ... myfield_n
SELECT (DQL)
Quantifier - Implemented

ALL (same as nothing)

DISTINCT
Select List - Implemented

*

Table.*

Schema.Table.*

Catalog.Schema.Table.*

Expressions (see later for list of implemented expressions).
Any of the above with an AS clause. Example:
SELECT tbl1.*, fld1, fld2 + fld3, 1 AS "Number", NULL AS "NullCol" ...
Literals and Operators - Implemented

'STRING'
CHAR()

12
INTEGER

2.99
NUMERIC (money, ...)

1.43E-4
REAL

DATE 'yyyy-mm-dd'
DATETIME

{d 'yyyy-mm-dd'}
DATETIME

VALUES (row1_col1, row1_col2, ..., row1_colN),
(row2_col1, row2_col2, ..., row2_colN),
...
(rowM_col1, rowM_col2, ..., rowM_colN)




TABLE TableName
(Explicit table)
'+' '-' '*' '/' '(' ')'
(with INTEGERS and REALS)
Set functions (COUNT, MAX, MIN, SUM, AVG)
String value functions (SUBSTRING)
Functions and Operators – Not yet implemented

Numeric value functions (POSITION, EXTRACT, CHAR_LENGTH, OCTET_LENGTH, BIT_LENGTH)

String value functions (UPPER, LOWER, TRIM, TRANSLATE, CONVERT)

Datetime value function (CURRENT_DATE, CURRENT_TIME, CURRENT_TIMESTAMP)

'||' (string concatenation)

CASE

CAST

NULLIF

COALESCE

Row value constructors. Example: (C1, C2, C3) = (CA, CB, CC)
SELECT clause - Implemented

FROM

WHERE

GROUP BY

HAVING

Sub-queries (nested queries)

ORDER BY (cursor part)
FROM clause - Implemented

Single table select

Old style joins (comma separated tables)

CROSS JOIN

INNER JOIN

OUTER JOINS

CONDITIONAL JOINS (ON clause is similar to WHERE clause)
FROM clause – Not yet implemented

NATURAL JOIN

UNION, INTERSECT and EXCEPT

Column name join (USING)
WHERE clause - Implemented

AND and OR

BETWEEN predicate

Comparison predicates (=, <>, <, >, <=, >=)

IN predicate

IS [NOT] NULL predicate

NOT and IS [NOT] {TRUE|FALSE|UNKNOWN}

LIKE predicate
WHERE clause – Not yet implemented

EXISTS predicate

UNIQUE predicate

OVERLAPS predicate

MATCH predicate

Quantified comparison predicate (SOME, ANY, ALL)
ORDER BY clause - Fully Implemented

ORDER BY {Column Number|Column Name} [{ASC|DESC}] [,{Column Number|Column Name}
[{ASC|DESC}]]*
ODBC Escape sequences
Optional ODBC Escape "markers"
"{" -> "$(VENDOR(MICROSOFT),PRODUCT(ODBC)"
"}" -> "*)"
Implemented
{d ...}
{oj ...}
Not implemented
{t ...}
{ts ...}
{fn ...}
sql command
Implements remote database access as defined in SQL-92:
C:\>sql -h
Usage: sql [options] [script_filename]
Options:
-o filename
-q
-s server
-v
-h
Output filename (standard output if not specified)
Quiet, no prompt output (implied with scipt_filename)
Default Kfserver servername (localhost if not specified)
Print program version
This message
C:\>sql
* > help
Supported commands (case insensitive)

HELP
Show this help.

EXIT
Close all connections and exit sql.

CONNECT TO DEFAULT
Connect to the default server (localhost).

CONNECT TO server_name [AS connect_name] [USER user_name[/password]]

SET CONNECTION DEFAULT
Set the current connection to the default.

SET CONNECTION connect_name
Set the current connection to the named connection.

SHOW CONNECTION
Show all the connections including the current one.

DISCONNECT {ALL|CURRENT}
Disconnect all connections or the current one.

DISCONNECT connect_name
Disconnect the specified connection.

SET OPTION name = value
Set the option 'name' to 'value'. See options:
o
CSV = [ON|OFF]
Comma Separated Values output
o
CSV_SEPARATOR = '#'
Comma Separated Values output separator
o
AUTO_COMMIT = [ON|OFF] Set the Auto Commit behaviour (ON by default)
o
LOGIN_TIMEOUT = #
means forever)
o
PROCESS_PRIORITY = SPP* Set the current connection process priority:
The timeout in seconds used to connect to the server (0
SPP_IDLE, SPP_BELOW_NORMAL, SPP_NORMAL,
SPP_ABOVE_NORMAL, SPP_HIGH, SPP_REALTIME
o
THREAD_PRIORITY = STP* Set the current connection thread priority:
STP_IDLE, STP_LOW, STP_BELOW_NORMAL, STP_NORMAL,
STP_ABOVE_NORMAL, STP_HIGH, STP_TIME_CRITICAL

SHOW OPTION
Show all the option values

RUN file_name
Run the sql commands inside the file_name

COMMIT [WORK]
Commit the current connection transaction

ROLLBACK [WORK]
Rollback the current connection transaction

sql_statement ;
Any valid SQL statement (semicolon terminated).
ODBC special options

Sculptor special connect attributes (SqlSetConnectAttr and SqlGetConnectAttr):
#define SQL_SC_ATTR_PROCESS_PRIORITY 0x00004000 /* SQL_DRIVER_CONNECT_ATTR_BASE */
#define SQL_SC_ATTR_THREAD_PRIORITY 0x00004001

The attribute value is a long value which must be one of:
/* Sculptor Process Priorities (SQL_SC_ATTR_PROCESS_PRIORITY) */
#define SPP_IDLE
1
#define SPP_BELOW_NORMAL
2
#define SPP_NORMAL
3
#define SPP_ABOVE_NORMAL
4
#define SPP_HIGH
5
#define SPP_REALTIME
6
/* Sculptor Thread Priorities (SQL_SC_ATTR_THREAD_PRIORITY) */
#define STP_IDLE
1
#define STP_LOW
2
#define STP_BELOW_NORMAL
3
#define STP_NORMAL
4
#define STP_ABOVE_NORMAL
5
#define STP_HIGH
6
#define STP_TIME_CRITICAL
7

To setup the login timeout connect attribute (SqlSetConnectAttr and SqlGetConnectAttr):
Use the standard ODBC attribute define: SQL_ATTR_LOGIN_TIMEOUT
Sculptor SQL system metadata
Metadata tables defined inside the "Sculptor" schema. These can be accessed like any other table.

Sculptor.DataTypes

Sculptor.Procedures

Sculptor.Catalogs

Sculptor.Schemas

Sculptor.Tables

Sculptor.Columns

Sculptor.TableTypes
Note: This will change soon to the SQL-92 standard "INFORMATION_SCHEMA".
Sculptor Catalog+Schema+Tables and Procedures structure
Directory location: $SCULPTOR/sql
Catalog metadata
Keyed file: catalogs
Field Name
Key
Data Type
CATALOG_NAME
Yes
a32
CATALOG_COMMENT
No
a255
Field Name
Key
Data Type
CATALOG_NAME
Yes
a32
SCHEMA_NAME
Yes
a32
SCHEMA_DIRECTORY
No
a255
USER_NAME
No
a128
SCHEMA_COMMENT
No
a255
Key
Data Type
Comments
Schema metadata
Keyed file: schemas
Comments
Authorised User
Table metadata
Keyed file: tables
Field Name
Comments
CATALOG_NAME
Yes
a32
SCHEMA_NAME
Yes
a32
TABLE_NAME
Yes
a32
TABLE_COMMENT
No
a255
Table name or * for all tables
Stored procedures metadata
Keyed file: procedures
Field Name
Key
Data Type
CATALOG_NAME
Yes
a32
SCHEMA_NAME
Yes
a32
PROCEDURE_NAME
Yes
a48
NUM_INPUT_PARAMS
No
i4
NUM_OUTPUT_PARAMS
No
i4
NUM_RESULT_SETS
No
i4
PROCEDURE_COMMENT
No
a255
PROCEDUTE_TYPE
No
i4
PROCEDURE_CODE
No
a232[16]
SPARE
No
a1
Comments
(a3712)
Procedure types: SQL_PT_UNKNOWN, SQL_PT_PROCEDURE, SQL_PT_FUNCTION