提交 3bef72fd authored 作者: Thomas Mueller's avatar Thomas Mueller

CALL calling a Java function with return type ResultSet and return value null…

CALL calling a Java function with return type ResultSet and return value null threw a ClassCastException.
上级 34ec789f
...@@ -65,7 +65,7 @@ public class Call extends Prepared { ...@@ -65,7 +65,7 @@ public class Call extends Prepared {
public ResultInterface query(int maxrows) { public ResultInterface query(int maxrows) {
setCurrentRowNumber(1); setCurrentRowNumber(1);
Value v = expression.getValue(session); Value v = expression.getValue(session);
switch (expression.getType()) { switch (v.getType()) {
case Value.RESULT_SET: case Value.RESULT_SET:
ResultSet rs = ((ValueResultSet) v).getResultSet(); ResultSet rs = ((ValueResultSet) v).getResultSet();
return LocalResult.read(session, rs, maxrows); return LocalResult.read(session, rs, maxrows);
......
...@@ -492,6 +492,13 @@ public class TestFunctions extends TestBase implements AggregateFunction { ...@@ -492,6 +492,13 @@ public class TestFunctions extends TestBase implements AggregateFunction {
assertEquals(null, rs.getString(1)); assertEquals(null, rs.getString(1));
assertFalse(rs.next()); assertFalse(rs.next());
stat.execute("CREATE ALIAS RESULT_WITH_NULL FOR \"" + getClass().getName() + ".resultSetWithNull\"");
rs = stat.executeQuery("CALL RESULT_WITH_NULL()");
assertEquals(1, rs.getMetaData().getColumnCount());
rs.next();
assertEquals(null, rs.getString(1));
assertFalse(rs.next());
conn.close(); conn.close();
} }
...@@ -633,11 +640,21 @@ public class TestFunctions extends TestBase implements AggregateFunction { ...@@ -633,11 +640,21 @@ public class TestFunctions extends TestBase implements AggregateFunction {
* @param conn the connection * @param conn the connection
* @return the result set * @return the result set
*/ */
public static ResultSet nullResultSet(Connection conn) throws SQLException { public static ResultSet resultSetWithNull(Connection conn) throws SQLException {
PreparedStatement statement = conn.prepareStatement("select null from system_range(1,1)"); PreparedStatement statement = conn.prepareStatement("select null from system_range(1,1)");
return statement.executeQuery(); return statement.executeQuery();
} }
/**
* This method is called via reflection from the database.
*
* @param conn the connection
* @return the result set
*/
public static ResultSet nullResultSet(Connection conn) throws SQLException {
return null;
}
/** /**
* Test method to create a simple result set. * Test method to create a simple result set.
* *
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论