Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
apache
Shardingsphere
提交
c012463e
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,发现更多精彩内容 >>
提交
c012463e
编写于
5月 07, 2019
作者:
T
tristaZero
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'dev' of
ssh://github.com/shardingjdbc/sharding-jdbc
into dev
上级
02fbe161
73801657
变更
19
隐藏空白更改
内联
并排
Showing
19 changed file
with
371 addition
and
26 deletion
+371
-26
sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/antlr/extractor/impl/dml/select/groupby/AscNullOrderDirectionGroupByExtractor.java
...select/groupby/AscNullOrderDirectionGroupByExtractor.java
+33
-0
sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/antlr/extractor/impl/dml/select/groupby/DescNullOrderDirectionGroupByExtractor.java
...elect/groupby/DescNullOrderDirectionGroupByExtractor.java
+33
-0
sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/antlr/extractor/impl/dml/select/groupby/GroupByExtractor.java
...r/extractor/impl/dml/select/groupby/GroupByExtractor.java
+8
-4
sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/antlr/extractor/impl/dml/select/orderby/AscNullOrderDirectionOrderByExtractor.java
...select/orderby/AscNullOrderDirectionOrderByExtractor.java
+32
-0
sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/antlr/extractor/impl/dml/select/orderby/DescNullOrderDirectionOrderByExtractor.java
...elect/orderby/DescNullOrderDirectionOrderByExtractor.java
+32
-0
sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/antlr/extractor/impl/dml/select/orderby/OrderByExtractor.java
...r/extractor/impl/dml/select/orderby/OrderByExtractor.java
+7
-4
sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/antlr/extractor/impl/dml/select/orderby/OrderByItemExtractor.java
...tractor/impl/dml/select/orderby/OrderByItemExtractor.java
+8
-4
sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/resources/META-INF/parsing-rule-definition/common/extractor-rule-definition.xml
...sing-rule-definition/common/extractor-rule-definition.xml
+0
-2
sharding-core/sharding-core-parse/sharding-core-parse-mysql/src/main/antlr4/imports/mysql/Keyword.g4
...core-parse-mysql/src/main/antlr4/imports/mysql/Keyword.g4
+8
-0
sharding-core/sharding-core-parse/sharding-core-parse-mysql/src/main/antlr4/imports/mysql/MySQLKeyword.g4
...parse-mysql/src/main/antlr4/imports/mysql/MySQLKeyword.g4
+0
-8
sharding-core/sharding-core-parse/sharding-core-parse-mysql/src/main/resources/META-INF/parsing-rule-definition/sharding/mysql/extractor-rule-definition.xml
...e-definition/sharding/mysql/extractor-rule-definition.xml
+3
-0
sharding-core/sharding-core-parse/sharding-core-parse-oracle/src/main/antlr4/imports/oracle/Keyword.g4
...re-parse-oracle/src/main/antlr4/imports/oracle/Keyword.g4
+8
-0
sharding-core/sharding-core-parse/sharding-core-parse-postgresql/src/main/antlr4/imports/postgresql/BaseRule.g4
...postgresql/src/main/antlr4/imports/postgresql/BaseRule.g4
+3
-2
sharding-core/sharding-core-parse/sharding-core-parse-postgresql/src/main/antlr4/imports/postgresql/DMLStatement.g4
...gresql/src/main/antlr4/imports/postgresql/DMLStatement.g4
+166
-0
sharding-core/sharding-core-parse/sharding-core-parse-postgresql/src/main/antlr4/imports/postgresql/Keyword.g4
...-postgresql/src/main/antlr4/imports/postgresql/Keyword.g4
+8
-0
sharding-core/sharding-core-parse/sharding-core-parse-postgresql/src/main/antlr4/imports/postgresql/PostgreSQLKeyword.g4
...l/src/main/antlr4/imports/postgresql/PostgreSQLKeyword.g4
+4
-0
sharding-core/sharding-core-parse/sharding-core-parse-postgresql/src/main/antlr4/org/apache/shardingsphere/core/parse/antlr/autogen/PostgreSQLStatement.g4
...ingsphere/core/parse/antlr/autogen/PostgreSQLStatement.g4
+6
-2
sharding-core/sharding-core-parse/sharding-core-parse-postgresql/src/main/resources/META-INF/parsing-rule-definition/sharding/postgresql/extractor-rule-definition.xml
...inition/sharding/postgresql/extractor-rule-definition.xml
+4
-0
sharding-core/sharding-core-parse/sharding-core-parse-sqlserver/src/main/antlr4/imports/sqlserver/Keyword.g4
...se-sqlserver/src/main/antlr4/imports/sqlserver/Keyword.g4
+8
-0
未找到文件。
sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/antlr/extractor/impl/dml/select/groupby/AscNullOrderDirectionGroupByExtractor.java
0 → 100644
浏览文件 @
c012463e
/*
* 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.
*/
package
org.apache.shardingsphere.core.parse.antlr.extractor.impl.dml.select.groupby
;
import
org.apache.shardingsphere.core.constant.OrderDirection
;
import
org.apache.shardingsphere.core.parse.antlr.extractor.impl.dml.select.orderby.OrderByItemExtractor
;
/**
* Group by extractor for ASC null order direction.
*
* @author zhangliang
*/
public
final
class
AscNullOrderDirectionGroupByExtractor
extends
GroupByExtractor
{
public
AscNullOrderDirectionGroupByExtractor
()
{
super
(
new
OrderByItemExtractor
(
OrderDirection
.
ASC
));
}
}
sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/antlr/extractor/impl/dml/select/groupby/DescNullOrderDirectionGroupByExtractor.java
0 → 100644
浏览文件 @
c012463e
/*
* 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.
*/
package
org.apache.shardingsphere.core.parse.antlr.extractor.impl.dml.select.groupby
;
import
org.apache.shardingsphere.core.constant.OrderDirection
;
import
org.apache.shardingsphere.core.parse.antlr.extractor.impl.dml.select.orderby.OrderByItemExtractor
;
/**
* Group by extractor for DESC null order direction.
*
* @author zhangliang
*/
public
final
class
DescNullOrderDirectionGroupByExtractor
extends
GroupByExtractor
{
public
DescNullOrderDirectionGroupByExtractor
()
{
super
(
new
OrderByItemExtractor
(
OrderDirection
.
DESC
));
}
}
sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/antlr/extractor/impl/dml/select/GroupByExtractor.java
→
sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/antlr/extractor/impl/dml/select/
groupby/
GroupByExtractor.java
浏览文件 @
c012463e
...
...
@@ -15,11 +15,13 @@
* limitations under the License.
*/
package
org.apache.shardingsphere.core.parse.antlr.extractor.impl.dml.select
;
package
org.apache.shardingsphere.core.parse.antlr.extractor.impl.dml.select
.groupby
;
import
com.google.common.base.Optional
;
import
lombok.RequiredArgsConstructor
;
import
org.antlr.v4.runtime.ParserRuleContext
;
import
org.apache.shardingsphere.core.parse.antlr.extractor.api.OptionalSQLSegmentExtractor
;
import
org.apache.shardingsphere.core.parse.antlr.extractor.impl.dml.select.orderby.OrderByItemExtractor
;
import
org.apache.shardingsphere.core.parse.antlr.extractor.util.ExtractorUtils
;
import
org.apache.shardingsphere.core.parse.antlr.extractor.util.RuleName
;
import
org.apache.shardingsphere.core.parse.antlr.sql.segment.dml.order.GroupBySegment
;
...
...
@@ -31,13 +33,15 @@ import java.util.Map;
*
* @author duhongjun
* @author panjuan
* @author zhangliang
*/
public
final
class
GroupByExtractor
implements
OptionalSQLSegmentExtractor
{
@RequiredArgsConstructor
public
abstract
class
GroupByExtractor
implements
OptionalSQLSegmentExtractor
{
private
final
OrderByItemExtractor
orderByItemExtractor
=
new
OrderByItemExtractor
()
;
private
final
OrderByItemExtractor
orderByItemExtractor
;
@Override
public
Optional
<
GroupBySegment
>
extract
(
final
ParserRuleContext
ancestorNode
,
final
Map
<
ParserRuleContext
,
Integer
>
parameterMarkerIndexes
)
{
public
final
Optional
<
GroupBySegment
>
extract
(
final
ParserRuleContext
ancestorNode
,
final
Map
<
ParserRuleContext
,
Integer
>
parameterMarkerIndexes
)
{
Optional
<
ParserRuleContext
>
groupByNode
=
ExtractorUtils
.
findFirstChildNode
(
ancestorNode
,
RuleName
.
GROUP_BY_CLAUSE
);
return
groupByNode
.
isPresent
()
?
Optional
.
of
(
new
GroupBySegment
(
groupByNode
.
get
().
getStop
().
getStopIndex
(),
orderByItemExtractor
.
extract
(
groupByNode
.
get
(),
parameterMarkerIndexes
)))
:
Optional
.<
GroupBySegment
>
absent
();
...
...
sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/antlr/extractor/impl/dml/select/orderby/AscNullOrderDirectionOrderByExtractor.java
0 → 100644
浏览文件 @
c012463e
/*
* 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.
*/
package
org.apache.shardingsphere.core.parse.antlr.extractor.impl.dml.select.orderby
;
import
org.apache.shardingsphere.core.constant.OrderDirection
;
/**
* Order by extractor for ASC null order direction.
*
* @author zhangliang
*/
public
final
class
AscNullOrderDirectionOrderByExtractor
extends
OrderByExtractor
{
public
AscNullOrderDirectionOrderByExtractor
()
{
super
(
new
OrderByItemExtractor
(
OrderDirection
.
ASC
));
}
}
sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/antlr/extractor/impl/dml/select/orderby/DescNullOrderDirectionOrderByExtractor.java
0 → 100644
浏览文件 @
c012463e
/*
* 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.
*/
package
org.apache.shardingsphere.core.parse.antlr.extractor.impl.dml.select.orderby
;
import
org.apache.shardingsphere.core.constant.OrderDirection
;
/**
* Order by extractor for DESC null order direction.
*
* @author zhangliang
*/
public
final
class
DescNullOrderDirectionOrderByExtractor
extends
OrderByExtractor
{
public
DescNullOrderDirectionOrderByExtractor
()
{
super
(
new
OrderByItemExtractor
(
OrderDirection
.
DESC
));
}
}
sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/antlr/extractor/impl/dml/select/OrderByExtractor.java
→
sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/antlr/extractor/impl/dml/select/
orderby/
OrderByExtractor.java
浏览文件 @
c012463e
...
...
@@ -15,9 +15,10 @@
* limitations under the License.
*/
package
org.apache.shardingsphere.core.parse.antlr.extractor.impl.dml.select
;
package
org.apache.shardingsphere.core.parse.antlr.extractor.impl.dml.select
.orderby
;
import
com.google.common.base.Optional
;
import
lombok.RequiredArgsConstructor
;
import
org.antlr.v4.runtime.ParserRuleContext
;
import
org.apache.shardingsphere.core.parse.antlr.extractor.api.OptionalSQLSegmentExtractor
;
import
org.apache.shardingsphere.core.parse.antlr.extractor.util.ExtractorUtils
;
...
...
@@ -30,13 +31,15 @@ import java.util.Map;
* Order by extractor.
*
* @author duhongjun
* @author zhangliang
*/
public
final
class
OrderByExtractor
implements
OptionalSQLSegmentExtractor
{
@RequiredArgsConstructor
public
abstract
class
OrderByExtractor
implements
OptionalSQLSegmentExtractor
{
private
final
OrderByItemExtractor
orderByItemExtractor
=
new
OrderByItemExtractor
()
;
private
final
OrderByItemExtractor
orderByItemExtractor
;
@Override
public
Optional
<
OrderBySegment
>
extract
(
final
ParserRuleContext
ancestorNode
,
final
Map
<
ParserRuleContext
,
Integer
>
parameterMarkerIndexes
)
{
public
final
Optional
<
OrderBySegment
>
extract
(
final
ParserRuleContext
ancestorNode
,
final
Map
<
ParserRuleContext
,
Integer
>
parameterMarkerIndexes
)
{
Optional
<
ParserRuleContext
>
orderByNode
=
ExtractorUtils
.
findFirstChildNode
(
ancestorNode
,
RuleName
.
ORDER_BY_CLAUSE
);
return
orderByNode
.
isPresent
()
?
Optional
.
of
(
new
OrderBySegment
(
orderByItemExtractor
.
extract
(
orderByNode
.
get
(),
parameterMarkerIndexes
)))
:
Optional
.<
OrderBySegment
>
absent
();
}
...
...
sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/antlr/extractor/impl/dml/select/OrderByItemExtractor.java
→
sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/antlr/extractor/impl/dml/select/
orderby/
OrderByItemExtractor.java
浏览文件 @
c012463e
...
...
@@ -15,9 +15,10 @@
* limitations under the License.
*/
package
org.apache.shardingsphere.core.parse.antlr.extractor.impl.dml.select
;
package
org.apache.shardingsphere.core.parse.antlr.extractor.impl.dml.select
.orderby
;
import
com.google.common.base.Optional
;
import
lombok.RequiredArgsConstructor
;
import
org.antlr.v4.runtime.ParserRuleContext
;
import
org.apache.shardingsphere.core.constant.OrderDirection
;
import
org.apache.shardingsphere.core.parse.antlr.extractor.api.CollectionSQLSegmentExtractor
;
...
...
@@ -40,8 +41,11 @@ import java.util.Map;
*
* @author zhangliang
*/
@RequiredArgsConstructor
public
final
class
OrderByItemExtractor
implements
CollectionSQLSegmentExtractor
{
private
final
OrderDirection
nullOrderDirection
;
private
final
ColumnExtractor
columnExtractor
=
new
ColumnExtractor
();
@Override
...
...
@@ -51,17 +55,17 @@ public final class OrderByItemExtractor implements CollectionSQLSegmentExtractor
OrderDirection
orderDirection
=
2
==
each
.
getChildCount
()
&&
OrderDirection
.
DESC
.
name
().
equalsIgnoreCase
(
each
.
getChild
(
1
).
getText
())
?
OrderDirection
.
DESC
:
OrderDirection
.
ASC
;
Optional
<
ParserRuleContext
>
indexNode
=
ExtractorUtils
.
findFirstChildNode
(
each
,
RuleName
.
NUMBER_LITERALS
);
if
(
indexNode
.
isPresent
())
{
result
.
add
(
new
IndexOrderByItemSegment
(
NumberUtil
.
getExactlyNumber
(
indexNode
.
get
().
getText
(),
10
).
intValue
(),
orderDirection
,
OrderDirection
.
ASC
));
result
.
add
(
new
IndexOrderByItemSegment
(
NumberUtil
.
getExactlyNumber
(
indexNode
.
get
().
getText
(),
10
).
intValue
(),
orderDirection
,
nullOrderDirection
));
continue
;
}
Optional
<
ParserRuleContext
>
expressionNode
=
ExtractorUtils
.
findFirstChildNode
(
each
,
RuleName
.
EXPR
);
if
(
expressionNode
.
isPresent
())
{
result
.
add
(
new
ExpressionOrderByItemSegment
(
expressionNode
.
get
().
getText
(),
orderDirection
,
OrderDirection
.
ASC
));
result
.
add
(
new
ExpressionOrderByItemSegment
(
expressionNode
.
get
().
getText
(),
orderDirection
,
nullOrderDirection
));
continue
;
}
Optional
<
ColumnSegment
>
columnSegment
=
columnExtractor
.
extract
(
each
,
parameterMarkerIndexes
);
if
(
columnSegment
.
isPresent
())
{
result
.
add
(
new
ColumnOrderByItemSegment
(
columnSegment
.
get
(),
orderDirection
,
OrderDirection
.
ASC
));
result
.
add
(
new
ColumnOrderByItemSegment
(
columnSegment
.
get
(),
orderDirection
,
nullOrderDirection
));
}
}
return
result
;
...
...
sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/resources/META-INF/parsing-rule-definition/common/extractor-rule-definition.xml
浏览文件 @
c012463e
...
...
@@ -36,8 +36,6 @@
<extractor-rule
id=
"where"
extractor-class=
"org.apache.shardingsphere.core.parse.antlr.extractor.impl.dml.WhereExtractor"
/>
<extractor-rule
id=
"predicate"
extractor-class=
"org.apache.shardingsphere.core.parse.antlr.extractor.impl.dml.PredicateExtractor"
/>
<extractor-rule
id=
"selectItems"
extractor-class=
"org.apache.shardingsphere.core.parse.antlr.extractor.impl.dml.select.SelectItemsExtractor"
/>
<extractor-rule
id=
"groupBy"
extractor-class=
"org.apache.shardingsphere.core.parse.antlr.extractor.impl.dml.select.GroupByExtractor"
/>
<extractor-rule
id=
"orderBy"
extractor-class=
"org.apache.shardingsphere.core.parse.antlr.extractor.impl.dml.select.OrderByExtractor"
/>
<extractor-rule
id=
"limit"
extractor-class=
"org.apache.shardingsphere.core.parse.antlr.extractor.impl.dml.select.LimitExtractor"
/>
<extractor-rule
id=
"subqueryPredicate"
extractor-class=
"org.apache.shardingsphere.core.parse.antlr.extractor.impl.dml.select.SubqueryPredicateExtractor"
/>
</extractor-rule-definition>
sharding-core/sharding-core-parse/sharding-core-parse-mysql/src/main/antlr4/imports/mysql/Keyword.g4
浏览文件 @
c012463e
...
...
@@ -171,6 +171,10 @@ FROM
: F R O M
;
NATURAL
: N A T U R A L
;
JOIN
: J O I N
;
...
...
@@ -195,6 +199,10 @@ RIGHT
: R I G H T
;
CROSS
: C R O S S
;
USING
: U S I N G
;
...
...
sharding-core/sharding-core-parse/sharding-core-parse-mysql/src/main/antlr4/imports/mysql/MySQLKeyword.g4
浏览文件 @
c012463e
...
...
@@ -383,10 +383,6 @@ COPY
: C O P Y
;
CROSS
: C R O S S
;
DATA
: D A T A
;
...
...
@@ -519,10 +515,6 @@ MEMORY
: M E M O R Y
;
NATURAL
: N A T U R A L
;
NONE
: N O N E
;
...
...
sharding-core/sharding-core-parse/sharding-core-parse-mysql/src/main/resources/META-INF/parsing-rule-definition/sharding/mysql/extractor-rule-definition.xml
浏览文件 @
c012463e
...
...
@@ -22,6 +22,9 @@
<extractor-rule
id=
"changeColumnDefinition"
extractor-class=
"org.apache.shardingsphere.core.parse.extractor.ddl.MySQLChangeColumnDefinitionExtractor"
/>
<extractor-rule
id=
"dropPrimaryKey"
extractor-class=
"org.apache.shardingsphere.core.parse.extractor.ddl.MySQLDropPrimaryKeyExtractor"
/>
<extractor-rule
id=
"groupBy"
extractor-class=
"org.apache.shardingsphere.core.parse.antlr.extractor.impl.dml.select.groupby.AscNullOrderDirectionGroupByExtractor"
/>
<extractor-rule
id=
"orderBy"
extractor-class=
"org.apache.shardingsphere.core.parse.antlr.extractor.impl.dml.select.orderby.AscNullOrderDirectionOrderByExtractor"
/>
<extractor-rule
id=
"setAutoCommit"
extractor-class=
"org.apache.shardingsphere.core.parse.extractor.tcl.MySQLSetAutoCommitExtractor"
/>
<extractor-rule
id=
"showTables"
extractor-class=
"org.apache.shardingsphere.core.parse.extractor.dal.MySQLShowTablesExtractor"
/>
<extractor-rule
id=
"showTableStatus"
extractor-class=
"org.apache.shardingsphere.core.parse.extractor.dal.MySQLShowTableStatusExtractor"
/>
...
...
sharding-core/sharding-core-parse/sharding-core-parse-oracle/src/main/antlr4/imports/oracle/Keyword.g4
浏览文件 @
c012463e
...
...
@@ -171,6 +171,10 @@ FROM
: F R O M
;
NATURAL
: N A T U R A L
;
JOIN
: J O I N
;
...
...
@@ -195,6 +199,10 @@ RIGHT
: R I G H T
;
CROSS
: C R O S S
;
USING
: U S I N G
;
...
...
sharding-core/sharding-core-parse/sharding-core-parse-postgresql/src/main/antlr4/imports/postgresql/BaseRule.g4
浏览文件 @
c012463e
...
...
@@ -92,6 +92,7 @@ unreservedWord_
| SEQUENCE | SESSION | SHOW | SIMPLE | STATISTICS | STORAGE | TABLESPACE
| TEMP | TEMPORARY | TRIGGER | TYPE | UNBOUNDED | UNLOGGED | UPDATE
| USAGE | VALID | VALIDATE | WITHIN | WITHOUT | ZONE | GROUPS
| RECURSIVE
;
schemaName
...
...
@@ -260,11 +261,11 @@ regularFunction_
;
regularFunctionName_
: identifier_ | IF | CURRENT_TIMESTAMP | LOCALTIME | LOCALTIMESTAMP |
NOW | REPLACE |
INTERVAL
: identifier_ | IF | CURRENT_TIMESTAMP | LOCALTIME | LOCALTIMESTAMP | INTERVAL
;
caseExpression_
: CASE simpleExpr? caseWhen_+ caseElse_?
END
: CASE simpleExpr? caseWhen_+ caseElse_?
;
caseWhen_
...
...
sharding-core/sharding-core-parse/sharding-core-parse-postgresql/src/main/antlr4/imports/postgresql/DMLStatement.g4
0 → 100644
浏览文件 @
c012463e
/*
* 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, PostgreSQLKeyword, Literals, BaseRule;
insert
: INSERT INTO tableName (AS? alias)? (insertValuesClause | insertSelectClause)
;
insertValuesClause
: columnNames? VALUES assignmentValues (COMMA_ assignmentValues)*
;
insertSelectClause
: columnNames? select
;
update
: UPDATE updateSpecification_? tableReferences setAssignmentsClause whereClause?
;
updateSpecification_
: ONLY
;
assignment
: columnName EQ_ assignmentValue
;
setAssignmentsClause
: SET assignment (COMMA_ assignment)*
;
assignmentValues
: LP_ assignmentValue (COMMA_ assignmentValue)* RP_
| LP_ RP_
;
assignmentValue
: expr | DEFAULT
;
delete
: DELETE deleteSpecification_? (singleTableClause_ | multipleTablesClause_) whereClause?
;
deleteSpecification_
: ONLY
;
singleTableClause_
: FROM tableName (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? limitClause?
;
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 AS? alias 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
;
limitClause
: (LIMIT (ALL | limitRowCount))? (OFFSET limitOffset (ROW | ROWS)?)?
;
limitRowCount
: numberLiterals | parameterMarker
;
limitOffset
: numberLiterals | parameterMarker
;
subquery
: LP_ unionClause_ RP_
;
sharding-core/sharding-core-parse/sharding-core-parse-postgresql/src/main/antlr4/imports/postgresql/Keyword.g4
浏览文件 @
c012463e
...
...
@@ -171,6 +171,10 @@ FROM
: F R O M
;
NATURAL
: N A T U R A L
;
JOIN
: J O I N
;
...
...
@@ -195,6 +199,10 @@ RIGHT
: R I G H T
;
CROSS
: C R O S S
;
USING
: U S I N G
;
...
...
sharding-core/sharding-core-parse/sharding-core-parse-postgresql/src/main/antlr4/imports/postgresql/PostgreSQLKeyword.g4
浏览文件 @
c012463e
...
...
@@ -482,3 +482,7 @@ UESCAPE
GROUPS
: G R O U P S
;
RECURSIVE
: R E C U R S I V E
;
\ No newline at end of file
sharding-core/sharding-core-parse/sharding-core-parse-postgresql/src/main/antlr4/org/apache/shardingsphere/core/parse/antlr/autogen/PostgreSQLStatement.g4
浏览文件 @
c012463e
...
...
@@ -17,10 +17,14 @@
grammar PostgreSQLStatement;
import Symbol, Comments, DDLStatement, TCLStatement, DCLStatement, DALStatement;
import Symbol, Comments, DDLStatement,
DMLStatement,
TCLStatement, DCLStatement, DALStatement;
execute
: (createIndex
: (select
| insert
| update
| delete
| createIndex
| alterIndex
| dropIndex
| createTable
...
...
sharding-core/sharding-core-parse/sharding-core-parse-postgresql/src/main/resources/META-INF/parsing-rule-definition/sharding/postgresql/extractor-rule-definition.xml
浏览文件 @
c012463e
...
...
@@ -19,5 +19,9 @@
<extractor-rule-definition>
<extractor-rule
id=
"addColumnDefinition"
extractor-class=
"org.apache.shardingsphere.core.parse.antlr.extractor.impl.ddl.column.AddColumnDefinitionExtractor"
/>
<extractor-rule
id=
"modifyColumnDefinition"
extractor-class=
"org.apache.shardingsphere.core.parse.antlr.extractor.impl.ddl.column.ModifyColumnDefinitionExtractor"
/>
<extractor-rule
id=
"groupBy"
extractor-class=
"org.apache.shardingsphere.core.parse.antlr.extractor.impl.dml.select.groupby.DescNullOrderDirectionGroupByExtractor"
/>
<extractor-rule
id=
"orderBy"
extractor-class=
"org.apache.shardingsphere.core.parse.antlr.extractor.impl.dml.select.orderby.DescNullOrderDirectionOrderByExtractor"
/>
<extractor-rule
id=
"showParam"
extractor-class=
"org.apache.shardingsphere.core.parse.extractor.ShowParamExtractor"
/>
</extractor-rule-definition>
sharding-core/sharding-core-parse/sharding-core-parse-sqlserver/src/main/antlr4/imports/sqlserver/Keyword.g4
浏览文件 @
c012463e
...
...
@@ -171,6 +171,10 @@ FROM
: F R O M
;
NATURAL
: N A T U R A L
;
JOIN
: J O I N
;
...
...
@@ -195,6 +199,10 @@ RIGHT
: R I G H T
;
CROSS
: C R O S S
;
USING
: U S I N G
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录