提交 fceb8db0 authored 作者: Thomas Mueller's avatar Thomas Mueller

ARRAY_GET returned the wrong data type.

上级 c1439dd0
......@@ -302,7 +302,7 @@ public class Function extends Expression implements FunctionCall {
addFunctionWithNull("CASE", CASE, VAR_ARGS, Value.NULL);
addFunctionNotConst("NEXTVAL", NEXTVAL, VAR_ARGS, Value.LONG);
addFunctionNotConst("CURRVAL", CURRVAL, VAR_ARGS, Value.LONG);
addFunction("ARRAY_GET", ARRAY_GET, 2, Value.NULL);
addFunction("ARRAY_GET", ARRAY_GET, 2, Value.STRING);
addFunction("CSVREAD", CSVREAD, VAR_ARGS, Value.RESULT_SET, false, false);
addFunction("CSVWRITE", CSVWRITE, VAR_ARGS, Value.INT, false, false);
addFunctionNotConst("MEMORY_FREE", MEMORY_FREE, 0, Value.INT);
......@@ -1652,7 +1652,6 @@ public class Function extends Expression implements FunctionCall {
case ROUND:
case TRUNCATE:
case POWER:
case ARRAY_GET:
dataType = p0.getType();
scale = p0.getScale();
precision = p0.getPrecision();
......
......@@ -2754,7 +2754,7 @@ YEAR(CREATED)
"
"Functions (System)","ARRAY_GET","
ARRAY_GET(arrayExpression, indexExpression): value
ARRAY_GET(arrayExpression, indexExpression): varchar
","
Returns one element of an array.
","
......
......@@ -238,6 +238,16 @@ public class TestMetaData extends TestBase {
assertEquals(Types.VARCHAR, type);
rs = conn.createStatement().executeQuery("SELECT COUNT(*) C FROM DUAL");
assertEquals("C", rs.getMetaData().getColumnName(1));
Statement stat = conn.createStatement();
stat.execute("create table a(x array)");
stat.execute("insert into a values((1, 2))");
rs = stat.executeQuery("SELECT x[1] FROM a");
ResultSetMetaData meta = rs.getMetaData();
assertEquals(Types.VARCHAR, meta.getColumnType(1));
rs.next();
assertEquals(String.class.getName(), rs.getObject(1).getClass().getName());
stat.execute("drop table a");
}
private void testColumnPrecision() throws SQLException {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论