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

CAST(NULL AS ...) doesn't forget the data type, precision, and scale any longer.

上级 40c884a2
...@@ -1744,7 +1744,13 @@ public class Function extends Expression implements FunctionCall { ...@@ -1744,7 +1744,13 @@ public class Function extends Expression implements FunctionCall {
scale = s; scale = s;
displaySize = d; displaySize = d;
if (allConst) { if (allConst) {
return ValueExpression.get(getValue(session)); Value v = getValue(session);
if (v == ValueNull.INSTANCE) {
if (info.type == CAST || info.type == CONVERT) {
return this;
}
}
return ValueExpression.get(v);
} }
return this; return this;
} }
......
...@@ -52,6 +52,7 @@ public class TestMetaData extends TestBase { ...@@ -52,6 +52,7 @@ public class TestMetaData extends TestBase {
testColumnDefault(); testColumnDefault();
testCrossReferences(); testCrossReferences();
testProcedureColumns(); testProcedureColumns();
testUDTs();
stat = conn.createStatement(); stat = conn.createStatement();
meta = conn.getMetaData(); meta = conn.getMetaData();
...@@ -206,7 +207,6 @@ public class TestMetaData extends TestBase { ...@@ -206,7 +207,6 @@ public class TestMetaData extends TestBase {
// meta.getSuperTables() // meta.getSuperTables()
// meta.getSuperTypes() // meta.getSuperTypes()
// meta.getTypeInfo() // meta.getTypeInfo()
// meta.getUDTs()
conn.close(); conn.close();
...@@ -329,6 +329,17 @@ public class TestMetaData extends TestBase { ...@@ -329,6 +329,17 @@ public class TestMetaData extends TestBase {
stat.execute("DROP ALIAS PROP"); stat.execute("DROP ALIAS PROP");
} }
private void testUDTs() throws SQLException {
meta = conn.getMetaData();
ResultSet rs;
rs = meta.getUDTs(null, null, null, null);
assertResultSetMeta(rs, 7, new String[] { "TYPE_CAT", "TYPE_SCHEM", "TYPE_NAME",
"CLASS_NAME", "DATA_TYPE", "REMARKS", "BASE_TYPE"
}, new int[] {
Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.SMALLINT, Types.VARCHAR,
Types.SMALLINT }, null, null);
}
private void testCrossReferences() throws SQLException { private void testCrossReferences() throws SQLException {
meta = conn.getMetaData(); meta = conn.getMetaData();
ResultSet rs; ResultSet rs;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论