Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
299f82eb
提交
299f82eb
authored
7月 09, 2018
作者:
Evgenij Ryazanov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add SQLXML support to JdbcCallableStatement
上级
cc9c9bb1
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
28 行增加
和
15 行删除
+28
-15
JdbcCallableStatement.java
h2/src/main/org/h2/jdbc/JdbcCallableStatement.java
+21
-8
TestCallableStatement.java
h2/src/test/org/h2/test/jdbc/TestCallableStatement.java
+7
-7
没有找到文件。
h2/src/main/org/h2/jdbc/JdbcCallableStatement.java
浏览文件 @
299f82eb
...
...
@@ -872,21 +872,30 @@ public class JdbcCallableStatement extends JdbcPreparedStatement implements
}
/**
* [Not supported] Returns the value of the specified column as a SQLXML
* object.
* Returns the value of the specified column as a SQLXML object.
*
* @param parameterIndex the parameter index (1, 2, ...)
* @return the value
* @throws SQLException if the column is not found or if this object is
* closed
*/
@Override
public
SQLXML
getSQLXML
(
int
parameterIndex
)
throws
SQLException
{
throw
unsupported
(
"SQLXML"
);
checkRegistered
(
parameterIndex
);
return
getOpenResultSet
().
getSQLXML
(
parameterIndex
);
}
/**
* [Not supported] Returns the value of the specified column as a SQLXML
* object.
* Returns the value of the specified column as a SQLXML object.
*
* @param parameterName the parameter name
* @return the value
* @throws SQLException if the column is not found or if this object is
* closed
*/
@Override
public
SQLXML
getSQLXML
(
String
parameterName
)
throws
SQLException
{
throw
unsupported
(
"SQLXML"
);
return
getSQLXML
(
getIndexForName
(
parameterName
)
);
}
/**
...
...
@@ -1584,12 +1593,16 @@ public class JdbcCallableStatement extends JdbcPreparedStatement implements
}
/**
* [Not supported] Sets the value of a parameter as a SQLXML object.
* Sets the value of a parameter as a SQLXML object.
*
* @param parameterName the parameter name
* @param x the value
* @throws SQLException if this object is closed
*/
@Override
public
void
setSQLXML
(
String
parameterName
,
SQLXML
x
)
throws
SQLException
{
throw
unsupported
(
"SQLXML"
);
setSQLXML
(
getIndexForName
(
parameterName
),
x
);
}
/**
...
...
h2/src/test/org/h2/test/jdbc/TestCallableStatement.java
浏览文件 @
299f82eb
...
...
@@ -91,8 +91,6 @@ public class TestCallableStatement extends TestDb {
getRef
(
1
);
assertThrows
(
ErrorCode
.
FEATURE_NOT_SUPPORTED_1
,
call
).
getRowId
(
1
);
assertThrows
(
ErrorCode
.
FEATURE_NOT_SUPPORTED_1
,
call
).
getSQLXML
(
1
);
assertThrows
(
ErrorCode
.
FEATURE_NOT_SUPPORTED_1
,
call
).
getURL
(
"a"
);
...
...
@@ -102,8 +100,6 @@ public class TestCallableStatement extends TestDb {
getRef
(
"a"
);
assertThrows
(
ErrorCode
.
FEATURE_NOT_SUPPORTED_1
,
call
).
getRowId
(
"a"
);
assertThrows
(
ErrorCode
.
FEATURE_NOT_SUPPORTED_1
,
call
).
getSQLXML
(
"a"
);
assertThrows
(
ErrorCode
.
FEATURE_NOT_SUPPORTED_1
,
call
).
setURL
(
1
,
(
URL
)
null
);
...
...
@@ -116,9 +112,6 @@ public class TestCallableStatement extends TestDb {
setURL
(
"a"
,
(
URL
)
null
);
assertThrows
(
ErrorCode
.
FEATURE_NOT_SUPPORTED_1
,
call
).
setRowId
(
"a"
,
(
RowId
)
null
);
assertThrows
(
ErrorCode
.
FEATURE_NOT_SUPPORTED_1
,
call
).
setSQLXML
(
"a"
,
(
SQLXML
)
null
);
}
private
void
testCallWithResultSet
(
Connection
conn
)
throws
SQLException
{
...
...
@@ -332,6 +325,8 @@ public class TestCallableStatement extends TestDb {
assertEquals
(
"ABC"
,
call
.
getClob
(
"B"
).
getSubString
(
1
,
3
));
assertEquals
(
"ABC"
,
call
.
getNClob
(
2
).
getSubString
(
1
,
3
));
assertEquals
(
"ABC"
,
call
.
getNClob
(
"B"
).
getSubString
(
1
,
3
));
assertEquals
(
"ABC"
,
call
.
getSQLXML
(
2
).
getString
());
assertEquals
(
"ABC"
,
call
.
getSQLXML
(
"B"
).
getString
());
try
{
call
.
getString
(
100
);
...
...
@@ -397,6 +392,11 @@ public class TestCallableStatement extends TestDb {
call
.
setNString
(
"B"
,
"xyz"
);
call
.
executeUpdate
();
assertEquals
(
"XYZ"
,
call
.
getString
(
"B"
));
SQLXML
xml
=
conn
.
createSQLXML
();
xml
.
setString
(
"<x>xyz</x>"
);
call
.
setSQLXML
(
"B"
,
xml
);
call
.
executeUpdate
();
assertEquals
(
"<X>XYZ</X>"
,
call
.
getString
(
"B"
));
// test for exceptions after closing
call
.
close
();
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论