提交 451fcbd4 authored 作者: Thomas Mueller's avatar Thomas Mueller

ResultSetMetaData.getColumnClassName now returns the correct class name for BLOB and CLOB.

上级 1e3e8ea3
...@@ -604,11 +604,11 @@ public class DataType { ...@@ -604,11 +604,11 @@ public class DataType {
// "java.lang.String"; // "java.lang.String";
return String.class.getName(); return String.class.getName();
case Value.BLOB: case Value.BLOB:
// "java.sql.Blob"; // "java.io.InputStream";
return java.sql.Blob.class.getName(); return java.io.InputStream.class.getName();
case Value.CLOB: case Value.CLOB:
// "java.sql.Clob"; // "java.io.Reader";
return java.sql.Clob.class.getName(); return java.io.Reader.class.getName();
case Value.DOUBLE: case Value.DOUBLE:
// "java.lang.Double"; // "java.lang.Double";
return Double.class.getName(); return Double.class.getName();
......
...@@ -32,6 +32,7 @@ public class TestMetaData extends TestBase { ...@@ -32,6 +32,7 @@ public class TestMetaData extends TestBase {
deleteDb("metaData"); deleteDb("metaData");
conn = getConnection("metaData"); conn = getConnection("metaData");
testColumnLobMeta();
testColumnMetaData(); testColumnMetaData();
testColumnPrecision(); testColumnPrecision();
testColumnDefault(); testColumnDefault();
...@@ -195,6 +196,20 @@ public class TestMetaData extends TestBase { ...@@ -195,6 +196,20 @@ public class TestMetaData extends TestBase {
testTempTable(); testTempTable();
} }
private void testColumnLobMeta() throws Exception {
Statement stat = conn.createStatement();
stat.executeUpdate("CREATE TABLE t (blob BLOB, clob CLOB)");
stat.execute("INSERT INTO t VALUES('', '')");
ResultSet rs = stat.executeQuery("SELECT blob,clob FROM t");
ResultSetMetaData rsmd = rs.getMetaData();
assertEquals("java.io.InputStream", rsmd.getColumnClassName(1));
assertEquals("java.io.Reader", rsmd.getColumnClassName(2));
rs.next();
assertEquals("java.io.ByteArrayInputStream", rs.getObject(1).getClass().getName());
assertEquals("java.io.BufferedReader", rs.getObject(2).getClass().getName());
stat.executeUpdate("DROP TABLE t");
}
private void testColumnMetaData() throws Exception { private void testColumnMetaData() throws Exception {
String statement = "select substring('Hello',0,1)"; String statement = "select substring('Hello',0,1)";
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论