Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
44649f78
提交
44649f78
authored
13 年前
作者:
noelgrandin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix for bug in getMoreResults(int), because it was not resetting the update count.
上级
0cc8dcfa
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
43 行增加
和
26 行删除
+43
-26
changelog.html
h2/src/docsrc/html/changelog.html
+1
-0
JdbcStatement.java
h2/src/main/org/h2/jdbc/JdbcStatement.java
+22
-23
TestPreparedStatement.java
h2/src/test/org/h2/test/jdbc/TestPreparedStatement.java
+20
-3
没有找到文件。
h2/src/docsrc/html/changelog.html
浏览文件 @
44649f78
...
@@ -34,6 +34,7 @@ Change Log
...
@@ -34,6 +34,7 @@ Change Log
</li><li>
Terrence Huang has translated the error messages to Chinese. Thanks a lot!
</li><li>
Terrence Huang has translated the error messages to Chinese. Thanks a lot!
</li><li>
TRUNC was added as an alias for TRUNCATE.
</li><li>
TRUNC was added as an alias for TRUNCATE.
</li><li>
Small optimisation for accessing result values by column name.
</li><li>
Small optimisation for accessing result values by column name.
</li><li>
Fix for bug in Statement#getMoreResults(int)
</li></ul>
</li></ul>
<h2>
Version 1.3.166 (2012-04-08)
</h2>
<h2>
Version 1.3.166 (2012-04-08)
</h2>
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/jdbc/JdbcStatement.java
浏览文件 @
44649f78
...
@@ -283,26 +283,6 @@ public class JdbcStatement extends TraceObject implements Statement {
...
@@ -283,26 +283,6 @@ public class JdbcStatement extends TraceObject implements Statement {
}
}
}
}
/**
* Moves to the next result set - however there is always only one result
* set. This call also closes the current result set (if there is one).
* Returns true if there is a next result set (that means - it always
* returns false).
*
* @return false
* @throws SQLException if this object is closed.
*/
public
boolean
getMoreResults
()
throws
SQLException
{
try
{
debugCodeCall
(
"getMoreResults"
);
checkClosed
();
closeOldResultSet
();
return
false
;
}
catch
(
Exception
e
)
{
throw
logAndConvert
(
e
);
}
}
/**
/**
* Sets the name of the cursor. This call is ignored.
* Sets the name of the cursor. This call is ignored.
*
*
...
@@ -680,6 +660,26 @@ public class JdbcStatement extends TraceObject implements Statement {
...
@@ -680,6 +660,26 @@ public class JdbcStatement extends TraceObject implements Statement {
}
}
}
}
/**
* Moves to the next result set - however there is always only one result
* set. This call also closes the current result set (if there is one).
* Returns true if there is a next result set (that means - it always
* returns false).
*
* @return false
* @throws SQLException if this object is closed.
*/
public
boolean
getMoreResults
()
throws
SQLException
{
try
{
debugCodeCall
(
"getMoreResults"
);
checkClosed
();
closeOldResultSet
();
return
false
;
}
catch
(
Exception
e
)
{
throw
logAndConvert
(
e
);
}
}
/**
/**
* Move to the next result set.
* Move to the next result set.
* This method always returns false.
* This method always returns false.
...
@@ -695,9 +695,8 @@ public class JdbcStatement extends TraceObject implements Statement {
...
@@ -695,9 +695,8 @@ public class JdbcStatement extends TraceObject implements Statement {
switch
(
current
)
{
switch
(
current
)
{
case
Statement
.
CLOSE_CURRENT_RESULT
:
case
Statement
.
CLOSE_CURRENT_RESULT
:
case
Statement
.
CLOSE_ALL_RESULTS
:
case
Statement
.
CLOSE_ALL_RESULTS
:
if
(
resultSet
!=
null
)
{
checkClosed
();
resultSet
.
close
();
closeOldResultSet
();
}
break
;
break
;
case
Statement
.
KEEP_CURRENT_RESULT
:
case
Statement
.
KEEP_CURRENT_RESULT
:
// nothing to do
// nothing to do
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/jdbc/TestPreparedStatement.java
浏览文件 @
44649f78
...
@@ -83,6 +83,7 @@ public class TestPreparedStatement extends TestBase {
...
@@ -83,6 +83,7 @@ public class TestPreparedStatement extends TestBase {
testIdentity
(
conn
);
testIdentity
(
conn
);
}
}
testDataTypes
(
conn
);
testDataTypes
(
conn
);
testGetMoreResults
(
conn
);
testBlob
(
conn
);
testBlob
(
conn
);
testClob
(
conn
);
testClob
(
conn
);
testParameterMetaData
(
conn
);
testParameterMetaData
(
conn
);
...
@@ -863,23 +864,39 @@ public class TestPreparedStatement extends TestBase {
...
@@ -863,23 +864,39 @@ public class TestPreparedStatement extends TestBase {
rs
=
stat
.
executeQuery
(
"SELECT VALUE FROM T_DECIMAL_0 ORDER BY ID"
);
rs
=
stat
.
executeQuery
(
"SELECT VALUE FROM T_DECIMAL_0 ORDER BY ID"
);
checkBigDecimal
(
rs
,
new
String
[]
{
""
+
Long
.
MAX_VALUE
,
""
+
Long
.
MIN_VALUE
,
"10"
,
"-20"
,
"30"
,
"-40"
});
checkBigDecimal
(
rs
,
new
String
[]
{
""
+
Long
.
MAX_VALUE
,
""
+
Long
.
MIN_VALUE
,
"10"
,
"-20"
,
"30"
,
"-40"
});
}
// getMoreResults
private
void
testGetMoreResults
(
Connection
conn
)
throws
SQLException
{
Statement
stat
=
conn
.
createStatement
();
PreparedStatement
prep
;
ResultSet
rs
;
stat
.
execute
(
"CREATE TABLE TEST(ID INT)"
);
stat
.
execute
(
"CREATE TABLE TEST(ID INT)"
);
stat
.
execute
(
"INSERT INTO TEST VALUES(1)"
);
stat
.
execute
(
"INSERT INTO TEST VALUES(1)"
);
prep
=
conn
.
prepareStatement
(
"SELECT * FROM TEST"
);
prep
=
conn
.
prepareStatement
(
"SELECT * FROM TEST"
);
// just to check if it doesn't throw an exception - it may be null
// just to check if it doesn't throw an exception - it may be null
prep
.
getMetaData
();
prep
.
getMetaData
();
assertTrue
(
prep
.
execute
());
assertTrue
(
prep
.
execute
());
rs
=
prep
.
getResultSet
();
rs
=
prep
.
getResultSet
();
assertFalse
(
prep
.
getMoreResults
());
assertFalse
(
prep
.
getMoreResults
());
assertEquals
(-
1
,
prep
.
getUpdateCount
());
// supposed to be closed now
assertThrows
(
ErrorCode
.
OBJECT_CLOSED
,
rs
).
next
();
assertEquals
(-
1
,
prep
.
getUpdateCount
());
prep
=
conn
.
prepareStatement
(
"UPDATE TEST SET ID = 2"
);
assertFalse
(
prep
.
execute
());
assertEquals
(
1
,
prep
.
getUpdateCount
());
assertFalse
(
prep
.
getMoreResults
(
Statement
.
CLOSE_CURRENT_RESULT
));
assertEquals
(-
1
,
prep
.
getUpdateCount
());
// supposed to be closed now
// supposed to be closed now
assertThrows
(
ErrorCode
.
OBJECT_CLOSED
,
rs
).
next
();
assertThrows
(
ErrorCode
.
OBJECT_CLOSED
,
rs
).
next
();
assertTrue
(
prep
.
getUpdateCount
()
==
-
1
);
assertEquals
(-
1
,
prep
.
getUpdateCount
());
prep
=
conn
.
prepareStatement
(
"DELETE FROM TEST"
);
prep
=
conn
.
prepareStatement
(
"DELETE FROM TEST"
);
prep
.
executeUpdate
();
prep
.
executeUpdate
();
assertFalse
(
prep
.
getMoreResults
());
assertFalse
(
prep
.
getMoreResults
());
assert
True
(
prep
.
getUpdateCount
()
==
-
1
);
assert
Equals
(-
1
,
prep
.
getUpdateCount
()
);
}
}
private
void
testObject
(
Connection
conn
)
throws
SQLException
{
private
void
testObject
(
Connection
conn
)
throws
SQLException
{
...
...
This diff is collapsed.
Click to expand it.
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论