Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
apache
Shardingsphere
提交
e3e96870
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,体验更适合开发者的 AI 搜索 >>
提交
e3e96870
编写于
8月 21, 2017
作者:
H
haocao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Refactor parser and integrate test cases from to do xml 13th.
上级
75961108
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
21 addition
and
24 deletion
+21
-24
sharding-jdbc-core/src/test/java/com/dangdang/ddframe/rdb/common/jaxb/helper/SQLStatementHelper.java
...ng/ddframe/rdb/common/jaxb/helper/SQLStatementHelper.java
+10
-5
sharding-jdbc-core/src/test/resources/parser/create.xml
sharding-jdbc-core/src/test/resources/parser/create.xml
+2
-2
sharding-jdbc-core/src/test/resources/parser/select_pagination_group_by_order_by.xml
.../resources/parser/select_pagination_group_by_order_by.xml
+8
-16
sharding-jdbc-core/src/test/resources/sql/ddl/create.xml
sharding-jdbc-core/src/test/resources/sql/ddl/create.xml
+1
-1
未找到文件。
sharding-jdbc-core/src/test/java/com/dangdang/ddframe/rdb/common/jaxb/helper/SQLStatementHelper.java
浏览文件 @
e3e96870
...
...
@@ -13,7 +13,6 @@ import javax.xml.bind.JAXBException;
import
java.io.File
;
import
java.net.URL
;
import
java.util.Collection
;
import
java.util.Collections
;
import
java.util.HashMap
;
import
java.util.HashSet
;
import
java.util.Map
;
...
...
@@ -73,13 +72,13 @@ public final class SQLStatementHelper {
}
public
static
String
getSql
(
final
String
sqlId
)
{
return
STATEMENT_MAP
.
get
(
sqlId
).
getSql
();
checkSqlId
(
sqlId
);
SQLStatement
statement
=
STATEMENT_MAP
.
get
(
sqlId
);
return
statement
.
getSql
();
}
public
static
Set
<
DatabaseType
>
getTypes
(
final
String
sqlId
)
{
if
(
null
==
sqlId
||
!
STATEMENT_MAP
.
containsKey
(
sqlId
))
{
return
Collections
.
emptySet
();
}
checkSqlId
(
sqlId
);
SQLStatement
statement
=
STATEMENT_MAP
.
get
(
sqlId
);
if
(
null
==
statement
.
getTypes
())
{
return
Sets
.
newHashSet
(
DatabaseType
.
values
());
...
...
@@ -90,4 +89,10 @@ public final class SQLStatementHelper {
}
return
result
;
}
private
static
void
checkSqlId
(
final
String
sqlId
)
{
if
(
null
==
sqlId
||
!
STATEMENT_MAP
.
containsKey
(
sqlId
))
{
throw
new
RuntimeException
(
"Can't find sql of id:"
+
sqlId
);
}
}
}
sharding-jdbc-core/src/test/resources/parser/create.xml
浏览文件 @
e3e96870
...
...
@@ -15,12 +15,12 @@
<table
name=
"t_order"
/>
</tables>
</assert>
<assert
id=
"assertCreate
TempGlobal
Table"
>
<assert
id=
"assertCreate
GlobalTemporary
Table"
>
<tables>
<table
name=
"t_order"
/>
</tables>
</assert>
<assert
id=
"assertCreate
TempLocalTemporary
Table"
>
<assert
id=
"assertCreate
LocalTemp
Table"
>
<tables>
<table
name=
"t_order"
/>
</tables>
...
...
sharding-jdbc-core/src/test/resources/parser/select_pagination_group_by_order_by.xml
浏览文件 @
e3e96870
...
...
@@ -46,11 +46,10 @@
</order-by-columns>
<limit
offset=
"5"
offset-index=
"4"
row-count=
"3"
row-count-index=
"5"
/>
</assert>
<assert
id=
"assertSelectPaginationWith
GroupByAndOrderByInSQLServer
"
parameters=
"3,1,2,9,10,6"
>
<assert
id=
"assertSelectPaginationWith
TopAndGroupByAndOrderBy
"
parameters=
"3,1,2,9,10,6"
>
<tables>
<table
name=
"t_order"
alias=
"o"
/>
<table
name=
"t_order_item"
alias=
"i"
/>
<table
name=
"row_"
/>
</tables>
<conditions>
<condition
column-name=
"user_id"
table-name=
"t_order"
operator=
"IN"
>
...
...
@@ -70,11 +69,10 @@
</order-by-columns>
<limit
offset=
"6"
offset-index=
"5"
row-count-index=
"0"
row-count=
"3"
/>
</assert>
<assert
id=
"assertSelectPaginationWith
DiffGroupByAndOrderByInSQLServer
"
parameters=
"3,1,2,9,10,6"
>
<assert
id=
"assertSelectPaginationWith
TopAndGroupByAndOrderByAndParentheses
"
parameters=
"3,1,2,9,10,6"
>
<tables>
<table
name=
"t_order"
alias=
"o"
/>
<table
name=
"t_order_item"
alias=
"i"
/>
<table
name=
"row_"
/>
</tables>
<conditions>
<condition
column-name=
"user_id"
table-name=
"t_order"
operator=
"IN"
>
...
...
@@ -87,18 +85,17 @@
</condition>
</conditions>
<group-by-columns>
<group-by-column
name=
"
user_id"
alias=
"GROUP_BY_DERIVED_0
"
owner=
"i"
order-by-type=
"ASC"
/>
<group-by-column
name=
"
item_id
"
owner=
"i"
order-by-type=
"ASC"
/>
</group-by-columns>
<order-by-columns>
<order-by-column
name=
"item_id"
owner=
"i"
order-by-type=
"DESC"
/>
</order-by-columns>
<limit
offset=
"6"
offset-index=
"5"
row-count-index=
"0"
row-count=
"3"
/>
</assert>
<assert
id=
"assertSelectPaginationWith
GroupByAndOrderByAndParenthesesInSQLServer
"
parameters=
"3,1,2,9,10,6"
>
<assert
id=
"assertSelectPaginationWith
TopAndDiffGroupByAndOrderBy
"
parameters=
"3,1,2,9,10,6"
>
<tables>
<table
name=
"t_order"
alias=
"o"
/>
<table
name=
"t_order_item"
alias=
"i"
/>
<table
name=
"row_"
/>
</tables>
<conditions>
<condition
column-name=
"user_id"
table-name=
"t_order"
operator=
"IN"
>
...
...
@@ -111,18 +108,17 @@
</condition>
</conditions>
<group-by-columns>
<group-by-column
name=
"
item_id
"
owner=
"i"
order-by-type=
"ASC"
/>
<group-by-column
name=
"
user_id"
alias=
"GROUP_BY_DERIVED_0
"
owner=
"i"
order-by-type=
"ASC"
/>
</group-by-columns>
<order-by-columns>
<order-by-column
name=
"item_id"
owner=
"i"
order-by-type=
"DESC"
/>
</order-by-columns>
<limit
offset=
"6"
offset-index=
"5"
row-count-index=
"0"
row-count=
"3"
/>
</assert>
<assert
id=
"assertSelectPaginationWith
DiffGroupByAndOrderByAndParenthesesInSQLServer
"
parameters=
"3,1,2,9,10,6"
>
<assert
id=
"assertSelectPaginationWith
TopAndDiffGroupByAndOrderByAndParentheses
"
parameters=
"3,1,2,9,10,6"
>
<tables>
<table
name=
"t_order"
alias=
"o"
/>
<table
name=
"t_order_item"
alias=
"i"
/>
<table
name=
"row_"
/>
</tables>
<conditions>
<condition
column-name=
"user_id"
table-name=
"t_order"
operator=
"IN"
>
...
...
@@ -142,12 +138,10 @@
</order-by-columns>
<limit
offset=
"6"
offset-index=
"5"
row-count-index=
"0"
row-count=
"3"
/>
</assert>
<assert
id=
"assertSelectPaginationWith
GroupByAndOrderByInOracle
"
parameters=
"1,2,9,10,5,3"
>
<assert
id=
"assertSelectPaginationWith
RowNumberAndGroupByAndOrderBy
"
parameters=
"1,2,9,10,5,3"
>
<tables>
<table
name=
"t_order"
alias=
"order0_"
/>
<table
name=
"t_order_item"
alias=
"i"
/>
<table
name=
"row_"
/>
<table
name=
"t"
/>
</tables>
<conditions>
<condition
column-name=
"user_id"
table-name=
"t_order"
operator=
"IN"
>
...
...
@@ -167,12 +161,10 @@
</order-by-columns>
<limit
offset=
"3"
offset-index=
"5"
row-count-index=
"4"
row-count=
"5"
/>
</assert>
<assert
id=
"assertSelectPaginationWith
DiffGroupByAndOrderByInOracle
"
parameters=
"1,2,9,10,5,3"
>
<assert
id=
"assertSelectPaginationWith
RowNumberAndDiffGroupByAndOrderBy
"
parameters=
"1,2,9,10,5,3"
>
<tables>
<table
name=
"t_order"
alias=
"order0_"
/>
<table
name=
"t_order_item"
alias=
"i"
/>
<table
name=
"row_"
/>
<table
name=
"t"
/>
</tables>
<conditions>
<condition
column-name=
"user_id"
table-name=
"t_order"
operator=
"IN"
>
...
...
sharding-jdbc-core/src/test/resources/sql/ddl/create.xml
浏览文件 @
e3e96870
...
...
@@ -4,6 +4,6 @@
<sql
id=
"assertCreateTableIfNotExist"
value=
"CREATE TABLE IF NOT EXISTS t_order(id int)"
type=
"MySQL,PostgreSQL"
/>
<sql
id=
"assertCreateTemporaryTable"
value=
"CREATE TEMPORARY TABLE IF NOT EXISTS t_order(id int)"
type=
"MySQL,PostgreSQL"
/>
<sql
id=
"assertCreateGlobalTemporaryTable"
value=
"CREATE GLOBAL TEMPORARY TABLE t_order(id int)"
type=
"Oracle,PostgreSQL"
/>
<sql
id=
"assertCreate
Temp
LocalTempTable"
value=
"CREATE LOCAL TEMP TABLE t_order(id int)"
type=
"PostgreSQL"
/>
<sql
id=
"assertCreateLocalTempTable"
value=
"CREATE LOCAL TEMP TABLE t_order(id int)"
type=
"PostgreSQL"
/>
<sql
id=
"assertCreateUnloggedTable"
value=
"CREATE UNLOGGED TABLE t_order(id int)"
type=
"PostgreSQL"
/>
</sqls>
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录