Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
b550c4b1
提交
b550c4b1
authored
5月 27, 2018
作者:
Evgenij Ryazanov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Rename Parser.readPositiveInt() to correct readNonNegativeInt()
上级
f8dfcd0d
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
13 行增加
和
13 行删除
+13
-13
Parser.java
h2/src/main/org/h2/command/Parser.java
+13
-13
没有找到文件。
h2/src/main/org/h2/command/Parser.java
浏览文件 @
b550c4b1
...
@@ -575,7 +575,7 @@ public class Parser {
...
@@ -575,7 +575,7 @@ public class Parser {
command
.
setTable
(
table
);
command
.
setTable
(
table
);
}
}
if
(
readIf
(
"SAMPLE_SIZE"
))
{
if
(
readIf
(
"SAMPLE_SIZE"
))
{
command
.
setTop
(
read
Posi
tiveInt
());
command
.
setTop
(
read
NonNega
tiveInt
());
}
}
return
command
;
return
command
;
}
}
...
@@ -3408,10 +3408,10 @@ public class Parser {
...
@@ -3408,10 +3408,10 @@ public class Parser {
return
function
;
return
function
;
}
}
private
int
read
Posi
tiveInt
()
{
private
int
read
NonNega
tiveInt
()
{
int
v
=
readInt
();
int
v
=
readInt
();
if
(
v
<
0
)
{
if
(
v
<
0
)
{
throw
DbException
.
getInvalidValueException
(
"
posi
tive integer"
,
v
);
throw
DbException
.
getInvalidValueException
(
"
non-nega
tive integer"
,
v
);
}
}
return
v
;
return
v
;
}
}
...
@@ -4314,7 +4314,7 @@ public class Parser {
...
@@ -4314,7 +4314,7 @@ public class Parser {
column
.
setSequence
(
sequence
);
column
.
setSequence
(
sequence
);
}
}
if
(
readIf
(
"SELECTIVITY"
))
{
if
(
readIf
(
"SELECTIVITY"
))
{
int
value
=
read
Posi
tiveInt
();
int
value
=
read
NonNega
tiveInt
();
column
.
setSelectivity
(
value
);
column
.
setSelectivity
(
value
);
}
}
String
comment
=
readCommentIf
();
String
comment
=
readCommentIf
();
...
@@ -4362,7 +4362,7 @@ public class Parser {
...
@@ -4362,7 +4362,7 @@ public class Parser {
}
}
}
else
if
(
readIf
(
"TIME"
))
{
}
else
if
(
readIf
(
"TIME"
))
{
if
(
readIf
(
"("
))
{
if
(
readIf
(
"("
))
{
originalScale
=
read
Posi
tiveInt
();
originalScale
=
read
NonNega
tiveInt
();
if
(
originalScale
>
ValueTime
.
MAXIMUM_SCALE
)
{
if
(
originalScale
>
ValueTime
.
MAXIMUM_SCALE
)
{
throw
DbException
.
get
(
ErrorCode
.
INVALID_VALUE_SCALE_PRECISION
,
Integer
.
toString
(
originalScale
));
throw
DbException
.
get
(
ErrorCode
.
INVALID_VALUE_SCALE_PRECISION
,
Integer
.
toString
(
originalScale
));
}
}
...
@@ -4375,10 +4375,10 @@ public class Parser {
...
@@ -4375,10 +4375,10 @@ public class Parser {
}
}
}
else
if
(
readIf
(
"TIMESTAMP"
))
{
}
else
if
(
readIf
(
"TIMESTAMP"
))
{
if
(
readIf
(
"("
))
{
if
(
readIf
(
"("
))
{
originalScale
=
read
Posi
tiveInt
();
originalScale
=
read
NonNega
tiveInt
();
// Allow non-standard TIMESTAMP(..., ...) syntax
// Allow non-standard TIMESTAMP(..., ...) syntax
if
(
readIf
(
","
))
{
if
(
readIf
(
","
))
{
originalScale
=
read
Posi
tiveInt
();
originalScale
=
read
NonNega
tiveInt
();
}
}
if
(
originalScale
>
ValueTimestamp
.
MAXIMUM_SCALE
)
{
if
(
originalScale
>
ValueTimestamp
.
MAXIMUM_SCALE
)
{
throw
DbException
.
get
(
ErrorCode
.
INVALID_VALUE_SCALE_PRECISION
,
Integer
.
toString
(
originalScale
));
throw
DbException
.
get
(
ErrorCode
.
INVALID_VALUE_SCALE_PRECISION
,
Integer
.
toString
(
originalScale
));
...
@@ -4466,7 +4466,7 @@ public class Parser {
...
@@ -4466,7 +4466,7 @@ public class Parser {
}
}
}
else
if
(
original
.
equals
(
"DATETIME"
)
||
original
.
equals
(
"DATETIME2"
))
{
}
else
if
(
original
.
equals
(
"DATETIME"
)
||
original
.
equals
(
"DATETIME2"
))
{
if
(
readIf
(
"("
))
{
if
(
readIf
(
"("
))
{
originalScale
=
read
Posi
tiveInt
();
originalScale
=
read
NonNega
tiveInt
();
if
(
originalScale
>
ValueTime
.
MAXIMUM_SCALE
)
{
if
(
originalScale
>
ValueTime
.
MAXIMUM_SCALE
)
{
throw
DbException
.
get
(
ErrorCode
.
INVALID_VALUE_SCALE_PRECISION
,
throw
DbException
.
get
(
ErrorCode
.
INVALID_VALUE_SCALE_PRECISION
,
Integer
.
toString
(
originalScale
));
Integer
.
toString
(
originalScale
));
...
@@ -4514,7 +4514,7 @@ public class Parser {
...
@@ -4514,7 +4514,7 @@ public class Parser {
}
}
}
else
if
(
dataType
.
type
==
Value
.
DOUBLE
&&
original
.
equals
(
"FLOAT"
))
{
}
else
if
(
dataType
.
type
==
Value
.
DOUBLE
&&
original
.
equals
(
"FLOAT"
))
{
if
(
readIf
(
"("
))
{
if
(
readIf
(
"("
))
{
int
p
=
read
Posi
tiveInt
();
int
p
=
read
NonNega
tiveInt
();
read
(
")"
);
read
(
")"
);
if
(
p
>
53
)
{
if
(
p
>
53
)
{
throw
DbException
.
get
(
ErrorCode
.
INVALID_VALUE_SCALE_PRECISION
,
Integer
.
toString
(
p
));
throw
DbException
.
get
(
ErrorCode
.
INVALID_VALUE_SCALE_PRECISION
,
Integer
.
toString
(
p
));
...
@@ -4548,7 +4548,7 @@ public class Parser {
...
@@ -4548,7 +4548,7 @@ public class Parser {
}
else
if
(
readIf
(
"("
))
{
}
else
if
(
readIf
(
"("
))
{
// Support for MySQL: INT(11), MEDIUMINT(8) and so on.
// Support for MySQL: INT(11), MEDIUMINT(8) and so on.
// Just ignore the precision.
// Just ignore the precision.
read
Posi
tiveInt
();
read
NonNega
tiveInt
();
read
(
")"
);
read
(
")"
);
}
}
if
(
readIf
(
"FOR"
))
{
if
(
readIf
(
"FOR"
))
{
...
@@ -5095,7 +5095,7 @@ public class Parser {
...
@@ -5095,7 +5095,7 @@ public class Parser {
command
.
setRowBased
(
false
);
command
.
setRowBased
(
false
);
}
}
if
(
readIf
(
"QUEUE"
))
{
if
(
readIf
(
"QUEUE"
))
{
command
.
setQueueSize
(
read
Posi
tiveInt
());
command
.
setQueueSize
(
read
NonNega
tiveInt
());
}
}
command
.
setNoWait
(
readIf
(
"NOWAIT"
));
command
.
setNoWait
(
readIf
(
"NOWAIT"
));
if
(
readIf
(
"AS"
))
{
if
(
readIf
(
"AS"
))
{
...
@@ -5661,7 +5661,7 @@ public class Parser {
...
@@ -5661,7 +5661,7 @@ public class Parser {
}
else
if
(
readIf
(
"NUMBERS"
))
{
}
else
if
(
readIf
(
"NUMBERS"
))
{
command
.
setInt
(
Constants
.
ALLOW_LITERALS_NUMBERS
);
command
.
setInt
(
Constants
.
ALLOW_LITERALS_NUMBERS
);
}
else
{
}
else
{
command
.
setInt
(
read
Posi
tiveInt
());
command
.
setInt
(
read
NonNega
tiveInt
());
}
}
return
command
;
return
command
;
}
else
if
(
readIf
(
"DEFAULT_TABLE_TYPE"
))
{
}
else
if
(
readIf
(
"DEFAULT_TABLE_TYPE"
))
{
...
@@ -5672,7 +5672,7 @@ public class Parser {
...
@@ -5672,7 +5672,7 @@ public class Parser {
}
else
if
(
readIf
(
"CACHED"
))
{
}
else
if
(
readIf
(
"CACHED"
))
{
command
.
setInt
(
Table
.
TYPE_CACHED
);
command
.
setInt
(
Table
.
TYPE_CACHED
);
}
else
{
}
else
{
command
.
setInt
(
read
Posi
tiveInt
());
command
.
setInt
(
read
NonNega
tiveInt
());
}
}
return
command
;
return
command
;
}
else
if
(
readIf
(
"CREATE"
))
{
}
else
if
(
readIf
(
"CREATE"
))
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论