Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
05db33de
提交
05db33de
authored
12月 20, 2018
作者:
Evgenij Ryazanov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ARRAY, INTERSECTS, and INTERVAL should be keywords too
上级
5ae94953
显示空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
64 行增加
和
39 行删除
+64
-39
advanced.html
h2/src/docsrc/html/advanced.html
+7
-5
Parser.java
h2/src/main/org/h2/command/Parser.java
+27
-21
JdbcDatabaseMetaData.java
h2/src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
+7
-6
ParserUtil.java
h2/src/main/org/h2/util/ParserUtil.java
+23
-7
没有找到文件。
h2/src/docsrc/html/advanced.html
浏览文件 @
05db33de
...
...
@@ -475,11 +475,13 @@ There is a list of keywords that can't be used as identifiers (table names, colu
unless they are quoted (surrounded with double quotes). The list is currently:
</p><p>
<code>
ALL, CHECK, CONSTRAINT, CROSS, CURRENT_DATE, CURRENT_TIME, CURRENT_TIMESTAMP, DISTINCT, EXCEPT,
EXISTS, FALSE, FETCH, FOR, FOREIGN, FROM, FULL, GROUP, HAVING, INNER, INTERSECT, INTERSECTS,
IS, JOIN, LIKE, LIMIT, LOCALTIME, LOCALTIMESTAMP, MINUS, NATURAL, NOT, NULL, OFFSET, ON, ORDER,
PRIMARY, ROW, ROWNUM, SELECT, SYSDATE, SYSTIME, SYSTIMESTAMP, TODAY, TOP, TRUE, UNION, UNIQUE, WHERE,
WINDOW, WITH
ALL, ARRAY, CHECK, CONSTRAINT, CROSS, CURRENT_DATE, CURRENT_TIME,
CURRENT_TIMESTAMP, DISTINCT, EXCEPT, EXISTS, FALSE, FETCH, FOR,
FOREIGN, FROM, FULL, GROUP, HAVING, INNER, INTERSECT, INTERSECTS,
INTERVAL, IS, JOIN, LIKE, LIMIT, LOCALTIME, LOCALTIMESTAMP,
MINUS, NATURAL, NOT, NULL, OFFSET, ON, ORDER, PRIMARY, ROW,
ROWNUM, SELECT, SYSDATE, SYSTIME, SYSTIMESTAMP, TODAY, TOP, TRUE,
UNION, UNIQUE, WHERE, WINDOW, WITH
</code>
</p><p>
Certain words of this list are keywords because they are functions that can be used without '()',
...
...
h2/src/main/org/h2/command/Parser.java
浏览文件 @
05db33de
...
...
@@ -9,6 +9,7 @@
package
org
.
h2
.
command
;
import
static
org
.
h2
.
util
.
ParserUtil
.
ALL
;
import
static
org
.
h2
.
util
.
ParserUtil
.
ARRAY
;
import
static
org
.
h2
.
util
.
ParserUtil
.
CHECK
;
import
static
org
.
h2
.
util
.
ParserUtil
.
CONSTRAINT
;
import
static
org
.
h2
.
util
.
ParserUtil
.
CROSS
;
...
...
@@ -29,6 +30,8 @@ import static org.h2.util.ParserUtil.HAVING;
import
static
org
.
h2
.
util
.
ParserUtil
.
IDENTIFIER
;
import
static
org
.
h2
.
util
.
ParserUtil
.
INNER
;
import
static
org
.
h2
.
util
.
ParserUtil
.
INTERSECT
;
import
static
org
.
h2
.
util
.
ParserUtil
.
INTERSECTS
;
import
static
org
.
h2
.
util
.
ParserUtil
.
INTERVAL
;
import
static
org
.
h2
.
util
.
ParserUtil
.
IS
;
import
static
org
.
h2
.
util
.
ParserUtil
.
JOIN
;
import
static
org
.
h2
.
util
.
ParserUtil
.
LIKE
;
...
...
@@ -417,6 +420,8 @@ public class Parser {
null
,
// ALL
"ALL"
,
// ARRAY
"ARRAY"
,
// CHECK
"CHECK"
,
// CONSTRAINT
...
...
@@ -455,6 +460,10 @@ public class Parser {
"INNER"
,
// INTERSECT
"INTERSECT"
,
// INTERSECTS
"INTERSECTS"
,
// INTERVAL
"INTERVAL"
,
// IS
"IS"
,
// JOIN
...
...
@@ -2747,7 +2756,7 @@ public class Parser {
read
(
CLOSE_PAREN
);
return
new
ConditionExists
(
query
);
}
if
(
readIf
(
"INTERSECTS"
))
{
if
(
readIf
(
INTERSECTS
))
{
read
(
OPEN_PAREN
);
Expression
r1
=
readConcat
();
read
(
COMMA
);
...
...
@@ -3808,6 +3817,22 @@ public class Parser {
}
}
break
;
case
ARRAY:
{
read
();
read
(
OPEN_BRACKET
);
ArrayList
<
Expression
>
list
=
Utils
.
newSmallArrayList
();
if
(!
readIf
(
CLOSE_BRACKET
))
{
list
.
add
(
readExpression
());
while
(
readIf
(
COMMA
))
{
list
.
add
(
readExpression
());
}
read
(
CLOSE_BRACKET
);
}
return
new
ExpressionList
(
list
.
toArray
(
new
Expression
[
0
]),
true
);
}
case
INTERVAL:
read
();
return
readInterval
();
case
ROW:
{
read
();
read
(
OPEN_PAREN
);
...
...
@@ -3915,20 +3940,6 @@ public class Parser {
ch
&=
0xffdf
;
}
switch
(
ch
)
{
case
'A'
:
if
(
equalsToken
(
"ARRAY"
,
name
))
{
read
(
OPEN_BRACKET
);
ArrayList
<
Expression
>
list
=
Utils
.
newSmallArrayList
();
if
(!
readIf
(
CLOSE_BRACKET
))
{
list
.
add
(
readExpression
());
while
(
readIf
(
COMMA
))
{
list
.
add
(
readExpression
());
}
read
(
CLOSE_BRACKET
);
}
return
new
ExpressionList
(
list
.
toArray
(
new
Expression
[
0
]),
true
);
}
break
;
case
'C'
:
if
(
equalsToken
(
"CURRENT_USER"
,
name
))
{
return
readFunctionWithoutParameters
(
"USER"
);
...
...
@@ -3956,11 +3967,6 @@ public class Parser {
return
ValueExpression
.
get
(
ValueString
.
get
(
text
));
}
break
;
case
'I'
:
if
(
equalsToken
(
"INTERVAL"
,
name
))
{
return
readInterval
();
}
break
;
case
'N'
:
if
(
equalsToken
(
"NEXT"
,
name
)
&&
readIf
(
"VALUE"
))
{
read
(
FOR
);
...
...
@@ -5171,7 +5177,7 @@ public class Parser {
read
(
"ZONE"
);
original
=
"TIMESTAMP WITHOUT TIME ZONE"
;
}
}
else
if
(
readIf
(
"INTERVAL"
))
{
}
else
if
(
readIf
(
INTERVAL
))
{
if
(
readIf
(
"YEAR"
))
{
if
(
readIf
(
OPEN_PAREN
))
{
originalPrecision
=
readNonNegativeInt
();
...
...
h2/src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
浏览文件 @
05db33de
...
...
@@ -1547,12 +1547,13 @@ public class JdbcDatabaseMetaData extends TraceObject implements
* </pre>
* The complete list of keywords (including SQL-2003 keywords) is:
* <pre>
* ALL, CHECK, CONSTRAINT, CROSS, CURRENT_DATE, CURRENT_TIME, CURRENT_TIMESTAMP,
* DISTINCT, EXCEPT, EXISTS, FALSE, FETCH, FOR, FOREIGN, FROM, FULL, GROUP,
* HAVING, INNER, INTERSECT, INTERSECTS, IS, JOIN, LIKE, LIMIT, LOCALTIME,
* LOCALTIMESTAMP, MINUS, NATURAL, NOT, NULL, OFFSET, ON, ORDER, PRIMARY, ROW, ROWNUM,
* SELECT, SYSDATE, SYSTIME, SYSTIMESTAMP, TODAY, TOP, TRUE, UNION, UNIQUE, WHERE,
* WINDOW, WITH
* ALL, ARRAY, CHECK, CONSTRAINT, CROSS, CURRENT_DATE, CURRENT_TIME,
* CURRENT_TIMESTAMP, DISTINCT, EXCEPT, EXISTS, FALSE, FETCH, FOR,
* FOREIGN, FROM, FULL, GROUP, HAVING, INNER, INTERSECT, INTERSECTS,
* INTERVAL, IS, JOIN, LIKE, LIMIT, LOCALTIME, LOCALTIMESTAMP,
* MINUS, NATURAL, NOT, NULL, OFFSET, ON, ORDER, PRIMARY, ROW,
* ROWNUM, SELECT, SYSDATE, SYSTIME, SYSTIMESTAMP, TODAY, TOP, TRUE,
* UNION, UNIQUE, WHERE, WINDOW, WITH
* </pre>
*
* @return a list of additional the keywords
...
...
h2/src/main/org/h2/util/ParserUtil.java
浏览文件 @
05db33de
...
...
@@ -22,10 +22,15 @@ public class ParserUtil {
*/
public
static
final
int
ALL
=
IDENTIFIER
+
1
;
/**
* The token "ARRAY".
*/
public
static
final
int
ARRAY
=
ALL
+
1
;
/**
* The token "CHECK".
*/
public
static
final
int
CHECK
=
A
LL
+
1
;
public
static
final
int
CHECK
=
A
RRAY
+
1
;
/**
* The token "CONSTRAINT".
...
...
@@ -117,10 +122,20 @@ public class ParserUtil {
*/
public
static
final
int
INTERSECT
=
INNER
+
1
;
/**
* The token "INTERSECTS".
*/
public
static
final
int
INTERSECTS
=
INTERSECT
+
1
;
/**
* The token "INTERVAL".
*/
public
static
final
int
INTERVAL
=
INTERSECTS
+
1
;
/**
* The token "IS".
*/
public
static
final
int
IS
=
INTER
SECT
+
1
;
public
static
final
int
IS
=
INTER
VAL
+
1
;
/**
* The token "JOIN".
...
...
@@ -317,6 +332,8 @@ public class ParserUtil {
case
'A'
:
if
(
eq
(
"ALL"
,
s
,
ignoreCase
,
start
,
end
))
{
return
ALL
;
}
else
if
(
eq
(
"ARRAY"
,
s
,
ignoreCase
,
start
,
end
))
{
return
ARRAY
;
}
return
IDENTIFIER
;
case
'C'
:
...
...
@@ -376,14 +393,13 @@ public class ParserUtil {
return
INNER
;
}
else
if
(
eq
(
"INTERSECT"
,
s
,
ignoreCase
,
start
,
end
))
{
return
INTERSECT
;
}
else
if
(
eq
(
"INTERSECTS"
,
s
,
ignoreCase
,
start
,
end
))
{
return
INTERSECTS
;
}
else
if
(
eq
(
"INTERVAL"
,
s
,
ignoreCase
,
start
,
end
))
{
return
INTERVAL
;
}
else
if
(
eq
(
"IS"
,
s
,
ignoreCase
,
start
,
end
))
{
return
IS
;
}
if
(
additionalKeywords
)
{
if
(
eq
(
"INTERSECTS"
,
s
,
ignoreCase
,
start
,
end
))
{
return
KEYWORD
;
}
}
return
IDENTIFIER
;
case
'J'
:
if
(
eq
(
"JOIN"
,
s
,
ignoreCase
,
start
,
end
))
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论