org.eigenbase.sql.parser
package, are independent of the other saffron
packages, so may be used standalone.
Revision | $Id: //open/dev/farrago/src/org/eigenbase/sql/package.html#7 $ |
---|---|
Copyright | Copyright (C) 2005-2009 The Eigenbase Project
Copyright (C) 2003-2009 SQLstream, Inc. Copyright (C) 2005-2009 LucidEra, Inc. |
Author | Julian Hyde |
{@link org.eigenbase.sql.parser.SqlParser} parses a SQL string to a parse tree. It only performs the most basic syntactic validation.
Every node in the parse tree is a {@link org.eigenbase.sql.SqlNode}. Sub-types are:
NULL
.
EMPNO
or emp.deptno
.select
statement is a
call to the 'select' operator.A {@link org.eigenbase.sql.SqlOperator} describes the behavior of a node in the
tree, such as how to un-parse a {@link org.eigenbase.sql.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: {@link org.eigenbase.sql.SqlFunction}, {@link
org.eigenbase.sql.SqlBinaryOperator}, {@link org.eigenbase.sql.SqlPrefixOperator}, {@link
org.eigenbase.sql.SqlPostfixOperator}. And there are singleton classes for special
syntactic constructs {@link org.eigenbase.sql.SqlSelectOperator} and {@link
org.eigenbase.sql.SqlJoinOperator}. (These special operators even have their own
sub-types of {@link org.eigenbase.sql.SqlCall}: {@link org.eigenbase.sql.SqlSelect} and
{@link org.eigenbase.sql.SqlJoin}.)
A {@link org.eigenbase.sql.SqlOperatorTable} is a collection of operators. By supplying your own operator table, you can customize the dialect of SQL without modifying the parser.
{@link org.eigenbase.sql.validate.SqlValidator} checks that a tree of {@link org.eigenbase.sql.SqlNode}s is semantically valid. You supply a {@link org.eigenbase.sql.SqlOperatorTable} to describe the available functions and operators, and a {@link org.eigenbase.sql.validate.SqlValidatorCatalogReader} for access to the database's catalog.
A {@link org.eigenbase.sql.SqlWriter} converts a tree of {@link org.eigenbase.sql.SqlNode}s into a SQL string. A {@link org.eigenbase.sql.SqlDialect} defines how this happens.