Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
6e8f8506
提交
6e8f8506
authored
2月 27, 2011
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Array literals with zero or one element were not be parsed correctly.
上级
d2353456
隐藏空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
60 行增加
和
15 行删除
+60
-15
help.csv
h2/src/docsrc/help/help.csv
+5
-2
changelog.html
h2/src/docsrc/html/changelog.html
+4
-1
roadmap.html
h2/src/docsrc/html/roadmap.html
+1
-0
Parser.java
h2/src/main/org/h2/command/Parser.java
+20
-11
ExpressionList.java
h2/src/main/org/h2/expression/ExpressionList.java
+5
-0
ValueArray.java
h2/src/main/org/h2/value/ValueArray.java
+7
-1
test-1.3.txt
h2/src/test/org/h2/test/test-1.3.txt
+18
-0
没有找到文件。
h2/src/docsrc/help/help.csv
浏览文件 @
6e8f8506
...
@@ -1506,11 +1506,14 @@ ID=1 AND NAME='Hi'
...
@@ -1506,11 +1506,14 @@ ID=1 AND NAME='Hi'
"
"
"Other Grammar","Array","
"Other Grammar","Array","
(
expression [,...
] )
(
[ expression, [ expression [,...] ]
] )
","
","
An array of values.
An array of values. An empty array is '()'. Trailing commas are ignored.
An array with one element must contain a comma to be parsed as an array.
","
","
(1, 2)
(1, 2)
(1, )
()
"
"
"Other Grammar","Boolean","
"Other Grammar","Boolean","
...
...
h2/src/docsrc/html/changelog.html
浏览文件 @
6e8f8506
...
@@ -18,7 +18,10 @@ Change Log
...
@@ -18,7 +18,10 @@ Change Log
<h1>
Change Log
</h1>
<h1>
Change Log
</h1>
<h2>
Next Version (unreleased)
</h2>
<h2>
Next Version (unreleased)
</h2>
<ul><li>
Issue 290: Conditions using subqueries were sometimes evaluated before much simpler conditions,
<ul><li>
Array literals with zero or one element were not be parsed correctly.
Now trailing commas are ignored (as in Java). Expressions of the form '(1)' are still parsed as the value 1.
An empty array is '()'. An array with one element must contain a comma to be parsed as an array, as in '(1,)'.
</li><li>
Issue 290: Conditions using subqueries were sometimes evaluated before much simpler conditions,
which was very bad for performance. This includes subqueries returning a value, EXISTS subqueries,
which was very bad for performance. This includes subqueries returning a value, EXISTS subqueries,
and IN(SELECT ..) subqueries.
and IN(SELECT ..) subqueries.
</li><li>
Issue 288: Some queries with right outer joins or nested joins could throw a NullPointerException.
</li><li>
Issue 288: Some queries with right outer joins or nested joins could throw a NullPointerException.
...
...
h2/src/docsrc/html/roadmap.html
浏览文件 @
6e8f8506
...
@@ -561,6 +561,7 @@ See also <a href="build.html#providing_patches">Providing Patches</a>.
...
@@ -561,6 +561,7 @@ See also <a href="build.html#providing_patches">Providing Patches</a>.
</li><li>
Optimization for large lists for column IN(1, 2, 3, 4,...) - currently an list is used, could potentially use a hash set
</li><li>
Optimization for large lists for column IN(1, 2, 3, 4,...) - currently an list is used, could potentially use a hash set
(maybe only for a part of the values - the ones that can be evaluated).
(maybe only for a part of the values - the ones that can be evaluated).
</li><li>
Compatibility for ARRAY data type (Oracle: VARRAY(n) of VARCHAR(m); HSQLDB: VARCHAR(n) ARRAY; Postgres: VARCHAR(n)[]).
</li><li>
Compatibility for ARRAY data type (Oracle: VARRAY(n) of VARCHAR(m); HSQLDB: VARCHAR(n) ARRAY; Postgres: VARCHAR(n)[]).
</li><li>
PostgreSQL compatible array literal syntax: ARRAY[['breakfast', 'consulting'], ['meeting', 'lunch']]
</li></ul>
</li></ul>
<h2>
Not Planned
</h2>
<h2>
Not Planned
</h2>
...
...
h2/src/main/org/h2/command/Parser.java
浏览文件 @
6e8f8506
...
@@ -2482,19 +2482,28 @@ public class Parser {
...
@@ -2482,19 +2482,28 @@ public class Parser {
break
;
break
;
case
OPEN:
case
OPEN:
read
();
read
();
r
=
readExpression
();
if
(
readIf
(
")"
))
{
if
(
readIf
(
","
))
{
r
=
ExpressionList
.
EMPTY
;
ArrayList
<
Expression
>
list
=
New
.
arrayList
();
}
else
{
list
.
add
(
r
);
r
=
readExpression
(
);
do
{
if
(
readIf
(
","
))
{
r
=
readExpression
();
ArrayList
<
Expression
>
list
=
New
.
arrayList
();
list
.
add
(
r
);
list
.
add
(
r
);
}
while
(
readIf
(
","
));
while
(!
readIf
(
")"
))
{
Expression
[]
array
=
new
Expression
[
list
.
size
()];
r
=
readExpression
();
list
.
toArray
(
array
);
list
.
add
(
r
);
r
=
new
ExpressionList
(
array
);
if
(!
readIf
(
","
))
{
read
(
")"
);
break
;
}
}
Expression
[]
array
=
new
Expression
[
list
.
size
()];
list
.
toArray
(
array
);
r
=
new
ExpressionList
(
array
);
}
else
{
read
(
")"
);
}
}
}
read
(
")"
);
break
;
break
;
case
TRUE:
case
TRUE:
read
();
read
();
...
...
h2/src/main/org/h2/expression/ExpressionList.java
浏览文件 @
6e8f8506
...
@@ -20,6 +20,8 @@ import org.h2.value.ValueArray;
...
@@ -20,6 +20,8 @@ import org.h2.value.ValueArray;
*/
*/
public
class
ExpressionList
extends
Expression
{
public
class
ExpressionList
extends
Expression
{
public
static
final
ExpressionList
EMPTY
=
new
ExpressionList
(
new
Expression
[
0
]);
private
Expression
[]
list
;
private
Expression
[]
list
;
public
ExpressionList
(
Expression
[]
list
)
{
public
ExpressionList
(
Expression
[]
list
)
{
...
@@ -83,6 +85,9 @@ public class ExpressionList extends Expression {
...
@@ -83,6 +85,9 @@ public class ExpressionList extends Expression {
buff
.
appendExceptFirst
(
", "
);
buff
.
appendExceptFirst
(
", "
);
buff
.
append
(
e
.
getSQL
());
buff
.
append
(
e
.
getSQL
());
}
}
if
(
list
.
length
==
1
)
{
buff
.
append
(
','
);
}
return
buff
.
append
(
')'
).
toString
();
return
buff
.
append
(
')'
).
toString
();
}
}
...
...
h2/src/main/org/h2/value/ValueArray.java
浏览文件 @
6e8f8506
...
@@ -15,6 +15,9 @@ import org.h2.util.StatementBuilder;
...
@@ -15,6 +15,9 @@ import org.h2.util.StatementBuilder;
* Implementation of the ARRAY data type.
* Implementation of the ARRAY data type.
*/
*/
public
class
ValueArray
extends
Value
{
public
class
ValueArray
extends
Value
{
private
static
final
ValueArray
EMPTY
=
new
ValueArray
(
new
Value
[
0
]);
private
final
Value
[]
values
;
private
final
Value
[]
values
;
private
int
hash
;
private
int
hash
;
...
@@ -30,7 +33,7 @@ public class ValueArray extends Value {
...
@@ -30,7 +33,7 @@ public class ValueArray extends Value {
* @return the value
* @return the value
*/
*/
public
static
ValueArray
get
(
Value
[]
list
)
{
public
static
ValueArray
get
(
Value
[]
list
)
{
return
new
ValueArray
(
list
);
return
list
.
length
==
0
?
EMPTY
:
new
ValueArray
(
list
);
}
}
public
int
hashCode
()
{
public
int
hashCode
()
{
...
@@ -104,6 +107,9 @@ public class ValueArray extends Value {
...
@@ -104,6 +107,9 @@ public class ValueArray extends Value {
buff
.
appendExceptFirst
(
", "
);
buff
.
appendExceptFirst
(
", "
);
buff
.
append
(
v
.
getSQL
());
buff
.
append
(
v
.
getSQL
());
}
}
if
(
values
.
length
==
1
)
{
buff
.
append
(
','
);
}
return
buff
.
append
(
')'
).
toString
();
return
buff
.
append
(
')'
).
toString
();
}
}
...
...
h2/src/test/org/h2/test/test-1.3.txt
浏览文件 @
6e8f8506
--- special grammar and test cases ---------------------------------------------------------------------------------------------
--- special grammar and test cases ---------------------------------------------------------------------------------------------
select () empty;
> EMPTY
> -----
> ()
> rows: 1
select (1,) one_element;
> ONE_ELEMENT
> -----------
> (1)
> rows: 1
select (1) one;
> ONE
> ---
> 1
> rows: 1
create table test(id int);
create table test(id int);
> ok
> ok
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论