Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
8bce218b
提交
8bce218b
authored
7月 16, 2007
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
--no commit message
--no commit message
上级
f11e7263
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
65 行增加
和
20 行删除
+65
-20
history.html
h2/src/docsrc/html/history.html
+2
-1
Parser.java
h2/src/main/org/h2/command/Parser.java
+14
-18
Select.java
h2/src/main/org/h2/command/dml/Select.java
+1
-1
SelectUnion.java
h2/src/main/org/h2/command/dml/SelectUnion.java
+1
-0
TestAll.java
h2/src/test/org/h2/test/TestAll.java
+47
-0
没有找到文件。
h2/src/docsrc/html/history.html
浏览文件 @
8bce218b
...
...
@@ -962,7 +962,6 @@ Hypersonic SQL or HSQLDB. H2 is built from scratch.
</li><li>
Support ARRAY data type
</li><li>
Implement more JDBC 4.0 features
</li><li>
H2 Console: implement a servlet to allow simple web app integration
</li><li>
Support ISO 8601 timestamp / date / time with timezone
</li><li>
Support TRANSFORM / PIVOT as in MS Access
</li><li>
Sequence: PostgreSQL compatibility (rename, create) (http://www.postgresql.org/docs/8.2/static/sql-altersequence.html)
</li><li>
SELECT * FROM (VALUES (...), (...), ....) AS alias(f1, ...)
...
...
@@ -1036,6 +1035,8 @@ Hypersonic SQL or HSQLDB. H2 is built from scratch.
</li><li>
Clustering: adding a node should be very fast and without interrupting clients (very short lock)
</li><li>
Updatable result sets: DatabaseMetaData.ownUpdatesAreVisible = true
</li><li>
Cache size should be in KB
</li><li>
Support materialized views (using triggers)
</li><li>
Store dates in local timezone (portability of database files)
</li><li>
Ability to resize the cache array when resizing the cache
</li><li>
Index usage for WHERE NOT FLAG (flag is a boolean column)
</li><li>
Automatic conversion from WHERE ID=1 AND ID=2 to WHERE FALSE
...
...
h2/src/main/org/h2/command/Parser.java
浏览文件 @
8bce218b
...
...
@@ -721,7 +721,7 @@ public class Parser {
command
.
addRow
(
expr
);
}
while
(
readIf
(
","
));
}
else
{
command
.
setQuery
(
parse
QueryWithParams
());
command
.
setQuery
(
parse
Select
());
}
return
command
;
}
...
...
@@ -759,7 +759,7 @@ public class Parser {
command
.
addRow
(
expr
);
}
while
(
readIf
(
","
));
}
else
{
command
.
setQuery
(
parse
QueryWithParams
());
command
.
setQuery
(
parse
Select
());
}
return
command
;
}
...
...
@@ -769,7 +769,7 @@ public class Parser {
Schema
mainSchema
=
database
.
getSchema
(
Constants
.
SCHEMA_MAIN
);
if
(
readIf
(
"("
))
{
if
(
isToken
(
"SELECT"
)
||
isToken
(
"FROM"
))
{
Query
query
=
parse
QueryWithParams
();
Query
query
=
parse
Select
();
String
querySQL
=
query
.
getSQL
();
Session
s
;
if
(
prepared
!=
null
&&
prepared
instanceof
CreateView
)
{
...
...
@@ -1141,24 +1141,18 @@ public class Parser {
}
return
command
;
}
private
Query
parseSelect
()
throws
SQLException
{
Query
command
=
parseSelectUnion
();
command
.
init
();
return
command
;
}
private
Query
parseQueryWithParams
()
throws
SQLException
{
int
paramIndex
=
parameters
.
size
();
Query
command
=
parseSelectUnion
();
command
.
init
();
ObjectArray
params
=
new
ObjectArray
();
for
(
int
i
=
paramIndex
;
i
<
parameters
.
size
();
i
++)
{
params
.
add
(
parameters
.
get
(
i
));
}
command
.
setParameterList
(
params
);
command
.
init
();
return
command
;
}
}
private
Query
parseSelectUnion
()
throws
SQLException
{
int
start
=
lastParseIndex
;
...
...
@@ -1402,6 +1396,8 @@ public class Parser {
Expression
condition
=
readExpression
();
command
.
setHaving
(
condition
);
}
// TODO optimization: not all parameters may be referenced
command
.
setParameterList
(
parameters
);
currentSelect
=
oldSelect
;
setSQL
(
command
,
"SELECT"
,
start
);
return
command
;
...
...
@@ -1438,7 +1434,7 @@ public class Parser {
}
if
(
readIf
(
"EXISTS"
))
{
read
(
"("
);
Query
query
=
parse
QueryWithParams
();
Query
query
=
parse
Select
();
// can not reduce expression because it might be a union except query with distinct
read
(
")"
);
return
new
ConditionExists
(
query
);
...
...
@@ -1484,7 +1480,7 @@ public class Parser {
r
=
ValueExpression
.
get
(
ValueBoolean
.
get
(
false
));
}
else
{
if
(
isToken
(
"SELECT"
)
||
isToken
(
"FROM"
))
{
Query
query
=
parse
QueryWithParams
();
Query
query
=
parse
Select
();
r
=
new
ConditionInSelect
(
database
,
r
,
query
,
false
,
Comparison
.
EQUAL
);
}
else
{
ObjectArray
v
=
new
ObjectArray
();
...
...
@@ -1519,12 +1515,12 @@ public class Parser {
read
();
if
(
readIf
(
"ALL"
))
{
read
(
"("
);
Query
query
=
parse
QueryWithParams
();
Query
query
=
parse
Select
();
r
=
new
ConditionInSelect
(
database
,
r
,
query
,
true
,
compareType
);
read
(
")"
);
}
else
if
(
readIf
(
"ANY"
)
||
readIf
(
"SOME"
))
{
read
(
"("
);
Query
query
=
parse
QueryWithParams
();
Query
query
=
parse
Select
();
r
=
new
ConditionInSelect
(
database
,
r
,
query
,
false
,
compareType
);
read
(
")"
);
}
else
{
...
...
@@ -1871,7 +1867,7 @@ public class Parser {
break
;
case
KEYWORD:
if
(
isToken
(
"SELECT"
)
||
isToken
(
"FROM"
))
{
Query
query
=
parse
QueryWithParams
();
Query
query
=
parse
Select
();
return
new
Subquery
(
query
);
}
throw
getSyntaxError
();
...
...
@@ -4047,7 +4043,7 @@ public class Parser {
command
.
setTableName
(
tableName
);
command
.
setComment
(
readCommentIf
());
if
(
readIf
(
"AS"
))
{
Query
query
=
parse
QueryWithParams
();
Query
query
=
parse
Select
();
command
.
setQuery
(
query
);
}
else
{
read
(
"("
);
...
...
h2/src/main/org/h2/command/dml/Select.java
浏览文件 @
8bce218b
...
...
@@ -461,7 +461,7 @@ public class Select extends Query {
return
;
}
if
(
Constants
.
CHECK
&&
!
checkInit
)
{
throw
Message
.
getInternalError
(
"
already prepar
ed"
);
throw
Message
.
getInternalError
(
"
not initializ
ed"
);
}
isPrepared
=
true
;
if
(
orderList
!=
null
)
{
...
...
h2/src/main/org/h2/command/dml/SelectUnion.java
浏览文件 @
8bce218b
...
...
@@ -330,4 +330,5 @@ public class SelectUnion extends Query {
left
.
updateAggregate
(
session
);
right
.
updateAggregate
(
session
);
}
}
h2/src/test/org/h2/test/TestAll.java
浏览文件 @
8bce218b
...
...
@@ -96,6 +96,53 @@ java -Xmx512m -Xrunhprof:cpu=samples,depth=8 org.h2.tools.RunScript -url jdbc:h2
H2 Console: the result set is not updatable by default. Need to change in web console, and test other databases
drop table tc, ts, tx;
CREATE MEMORY TABLE tc(ARG0 INT, ARG1 INT);
-- 8 = SELECT COUNT(*) FROM tc;
INSERT INTO tc(ARG0, ARG1) VALUES(1, 0);
INSERT INTO tc(ARG0, ARG1) VALUES(2, 0);
INSERT INTO tc(ARG0, ARG1) VALUES(3, 0);
INSERT INTO tc(ARG0, ARG1) VALUES(4, 0);
INSERT INTO tc(ARG0, ARG1) VALUES(5, 0);
INSERT INTO tc(ARG0, ARG1) VALUES(7, 6);
INSERT INTO tc(ARG0, ARG1) VALUES(8, 6);
INSERT INTO tc(ARG0, ARG1) VALUES(5, 6);
CREATE INDEX tc01 ON tc(ARG0, ARG1);
CREATE INDEX tc1 ON tc(ARG1);
CREATE MEMORY TABLE ts(ARG0 INT, ARG1 INT, ARG2 INT);
-- 0 = SELECT COUNT(*) FROM ts;
CREATE INDEX ts02 ON ts(ARG0, ARG2);
CREATE INDEX ts12 ON ts(ARG1, ARG2);
CREATE INDEX ts2 ON ts(ARG2);
CREATE FORCE VIEW v1(ARG0, ARG1) AS (SELECT ARG0, ARG1 FROM tc UNION SELECT ARG0, ARG2 FROM ts);
create table tx (ARG1 int);
insert into tx values (0),(6);
-- This query produce the correct results only with -Dh2.indexOld=true
select * from v1 natural join tx;
drop view V;
drop table A, B;
CREATE TABLE A(A INT);
INSERT INTO A(A) VALUES(6);
CREATE TABLE B(B INT PRIMARY KEY);
CREATE VIEW V(V) AS (SELECT A FROM A UNION SELECT B FROM B);
drop table C;
create table C(C int);
delete from C;
insert into C values (0), (6);
select * from V, C where V.V = C.C;
I forgot to mention a litte documentation bug.
In the code sample of the feature section "Compacting a Database" there is the line
Backup.execute(url, user, password, script);
Correctly it should be
Script.execute(url, user, password, script);
check trace.db/ number of files, limit to 1000 or so
storages should be an int hash map
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论