Interface and Description |
---|
gudusoft.gsqlparser.IMetaDatabase
As of v2.0.3.1, please use
TSQLEnv instead
In order to link column to table correctly without connecting to database,
we need to provide a class which implements IMetaDatabase to TGSqlParser.
this class tells TGSqlParser the relation ship between column and table.
Take this SQL for example: SELECT Quantity,b.Time,c.Description FROM (SELECT ID2,Time FROM bTab) b INNER JOIN aTab a on a.ID=b.ID INNER JOIN cTab c on a.ID=c.ID General SQL Parser can build relationship between column: ID2 and table: bTable correctly without metadata information from database because there is only one table in from clause. But it can't judge column: Quantity belong to table: aTab or cTab, since no table alias was prefixed to column: Quantity. If no metadata provided, General SQL Parser will link column: Quantity to the first valid table (here it is aTab) If we create a class metaDB implements IMetaDatabase,then TGSqlParser.setMetaDatabase(new metaDB()), General SQL Parser can take this advantage to create a correct relationship between column and tables. Here is a sample of metaDB, you should create your own metaDB class with meta information from database. public class metaDB implements IMetaDatabase { String columns[][] = { {"dbo","aTab","Quantity1"}, {"dbo","bTab","Quantity2"}, {"dbo","cTab","Quantity"} }; public boolean checkColumn(String schema, String table, String column){ boolean bSchema,bTable,bColumn,bRet = false; for (int i=0; i<columns.length;i++){ if (schema == null){ bSchema = true; }else{ bSchema = columns[i][0].equalsIgnoreCase(schema); } if (!bSchema) continue; bTable = columns[i][1].equalsIgnoreCase(table); if (!bTable) continue; bColumn = columns[i][2].equalsIgnoreCase(column); if (!bColumn) continue; bRet =true; break; } return bRet; } } After TGSqlParser.setMetaDatabase(new metaDB()), General SQL parser can generate this result for you: atab.id btab.id btab.time ctab.description ctab.id ctab.quantity |
Class and Description |
---|
gudusoft.gsqlparser.nodes.TAnalyticFunction
As of v1.8.6.3, replaced by
TWindowDef
Window/analytic clause of Window (or analytic) functions.
partitioning ::= PARTITION BY value[, value...], call method
ordering ::= ORDER [SIBLINGS] BY rule[, rule...], call method |
gudusoft.gsqlparser.nodes.TComputeClauseItemList
As of v1.8.7.2
|
gudusoft.gsqlparser.stmt.db2.TDb2CreateFunction
since v2.6.4.1, use
TCreateFunctionStmt instead. |
gudusoft.gsqlparser.stmt.db2.TDb2CreateProcedure
As of v2.5.1.7, replaced by
TCreateProcedureStmt |
gudusoft.gsqlparser.stmt.db2.TDb2CreateTrigger
As of v2.0.1.0, replaced by
TCreateTriggerStmt |
gudusoft.gsqlparser.stmt.db2.TDb2IfStmt
since v2.8.8.9, use
TIfStmt instead |
gudusoft.gsqlparser.stmt.TExecutePreparedStatement
As of v2.3.3.7, replaced by
TExecuteSqlStatement |
gudusoft.gsqlparser.stmt.TGetDiagnosticsStmt
since GSP Java version 2.3.9.3, use
TGetDiagStmt instead. |
gudusoft.gsqlparser.stmt.postgresql.TGrantSqlStatement
As of v1.6.3.7, replaced by
TGrantStmt |
gudusoft.gsqlparser.nodes.TGroupingExpressionItem
As of v1.4.3.3, replaced by
TExpression |
gudusoft.gsqlparser.nodes.TGroupingExpressionItemList
As of v1.4.3.3, replaced by
TExpressionList |
gudusoft.gsqlparser.stmt.hive.THiveSwitchDatabase
since 2.6.2.6, use
TUseDatabase instead |
gudusoft.gsqlparser.nodes.TIndexColName
as V1.8.7.2, replaced by
TColumnWithSortOrder |
gudusoft.gsqlparser.nodes.TInExpr
As of v1.4.3.3, replaced by
TExpression |
gudusoft.gsqlparser.stmt.informix.TInformixCreateTrigger
As of v2.0.1.0, replaced by
TCreateTriggerStmt |
gudusoft.gsqlparser.nodes.TJoin
As of v2.7.4.0, Please use
TJoinExpr instead.
A list of join TCustomSqlStatement.joins represents table sources in following clauses of SQL statement:
Each table source in from clause was treated as a join which is type of TJoin .
The reason for this design is that we can treat all table sources in from clause in a uniform way. |
gudusoft.gsqlparser.nodes.TJoinItem
As of v2.7.4.0, Please use
TJoinExpr instead.
SQL 1: In above SQL, the whole from clause can be represented by aselect f from t1 left join t2 on t1.f1 = t2.f1 right join t3 on t1.f1 = t3.f1 TJoin class.
And "left join t2 on t1.f1 = t2.f1 right join t3 on t1.f1 = t3.f1" was represented by 2 instance of class These 2 instance can be accessed via One for: "left join t2 on t1.f1 = t2.f1", the other is "right join t3 on t1.f1 = t3.f1". |
gudusoft.gsqlparser.stmt.postgresql.TLockSqlStatement
As of v1.6.3.7, May add lock statement under package: gudusoft.gsqlparser.stmt
|
gudusoft.gsqlparser.stmt.mssql.TMssqlCreateTrigger
As of v2.0.1.0, replaced by
TCreateTriggerStmt
SQL SQL create trigger statement. |
gudusoft.gsqlparser.stmt.mssql.TMssqlDropTable
, use TDropTableSqlStatement instead.
|
gudusoft.gsqlparser.stmt.mssql.TMssqlDropView
, use TDropViewSqlStatement instead.
|
gudusoft.gsqlparser.stmt.mssql.TMssqlGrant
As of v1.9.4.1, replaced by
TGrantStmt |
gudusoft.gsqlparser.stmt.mysql.TMySQLBlock
since GSP Java version 2.5.1.2, use
TCommonBlock instead. |
gudusoft.gsqlparser.stmt.mysql.TMySQLCallStmt
since GSP Java version 2.5.1.2, use
TCallStatement instead. |
gudusoft.gsqlparser.stmt.mysql.TMySQLCreateFunction
since GSP Java version 2.5.1.2, use
TCreateFunctionStmt instead. |
gudusoft.gsqlparser.stmt.mysql.TMySQLCreateProcedure
since GSP Java version 2.3.9.3, use
TCreateProcedureStmt instead. |
gudusoft.gsqlparser.stmt.mysql.TMySQLCreateTrigger
As of v2.0.1.0, replaced by
TCreateTriggerStmt |
gudusoft.gsqlparser.stmt.mysql.TMySQLFetchCursor
As of v2.5.1.3, replaced by
TFetchStmt |
gudusoft.gsqlparser.stmt.mysql.TMySQLLoopStmt
since GSP Java version 2.3.9.3, use
TLoopStmt instead. |
gudusoft.gsqlparser.stmt.mysql.TMySQLOpenCursor
As of v2.5.1.3, replaced by
TOpenStmt |
gudusoft.gsqlparser.stmt.mysql.TMySQLRepeatStmt
As of v2.0.4.6, replaced by
TRepeatStmt |
gudusoft.gsqlparser.stmt.mysql.TMySQLReturn
since GSP Java version 2.5.1.2, use
TReturnStmt instead. |
gudusoft.gsqlparser.stmt.mysql.TMySQLSet
since GSP Java version 2.5.1.2, use
TSetStmt instead. |
gudusoft.gsqlparser.stmt.mysql.TMySQLWhileStmt
As of v2.0.5.3, use
TWhileStmt instead |
gudusoft.gsqlparser.stmt.oracle.TOracleCreateSequenceStmt
As of v1.4.4.5, replaced by
TCreateSequenceStmt |
gudusoft.gsqlparser.stmt.oracle.TOracleCreateSynonymStmt
As of v1.4.4.5, replaced by
TCreateSynonymStmt |
gudusoft.gsqlparser.nodes.TOutputFormatPhrase
As of v1.4.9.8, use TExplicitDataTypeConversion instead
teradata output format phrase
|
gudusoft.gsqlparser.nodes.TOutputFormatPhraseList
As of v1.4.9.8, use TExplicitDataTypeConversion with instead
|
gudusoft.gsqlparser.nodes.TPartitionByClause
As of v1.8.6.0, replaced by
TPartitionClause |
gudusoft.gsqlparser.stmt.postgresql.TPlsqlCreateTriggerSqlStatement
As of v2.0.1.0, replaced by
TCreateTriggerStmt
Create trigger |
gudusoft.gsqlparser.stmt.oracle.TPlsqlSubProgram
As of v1.6.4.1
|
gudusoft.gsqlparser.stmt.redshift.TRedshiftCreateSchema
since GSP Java version 2.5.2.5, use
TCreateSchemaSqlStatement instead. |
gudusoft.gsqlparser.stmt.redshift.TRedshiftLock
since version, 2.9.3.5, use
TLockTableStmt instead. |
gudusoft.gsqlparser.stmt.redshift.TRedshiftUnload
since version 2.5.9.1, use
TUnloadStmt instead. |
gudusoft.gsqlparser.stmt.postgresql.TSetSearchPathStmt
since GSP Java version 2.6.1.2, use
TSetStmt instead. |
gudusoft.gsqlparser.stmt.teradata.TTeradataCreateProcedure
As of v2.0.7.7, replaced by
TCreateProcedureStmt |
gudusoft.gsqlparser.stmt.teradata.TTeradataCreateTrigger
As of v2.0.1.0, replaced by
TCreateTriggerStmt |
gudusoft.gsqlparser.stmt.TUseStmt
since v2.6.2.8, please use
TUseDatabase instead. |
gudusoft.gsqlparser.nodes.TValueRowItem
As of v2.3.6.9, please use
TMultiTarget instead |
gudusoft.gsqlparser.nodes.TValueRowItemList
As of v2.3.6.9, please use
TMultiTargetList instead |
gudusoft.gsqlparser.nodes.TWindowDefinition
As of v1.8.6.0, replaced by
TWindowDef |
gudusoft.gsqlparser.nodes.TWindowSpecification
As of v1.8.6.0, replaced by
TWindowDef |