Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
apache
Shardingsphere
提交
169a43e6
Shardingsphere
项目概览
apache
/
Shardingsphere
通知
56
Star
3
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Shardingsphere
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
169a43e6
编写于
5月 11, 2019
作者:
T
terrymanu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
for #2084, add dml for sqlserver
上级
093f4880
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
152 addition
and
1 deletion
+152
-1
sharding-core/sharding-core-parse/sharding-core-parse-sqlserver/src/main/antlr4/imports/sqlserver/DMLStatement.g4
...lserver/src/main/antlr4/imports/sqlserver/DMLStatement.g4
+146
-0
sharding-core/sharding-core-parse/sharding-core-parse-sqlserver/src/main/antlr4/org/apache/shardingsphere/core/parse/antlr/autogen/SQLServerStatement.g4
...dingsphere/core/parse/antlr/autogen/SQLServerStatement.g4
+1
-1
sharding-core/sharding-core-parse/sharding-core-parse-sqlserver/src/main/resources/META-INF/parsing-rule-definition/sharding/sqlserver/sql-statement-rule-definition.xml
...tion/sharding/sqlserver/sql-statement-rule-definition.xml
+5
-0
未找到文件。
sharding-core/sharding-core-parse/sharding-core-parse-sqlserver/src/main/antlr4/imports/sqlserver/DMLStatement.g4
0 → 100644
浏览文件 @
169a43e6
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
grammar DMLStatement;
import Symbol, Keyword, SQLServerKeyword, Literals, BaseRule;
insert
: INSERT INTO tableName (AS? alias)? (insertValuesClause | insertSelectClause)
;
insertValuesClause
: columnNames? VALUES assignmentValues (COMMA_ assignmentValues)*
;
insertSelectClause
: columnNames? select
;
update
: UPDATE tableReferences setAssignmentsClause whereClause?
;
assignment
: columnName EQ_ assignmentValue
;
setAssignmentsClause
: SET assignment (COMMA_ assignment)*
;
assignmentValues
: LP_ assignmentValue (COMMA_ assignmentValue)* RP_
| LP_ RP_
;
assignmentValue
: expr | DEFAULT
;
delete
: DELETE (singleTableClause_ | multipleTablesClause_) whereClause?
;
singleTableClause_
: FROM? LP_? tableName RP_? (AS? alias)?
;
multipleTablesClause_
: multipleTableNames_ FROM tableReferences | FROM multipleTableNames_ USING tableReferences
;
multipleTableNames_
: tableName DOT_ASTERISK_? (COMMA_ tableName DOT_ASTERISK_?)*
;
select
: unionClause_
;
unionClause_
: selectClause (UNION (ALL | DISTINCT)? selectClause)*
;
selectClause
: SELECT duplicateSpecification? selectItems fromClause? whereClause? groupByClause? havingClause? orderByClause?
;
duplicateSpecification
: ALL | DISTINCT
;
selectItems
: (unqualifiedShorthand | selectItem) (COMMA_ selectItem)*
;
selectItem
: (columnName | expr) (AS? alias)? | qualifiedShorthand
;
alias
: identifier_ | STRING_
;
unqualifiedShorthand
: ASTERISK_
;
qualifiedShorthand
: identifier_ DOT_ASTERISK_
;
fromClause
: FROM tableReferences
;
tableReferences
: tableReference (COMMA_ tableReference)*
;
tableReference
: (tableFactor joinedTable)+ | tableFactor joinedTable*
;
tableFactor
: tableName (AS? alias)? | subquery columnNames? | LP_ tableReferences RP_
;
joinedTable
: NATURAL? ((INNER | CROSS)? JOIN) tableFactor joinSpecification?
| NATURAL? (LEFT | RIGHT | FULL) OUTER? JOIN tableFactor joinSpecification?
;
joinSpecification
: ON expr | USING columnNames
;
whereClause
: WHERE expr
;
groupByClause
: GROUP BY orderByItem (COMMA_ orderByItem)*
;
havingClause
: HAVING expr
;
subquery
: LP_ unionClause_ RP_ AS? alias?
;
sharding-core/sharding-core-parse/sharding-core-parse-sqlserver/src/main/antlr4/org/apache/shardingsphere/core/parse/antlr/autogen/SQLServerStatement.g4
浏览文件 @
169a43e6
...
...
@@ -17,7 +17,7 @@
grammar SQLServerStatement;
import Symbol, Comments, DDLStatement, TCLStatement, DCLStatement;
import Symbol, Comments, D
MLStatement, D
DLStatement, TCLStatement, DCLStatement;
execute
: (createIndex
...
...
sharding-core/sharding-core-parse/sharding-core-parse-sqlserver/src/main/resources/META-INF/parsing-rule-definition/sharding/sqlserver/sql-statement-rule-definition.xml
浏览文件 @
169a43e6
...
...
@@ -25,6 +25,11 @@
<sql-statement-rule
context=
"alterIndex"
sql-statement-class=
"org.apache.shardingsphere.core.parse.antlr.sql.statement.ddl.DDLStatement"
extractor-rule-refs=
"table, index"
/>
<sql-statement-rule
context=
"dropIndex"
sql-statement-class=
"org.apache.shardingsphere.core.parse.antlr.sql.statement.ddl.DDLStatement"
extractor-rule-refs=
"table, index"
/>
<sql-statement-rule
context=
"insert"
sql-statement-class=
"org.apache.shardingsphere.core.parse.antlr.sql.statement.dml.InsertStatement"
extractor-rule-refs=
"table, columns, insertColumns, insertValues"
/>
<sql-statement-rule
context=
"update"
sql-statement-class=
"org.apache.shardingsphere.core.parse.antlr.sql.statement.dml.UpdateStatement"
extractor-rule-refs=
"tableReferences, columns, setAssignments, where, predicate"
/>
<sql-statement-rule
context=
"delete"
sql-statement-class=
"org.apache.shardingsphere.core.parse.antlr.sql.statement.dml.DeleteStatement"
extractor-rule-refs=
"tables, columns, where, predicate"
/>
<sql-statement-rule
context=
"select"
sql-statement-class=
"org.apache.shardingsphere.core.parse.antlr.sql.statement.dml.SelectStatement"
extractor-rule-refs=
"tableReferences, columns, selectItems, subqueryPredicate, where, predicate, groupBy, orderBy"
optimizer-class=
"org.apache.shardingsphere.core.parse.antlr.optimizer.select.SelectOptimizer"
/>
<sql-statement-rule
context=
"setTransaction"
sql-statement-class=
"org.apache.shardingsphere.core.parse.antlr.sql.statement.tcl.SetTransactionStatement"
/>
<sql-statement-rule
context=
"setImplicitTransactions"
sql-statement-class=
"org.apache.shardingsphere.core.parse.antlr.sql.statement.tcl.SetAutoCommitStatement"
extractor-rule-refs=
"setImplicitTransactions"
/>
<sql-statement-rule
context=
"beginTransaction"
sql-statement-class=
"org.apache.shardingsphere.core.parse.antlr.sql.statement.tcl.BeginTransactionStatement"
/>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录