Package gudusoft.gsqlparser
package gudusoft.gsqlparser
Provides the class
TGSqlParser necessary to create a SQL Parser and the classes a SQL Parser uses
internally to handle different SQL dialects.
- Since:
- 1.0
-
ClassDescriptionUsed by parser internally.subtype of alter column in alter table statement.Teradata datatype attributeDatabase vendors supported:
EDbVendor.dbvmssql,EDbVendor.dbvoracle,EDbVendor.dbvmysql,EDbVendor.dbvdb2,EDbVendor.dbvsybase,EDbVendor.dbvinformix,EDbVendor.dbvpostgresql,EDbVendor.dbvteradata,EDbVendor.dbvmdx,EDbVendor.dbvnetezza,EDbVendor.dbvhive,EDbVendor.dbvgreenplum,EDbVendor.dbvredshift
No specific engine for Microsoft ACCESSEDbVendor.dbvaccess, useEDbVendor.dbvmssqlinstead.Type of SQL syntax errors.SQL Server execute as option
scalar expression: return a single value.Used by parser internally.source of insert valueType ofTConstantquery hint typeSpecifies which SQL resolver to use for name resolution during parsing.Oracle/DB2 create view, subquery restriction clauseUsed to replace TBaseType.srtNone,srtAsc and srtDescEnum for various SQL clause such as where clause, having clause and etc.Type of SQL statement.Used by parser internally.Type of source token.A specification that indicates when triggered SQL statements perform in relation to the triggering event.Deprecated.This is the interface for handling SQL statements after parsing each SQL statement.use this interface if you like to change token properties generated by lexer before send to parser.
if you change a source token's TSourceToken#tokencode to TBaseType#cmtslashstar TBaseType#cmtdoublehyphen then, this token will be treated as comment
you may also like to change tokencode of a keyword to TBaseType#ident, this will let parser treat this keyword as an identifier.TAttributeNode 类似 column,但含义更广泛。用来表示 SQL 语句中 table 包含的字段(table 或许用 relation 更准确)。 这里的 table 可以是数据库的基本表,也可以是 from clause 中出现的子查询,或者是 CTE。 GSP 会把 SQL 语句中出现的每个 table 都生成对应的 TAttributeNode 列表,表示该 table 可以在 SQL 中被使用的字段。 例如:一般 table select column1 from table1 GSP 会在 SQLEnv 中查找 table1 的定义,如果找到(column1,column2,column3), 则 table 会创建三个对应的 TAttributeNode。 用户可以通过TTable.getAttributes()来获取。 如果SQLEnv 中没有查找 table1 的定义,则创建一个 star column TAttributeNode, 形如 table1.* 例如:子查询 select column1 from (select c1,c2 from table1) t1 针对上例中的 t1 子查询, GSP 会创建两个 TAttributeNode,对应 t1.c1, t1.c2 针对其他类型的 table, 也做类似处理。为 SQL 中的每个 table 准备好 TAttributeNode 列表, 在接下来的分析中,SQL 语句中出现的 column 引用都应该能找到对应的来源表和 TAttributeNode 相关的属性TAttributeNode.getName(), 字段名,不带前缀。TAttributeNode.getTable_ref(), 该字段对应的 table,每个在 SQL 语句中出现的 table 都有对应的TTable对象。TAttributeNode.getSqlColumn(), 如果在 SQLEnv 中找到该 table 的定义,这个方法返回数据库中定义的字段、TAttributeNode.getSubLevelResultColumn(), 如果 table 类型为子查询,该方法返回子查询 select list 中的TResultColumn对象,为该字段的数据来源。 或者是 values() 中的 result column。Constants and functions used by parser internally.Base lexer of all databases - Core tokenization engine for SQL parsing.Base parser of all databases.TCustomSqlStatement is the root class for all SQL statements.Normalization profiles for SQL hashing.This is the first class people start to use this SQL parser library.Thread-safe parser pool implementation to replace the singleton pattern.Functional interface for parser operations.Pool statistics for monitoring.Custom exception for timeout scenarios.Factory class for managing parser pool instances.Thread-safe parser pool that clears parser references from parse trees.Represents a source token which is the basic syntactic unit of SQL.List of source token.List of SQL statements which is instance of class that descends fromTCustomSqlStatement.Detailed information about syntax error.Base class of all parse tree nodes that can be visited by visitors.Base class of all visitors that used to visit parse tree nodes.
TSQLEnvinstead In order to link column to table correctly without connecting to database, we need to provide a class which implements IMetaDatabase to TGSqlParser.