mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
Updated Druid_SQL_AST (markdown)
+12
-4
@@ -15,7 +15,7 @@ class SQLSelect extends SQLObject {}
|
||||
class SQLSelectQueryBlock extends SQLObject {}
|
||||
```
|
||||
|
||||
## 2.1 常用的SQLExpr有哪些
|
||||
## 2.1. 常用的SQLExpr有哪些
|
||||
```java
|
||||
package com.alibaba.druid.sql.ast.expr;
|
||||
|
||||
@@ -40,7 +40,7 @@ class SQLBinaryOpExpr implements SQLExpr {
|
||||
}
|
||||
```
|
||||
|
||||
## 2.2 常用的SQLStatemment
|
||||
## 2.2. 常用的SQLStatemment
|
||||
最常用的Statement当然是SELECT/UPDATE/DELETE/INSERT,他们分别是
|
||||
```java
|
||||
package com.alibaba.druid.sql.ast.statement;
|
||||
@@ -64,24 +64,32 @@ class SQLInsertStatement implements SQLStatement {
|
||||
}
|
||||
```
|
||||
|
||||
## 2.3 SQLTableSource
|
||||
## 2.3. SQLTableSource
|
||||
```java
|
||||
class SQLTableSourceImpl extends SQLObjectImpl implements SQLTableSource {
|
||||
String alias;
|
||||
}
|
||||
|
||||
// select * from emp where i = 3,这里的from emp是一个SQLExprTableSource
|
||||
// 例如 select * from emp where i = 3,这里的from emp是一个SQLExprTableSource
|
||||
// 其中expr是一个name=emp的SQLIdentifierExpr
|
||||
class SQLExprTableSource extends SQLTableSourceImpl {
|
||||
SQLExpr expr;
|
||||
}
|
||||
|
||||
// 例如 select * from emp e inner join org o on e.org_id = o.id
|
||||
// 其中left 'emp e' 是一个SQLExprTableSource,right 'org o'也是一个SQLExprTableSource
|
||||
// condition 'e.org_id = o.id'是一个SQLBinaryOpExpr
|
||||
class SQLJoinTableSource extends SQLTableSourceImpl {
|
||||
SQLTableSource left;
|
||||
SQLTableSource right;
|
||||
JoinType joinType; // INNER_JOIN/CROSS_JOIN/LEFT_OUTER_JOIN/RIGHT_OUTER_JOIN/...
|
||||
SQLExpr condition;
|
||||
}
|
||||
|
||||
// 例如 select * from (select * from temp) a,这里第一层from(...)是一个SQLSubqueryTableSource
|
||||
SQLSubqueryTableSource extends SQLTableSourceImpl {
|
||||
SQLSelect select;
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user