|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgudusoft.gsqlparser.nodes.TParseTreeNode
gudusoft.gsqlparser.TCustomSqlStatement
public class TCustomSqlStatement
TCustomSqlStatement is the root class for all SQL statements.
Field Summary | |
---|---|
EDbVendor |
dbvendor
SQL dialect of this statement. |
int |
dummytag
Tag used by parser internally. |
TJoinList |
joins
joins represents table sources in following clauses of SQL statement: from clause of select statement. from clause of delete statement, Specifies an additional FROM clause, This Transact-SQL extension to DELETE allows specifying data from table_source and deleting the corresponding rows from the table in the first FROM clause. from clause of update statement, Specifies that a table, view, or derived table source is used to provide the criteria for the update operation. |
TCustomParser |
parser
Parser used to parse this statement. |
TCustomParser |
plsqlparser
PLSQL parser used to parse this statement. |
TParseTreeNode |
rootNode
Original Parse tree node from parser |
TSourceTokenList |
sourcetokenlist
Source tokens included in this statement. |
ESqlStatementType |
sqlstatementtype
Type of this statement. |
TTableList |
tables
Provides a quick way to access all tables SQL statements. |
Constructor Summary | |
---|---|
TCustomSqlStatement(EDbVendor dbvendor)
|
Method Summary | |
---|---|
TWhereClause |
addWhereClause(java.lang.String condition)
This method must be override in select/delete/update statement |
TTable |
analyzeFromTable(TFromTable pfromTable)
|
TJoin |
analyzeJoin(TJoinExpr pJoinExpr,
TJoin pJoin,
java.lang.Boolean isSub)
|
TTable |
analyzeTablename(TObjectName tableName)
|
boolean |
checkNonQualifiedColumnReferenceInSubQueryOfUplevelStmt(TObjectName crf,
boolean sameLevelOnly)
Found out is a non qualified column is a column in uplevel subquery table like this: take ma_parkey for example: ma_parkey is not a physical column SELECT c_mandant , CASE WHEN EXISTS (SELECT 1 FROM CDS_H_GRUPPE GRP1 WHERE GRP1.c_mandant = c_mandant AND GRP1.parkey1 = ma_parkey) THEN 1 ELSE NULL END MA_ME FROM (SELECT c_mandant , CASE WHEN funktionscode = 'U' THEN parkey1 ELSE parkey2 END MA_PARKEY FROM CDS_H_GRUPPE ) |
int |
doParseStatement(TCustomSqlStatement psql)
|
TCTEList |
getCteList()
Multiple common table expressions TCTE can be specified following the single WITH keyword. |
int |
getErrorCount()
Number of syntax errors for this statement. |
TObjectName |
getLabelName()
|
TOutputClause |
getOutputClause()
Used in delete, update statement. |
TCustomSqlStatement |
getParentStmt()
|
TResultColumnList |
getResultColumnList()
Items in select_list. |
TReturningClause |
getReturningClause()
Used in delete, update statement. |
TStatementList |
getStatements()
Saves all first level sub statements. |
java.util.Stack |
getSymbolTable()
|
TTable |
getTargetTable()
target table in the delete/insert/update/create table statement. |
TTopClause |
getTopClause()
Used in select, delete, update statement. |
TCustomSqlStatement |
getTopStatement()
|
TWhereClause |
getWhereClause()
restrict the rows selected to those that satisfy one or more conditions. |
boolean |
isnzplsql()
|
boolean |
isoracleplsql()
|
boolean |
ispgplsql()
|
void |
linkColumnReferenceToTable(TObjectName cr,
ESqlClause plocation)
|
int |
locateVariableOrParameter(TObjectName cr)
|
boolean |
OracleStatementCanBeSeparatedByBeginEndPair()
|
int |
parsestatement(TCustomSqlStatement pparentsql,
boolean isparsetreeavailable)
Parse this statement. |
void |
setCteList(TCTEList cteList)
|
void |
setLabelName(TObjectName labelName)
|
void |
setOutputClause(TOutputClause outputClause)
|
void |
setParentStmt(TCustomSqlStatement parentStmt)
|
void |
setResultColumnList(TResultColumnList resultColumnList)
|
void |
setReturningClause(TReturningClause returningClause)
|
void |
setTargetTable(TTable targetTable)
|
void |
setTopClause(TTopClause topClause)
|
void |
setWhereClause(TWhereClause whereClause)
|
Methods inherited from class gudusoft.gsqlparser.nodes.TParseTreeNode |
---|
accept, addAllMyTokensToTokenList, doParse, getColumnNo, getDummyTag, getEndToken, getGsqlparser, getLineNo, getNodeType, getStartToken, init, init, init, init, init, init, setDummyTag, setEndToken, setEndToken, setGsqlparser, setNodeType, setStartToken, setStartToken, setString, toString |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public ESqlStatementType sqlstatementtype
public TSourceTokenList sourcetokenlist
TParseTreeNode.getStartToken()
, and TParseTreeNode.getEndToken()
of this statement.
public EDbVendor dbvendor
public TCustomParser parser
public TCustomParser plsqlparser
public int dummytag
public TJoinList joins
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.
Please check TJoin
for more informations.
getTargetTable()
public TTableList tables
It stores all tables in a flat way while joins
stores all tables in a hierarchical structure.
joins only represents tables in from clause of select/delete statement, and tables in update/insert statement.
tables
includes all tables in all types of SQL statements such as tables invovled in a create table or create trigger statements.
items in tables
in type of TTable
while items in joins
is type of TJoin
.
public TParseTreeNode rootNode
Constructor Detail |
---|
public TCustomSqlStatement(EDbVendor dbvendor)
Method Detail |
---|
public void setLabelName(TObjectName labelName)
public TObjectName getLabelName()
public TTable getTargetTable()
joins
,
TSelectSqlStatement
,
TDeleteSqlStatement
,
TUpdateSqlStatement
,
TCreateTableSqlStatement
,
TMergeSqlStatement
public void setTargetTable(TTable targetTable)
public TStatementList getStatements()
By iterating statements recursively, you can fetch all included statements in an easy way.
select f1+(select f2 from t2) from t1 where f2 > all (select f3 from t3 where f4 = (select f5 from t4))
Statements included in above SQL was save in a hierarchical way like this:
If this statement is a create procedure/function statement, then all declaration statements and statements in procedure body can also be fetched quickly by iterating this property recusively.
public void setCteList(TCTEList cteList)
public TCTEList getCteList()
TCTE
can be specified following the single WITH keyword.
Each common table expression specified can also be referenced by name in the FROM clause of subsequent common table expressions.
Used in select, delete, update statement.
public void setResultColumnList(TResultColumnList resultColumnList)
public TResultColumnList getResultColumnList()
set clause in update statement.
public void setReturningClause(TReturningClause returningClause)
public TReturningClause getReturningClause()
public void setOutputClause(TOutputClause outputClause)
public TOutputClause getOutputClause()
public void setTopClause(TTopClause topClause)
public TTopClause getTopClause()
public void setWhereClause(TWhereClause whereClause)
public TWhereClause addWhereClause(java.lang.String condition)
condition
-
public TWhereClause getWhereClause()
public TCustomSqlStatement getParentStmt()
public void setParentStmt(TCustomSqlStatement parentStmt)
public java.util.Stack getSymbolTable()
public int getErrorCount()
public int parsestatement(TCustomSqlStatement pparentsql, boolean isparsetreeavailable)
pparentsql
- isparsetreeavailable
-
public boolean OracleStatementCanBeSeparatedByBeginEndPair()
public boolean isnzplsql()
public boolean ispgplsql()
public boolean isoracleplsql()
public int doParseStatement(TCustomSqlStatement psql)
public TTable analyzeTablename(TObjectName tableName)
public TTable analyzeFromTable(TFromTable pfromTable)
public TJoin analyzeJoin(TJoinExpr pJoinExpr, TJoin pJoin, java.lang.Boolean isSub)
public int locateVariableOrParameter(TObjectName cr)
public void linkColumnReferenceToTable(TObjectName cr, ESqlClause plocation)
public boolean checkNonQualifiedColumnReferenceInSubQueryOfUplevelStmt(TObjectName crf, boolean sameLevelOnly)
crf
-
public TCustomSqlStatement getTopStatement()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |