提交 299f82eb authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Add SQLXML support to JdbcCallableStatement

上级 cc9c9bb1
......@@ -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);
}
/**
......
......@@ -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 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论