Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
65d5f5e7
提交
65d5f5e7
authored
11 年前
作者:
noelgrandin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add support for DB2 "WITH UR" clause, patch from litailang
上级
b19ef746
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
55 行增加
和
16 行删除
+55
-16
roadmap.html
h2/src/docsrc/html/roadmap.html
+1
-0
Parser.java
h2/src/main/org/h2/command/Parser.java
+30
-14
Mode.java
h2/src/main/org/h2/engine/Mode.java
+6
-1
TestCompatibility.java
h2/src/test/org/h2/test/db/TestCompatibility.java
+18
-1
没有找到文件。
h2/src/docsrc/html/roadmap.html
浏览文件 @
65d5f5e7
...
...
@@ -41,6 +41,7 @@ See also <a href="build.html#providing_patches">Providing Patches</a>.
</li><li>
Remove support for the old-style outer join syntax using "(+)" because it is buggy.
</li><li>
Change license to MPL 2.0.
</li><li>
Not allow relative database URLs like jdbc:h2:test; instead, require using jdbc:h2:./test.
</li><li>
Add support for DB2 "WITH UR" clause, patch from litailang
</li></ul>
<h2>
Priority 1
</h2>
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/command/Parser.java
浏览文件 @
65d5f5e7
...
...
@@ -150,7 +150,7 @@ import org.h2.value.ValueTimestamp;
/**
* The parser is used to convert a SQL statement string to an command object.
*
*
* @author Thomas Mueller
* @author Noel Grandin
* @author Nicolas Fortin, Atelier SIG, IRSTV FR CNRS 24888
...
...
@@ -211,7 +211,7 @@ public class Parser {
/**
* Parse the statement and prepare it for execution.
*
*
* @param sql the SQL statement to parse
* @return the prepared object
*/
...
...
@@ -226,7 +226,7 @@ public class Parser {
/**
* Parse a statement or a list of statements, and prepare it for execution.
*
*
* @param sql the SQL statement to parse
* @return the command object
*/
...
...
@@ -259,7 +259,7 @@ public class Parser {
/**
* Parse the statement, but don't prepare it for execution.
*
*
* @param sql the SQL statement to parse
* @return the prepared object
*/
...
...
@@ -1012,7 +1012,7 @@ public class Parser {
}
if
(
readIf
(
"DEFAULT"
))
{
read
(
"VALUES"
);
Expression
[]
expr
=
{
};
Expression
[]
expr
=
{};
command
.
addRow
(
expr
);
}
else
if
(
readIf
(
"VALUES"
))
{
read
(
"("
);
...
...
@@ -1745,16 +1745,32 @@ public class Parser {
}
while
(
readIf
(
","
));
}
else
if
(
readIf
(
"NOWAIT"
))
{
// TODO parser: select for update nowait: should not wait
}
else
if
(
readIf
(
"WITH"
))
{
// Hibernate / Derby support
read
(
"RR"
);
}
command
.
setForUpdate
(
true
);
}
else
if
(
readIf
(
"READ"
)
||
readIf
(
"FETCH"
))
{
read
(
"ONLY"
);
if
(
readIf
(
"WITH"
))
{
read
(
"RS"
);
}
}
if
(
database
.
getMode
().
isolationLevelInSelectStatement
)
{
parseIsolationClause
();
}
}
/**
* DB2 isolation clause
*/
private
void
parseIsolationClause
()
{
if
(
readIf
(
"WITH"
))
{
if
(
readIf
(
"RR"
)
||
readIf
(
"RS"
))
{
// concurrent-access-resolution clause
if
(
readIf
(
"USE"
))
{
read
(
"AND"
);
read
(
"KEEP"
);
if
(
readIf
(
"SHARE"
)
||
readIf
(
"UPDATE"
)
||
readIf
(
"EXCLUSIVE"
))
{
}
read
(
"LOCKS"
);
}
}
else
if
(
readIf
(
"CS"
)
||
readIf
(
"UR"
))
{
}
}
}
...
...
@@ -3518,7 +3534,7 @@ public class Parser {
/**
* Checks if this string is a SQL keyword.
*
*
* @param s the token to check
* @param supportOffsetFetch if OFFSET and FETCH are keywords
* @return true if it is a keyword
...
...
@@ -5623,7 +5639,7 @@ public class Parser {
/**
* Add double quotes around an identifier if required.
*
*
* @param s the identifier
* @return the quoted identifier
*/
...
...
@@ -5654,7 +5670,7 @@ public class Parser {
/**
* Parse a SQL code snippet that represents an expression.
*
*
* @param sql the code snippet
* @return the expression object
*/
...
...
@@ -5667,7 +5683,7 @@ public class Parser {
/**
* Parse a SQL code snippet that represents a table name.
*
*
* @param sql the code snippet
* @return the table object
*/
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/engine/Mode.java
浏览文件 @
65d5f5e7
...
...
@@ -123,6 +123,10 @@ public class Mode {
*/
public
boolean
swapConvertFunctionParameters
;
/**
* can set the isolation level using WITH {RR|RS|CS|UR}
*/
public
boolean
isolationLevelInSelectStatement
;
private
final
String
name
;
...
...
@@ -135,6 +139,7 @@ public class Mode {
mode
.
aliasColumnName
=
true
;
mode
.
supportOffsetFetch
=
true
;
mode
.
sysDummy1
=
true
;
mode
.
isolationLevelInSelectStatement
=
true
;
add
(
mode
);
mode
=
new
Mode
(
"Derby"
);
...
...
@@ -191,7 +196,7 @@ public class Mode {
/**
* Get the mode with the given name.
*
*
* @param name the name of the mode
* @return the mode object
*/
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/db/TestCompatibility.java
浏览文件 @
65d5f5e7
...
...
@@ -25,7 +25,7 @@ public class TestCompatibility extends TestBase {
/**
* Run just this test.
*
*
* @param a ignored
*/
public
static
void
main
(
String
...
a
)
throws
Exception
{
...
...
@@ -374,6 +374,23 @@ public class TestCompatibility extends TestBase {
res
.
next
();
assertEquals
(
"2"
,
res
.
getString
(
1
));
assertFalse
(
res
.
next
());
// test isolation-clause
conn
=
getConnection
(
"compatibility;MODE=DB2"
);
stat
=
conn
.
createStatement
();
stat
.
execute
(
"drop table test if exists"
);
stat
.
execute
(
"create table test(id varchar)"
);
res
=
stat
.
executeQuery
(
"select * from test where id = 1 with rr"
);
res
=
stat
.
executeQuery
(
"select * from test order by id fetch next 2 rows only with rr"
);
res
=
stat
.
executeQuery
(
"select * from test order by id fetch next 2 rows only with rs"
);
res
=
stat
.
executeQuery
(
"select * from test order by id fetch next 2 rows only with cs"
);
res
=
stat
.
executeQuery
(
"select * from test order by id fetch next 2 rows only with ur"
);
// test isolation-clause with lock-request-clause
res
=
stat
.
executeQuery
(
"select * from test order by id fetch next 2 rows only with rr use and keep share locks"
);
res
=
stat
.
executeQuery
(
"select * from test order by id fetch next 2 rows only with rs use and keep update locks"
);
res
=
stat
.
executeQuery
(
"select * from test order by id fetch next 2 rows only with rr use and keep exclusive locks"
);
}
private
void
testDerby
()
throws
SQLException
{
...
...
This diff is collapsed.
Click to expand it.
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论