Package net.sf.saffron.sql

Provides an SQL parser and object model.

See:
          Description

Interface Summary
SqlOperator.TypeInference Strategy to infer the type of an operator call from the type of the operands.
SqlValidator.CatalogReader A CatalogReader supplies catalog information for a SqlValidator.
SqlValidator.Table A Table supplies a SqlValidator with the metadata for a table.
 

Class Summary
SqlBinaryOperator SqlBinaryOperator is a binary operator.
SqlCall A SqlCall is a call to an operator.
SqlDelete A SqlDelete is a node of a parse tree which represents a DELETE statement.
SqlDialect SqlDialect encapsulates the differences between dialects of SQL, for the benefit of a SqlWriter.
SqlExplain A SqlExplain is a node of a parse tree which represents an EXPLAIN PLAN statement.
SqlFunction A SqlFunction is a type of operator which has conventional function-call syntax.
SqlIdentifier A SqlIdentifier is an identifier, possibly compound.
SqlInsert A SqlInsert is a node of a parse tree which represents an INSERT statement.
SqlJoin A SqlJoin is ...
SqlJoinOperator SqlJoinOperator describes the syntax of the SQL JOIN operator.
SqlJoinOperator.ConditionType Enumerates the types of condition in a join expression.
SqlJoinOperator.JoinType Enumerates the types of join.
SqlKind Enumerates the possible types of SqlNode.
SqlLiteral A SqlLiteral is a constant.
SqlNode A SqlNode is a SQL parse tree.
SqlNode.DatabaseMetaDataInvocationHandler Handles particular DatabaseMetaData methods; invocations of other methods will fall through to the base class, BarfingInvocationHandler, which will throw an error.
SqlNodeList A SqlNodeList is a list of SqlNodes.
SqlOperator A SqlOperator is a type of node in a SQL parse tree (it is NOT a node in a SQL parse tree).
SqlOperator.Syntax Syntax enumerates possible syntactic types of operators.
SqlOperatorTable SqlOperatorTable is a singleton which contains an instance of each operator.
SqlPostfixOperator A postfix unary operator.
SqlPrefixOperator A unary operator.
SqlSelect A SqlSelect is a node of a parse tree which represents a select statement.
SqlSelectOperator An operator describing a query.
SqlSpecialOperator Generic operator for nodes with special syntax.
SqlUtil Contains utility functions related to SQL parsing, all static.
SqlValidator SqlValidator validates the parse tree of a SQL statement, and provides semantic information about the parse tree.
SqlWriter A SqlWriter is the target to construct a SQL statement from a parse tree.
 

Package net.sf.saffron.sql Description

Provides an SQL parser and object model. This package, and the dependent net.sf.saffron.sql.parser package, are independent of the other saffron packages, so may be used standalone.

 

Revision $Id: //open/saffron/src/net/sf/saffron/sql/package.html#1 $
Copyright (C) Copyright 2003-2003 Disruptive Technologies, Inc.
Author Julian Hyde

Parser

SqlParser parses a SQL string to a parse tree. It only performs the most basic syntactic validation.

Object model

Every node in the parse tree is a SqlNode. Sub-types are:

A SqlOperator describes the behavior of a node in the tree, such as how to un-parse a SqlCall into a SQL string. It is important to note that operators are metadata, not data: there is only one SqlOperator instance representing the '=' operator, even though there may be many calls to it.

SqlOperator has several derived classes which make it easy to define new operators: SqlFunction, SqlBinaryOperator, SqlPrefixOperator, SqlPostfixOperator. And there are singleton classes for special syntactic constructs SqlSelectOperator and SqlJoinOperator. (These special operators even have their own sub-types of SqlCall: SqlSelect and SqlJoin.)

A SqlOperatorTable is a collection of operators. By supplying your own operator table, you can customize the dialect of SQL without modifying the parser.

Validation

SqlValidator checks that a tree of SqlNodes is semantically valid. You supply a SqlOperatorTable to describe the available functions and operators, and a SqlValidator.CatalogReader for access to the database's catalog.

Generating SQL

A SqlWriter converts a tree of SqlNodes into a SQL string. A SqlDialect defines how this happens.


SourceForge.net_Logo