Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
995ae3c4
提交
995ae3c4
authored
8月 10, 2018
作者:
Evgenij Ryazanov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Allow usage of SAMPLE_SIZE together with OFFSET / FETCH
上级
ea6ce813
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
12 行增加
和
16 行删除
+12
-16
help.csv
h2/src/docsrc/help/help.csv
+3
-3
Parser.java
h2/src/main/org/h2/command/Parser.java
+7
-10
Analyze.java
h2/src/main/org/h2/command/ddl/Analyze.java
+2
-3
没有找到文件。
h2/src/docsrc/help/help.csv
浏览文件 @
995ae3c4
...
@@ -10,10 +10,10 @@ FROM tableExpression [,...] [ WHERE expression ]
...
@@ -10,10 +10,10 @@ FROM tableExpression [,...] [ WHERE expression ]
[ GROUP BY expression [,...] ] [ HAVING expression ]
[ GROUP BY expression [,...] ] [ HAVING expression ]
[ { UNION [ ALL ] | MINUS | EXCEPT | INTERSECT } select ]
[ { UNION [ ALL ] | MINUS | EXCEPT | INTERSECT } select ]
[ ORDER BY order [,...] ]
[ ORDER BY order [,...] ]
[ {
LIMIT expression [ OFFSET expression ] [ SAMPLE_SIZE rowCountInt
] }
[ {
{ LIMIT expression [ OFFSET expression
] }
| { [ OFFSET expression { ROW | ROWS } ]
| { [ OFFSET expression { ROW | ROWS } ]
[ FETCH { FIRST | NEXT } [ expression [ PERCENT ] ] { ROW | ROWS }
[ FETCH { FIRST | NEXT } [ expression [ PERCENT ] ] { ROW | ROWS }
{ ONLY | WITH TIES } ] } ]
{ ONLY | WITH TIES } ] }
} [ SAMPLE_SIZE rowCountInt ]
]
[ FOR UPDATE ]
[ FOR UPDATE ]
","
","
Selects data from a table or multiple tables.
Selects data from a table or multiple tables.
...
...
h2/src/main/org/h2/command/Parser.java
浏览文件 @
995ae3c4
...
@@ -2361,7 +2361,7 @@ public class Parser {
...
@@ -2361,7 +2361,7 @@ public class Parser {
// make sure aggregate functions will not work here
// make sure aggregate functions will not work here
Select
temp
=
currentSelect
;
Select
temp
=
currentSelect
;
currentSelect
=
null
;
currentSelect
=
null
;
//
http://sqlpro.developpez.com/SQL2008/
//
Standard SQL OFFSET / FETCH
if
(
readIf
(
OFFSET
))
{
if
(
readIf
(
OFFSET
))
{
command
.
setOffset
(
readExpression
().
optimize
(
session
));
command
.
setOffset
(
readExpression
().
optimize
(
session
));
if
(!
readIf
(
"ROW"
))
{
if
(!
readIf
(
"ROW"
))
{
...
@@ -2391,11 +2391,8 @@ public class Parser {
...
@@ -2391,11 +2391,8 @@ public class Parser {
read
(
"ONLY"
);
read
(
"ONLY"
);
}
}
}
}
currentSelect
=
temp
;
// MySQL-style LIMIT / OFFSET
if
(
readIf
(
LIMIT
))
{
if
(
readIf
(
LIMIT
))
{
temp
=
currentSelect
;
// make sure aggregate functions will not work here
currentSelect
=
null
;
Expression
limit
=
readExpression
().
optimize
(
session
);
Expression
limit
=
readExpression
().
optimize
(
session
);
command
.
setLimit
(
limit
);
command
.
setLimit
(
limit
);
if
(
readIf
(
OFFSET
))
{
if
(
readIf
(
OFFSET
))
{
...
@@ -2408,12 +2405,12 @@ public class Parser {
...
@@ -2408,12 +2405,12 @@ public class Parser {
command
.
setOffset
(
offset
);
command
.
setOffset
(
offset
);
command
.
setLimit
(
limit
);
command
.
setLimit
(
limit
);
}
}
if
(
readIf
(
"SAMPLE_SIZE"
))
{
Expression
sampleSize
=
readExpression
().
optimize
(
session
);
command
.
setSampleSize
(
sampleSize
);
}
currentSelect
=
temp
;
}
}
if
(
readIf
(
"SAMPLE_SIZE"
))
{
Expression
sampleSize
=
readExpression
().
optimize
(
session
);
command
.
setSampleSize
(
sampleSize
);
}
currentSelect
=
temp
;
if
(
readIf
(
FOR
))
{
if
(
readIf
(
FOR
))
{
if
(
readIf
(
"UPDATE"
))
{
if
(
readIf
(
"UPDATE"
))
{
if
(
readIf
(
"OF"
))
{
if
(
readIf
(
"OF"
))
{
...
...
h2/src/main/org/h2/command/ddl/Analyze.java
浏览文件 @
995ae3c4
...
@@ -115,14 +115,13 @@ public class Analyze extends DefineCommand {
...
@@ -115,14 +115,13 @@ public class Analyze extends DefineCommand {
}
}
buff
.
append
(
" FROM "
).
append
(
table
.
getSQL
());
buff
.
append
(
" FROM "
).
append
(
table
.
getSQL
());
if
(
sample
>
0
)
{
if
(
sample
>
0
)
{
buff
.
append
(
"
LIMIT ?
SAMPLE_SIZE ? "
);
buff
.
append
(
"
FETCH NEXT ROW ONLY
SAMPLE_SIZE ? "
);
}
}
String
sql
=
buff
.
toString
();
String
sql
=
buff
.
toString
();
Prepared
command
=
session
.
prepare
(
sql
);
Prepared
command
=
session
.
prepare
(
sql
);
if
(
sample
>
0
)
{
if
(
sample
>
0
)
{
ArrayList
<
Parameter
>
params
=
command
.
getParameters
();
ArrayList
<
Parameter
>
params
=
command
.
getParameters
();
params
.
get
(
0
).
setValue
(
ValueInt
.
get
(
1
));
params
.
get
(
0
).
setValue
(
ValueInt
.
get
(
sample
));
params
.
get
(
1
).
setValue
(
ValueInt
.
get
(
sample
));
}
}
ResultInterface
result
=
command
.
query
(
0
);
ResultInterface
result
=
command
.
query
(
0
);
result
.
next
();
result
.
next
();
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论