提交 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 {
// "java.lang.String";
return String.class.getName();
case Value.BLOB:
// "java.sql.Blob";
return java.sql.Blob.class.getName();
// "java.io.InputStream";
return java.io.InputStream.class.getName();
case Value.CLOB:
// "java.sql.Clob";
return java.sql.Clob.class.getName();
// "java.io.Reader";
return java.io.Reader.class.getName();
case Value.DOUBLE:
// "java.lang.Double";
return Double.class.getName();
......
......@@ -32,6 +32,7 @@ public class TestMetaData extends TestBase {
deleteDb("metaData");
conn = getConnection("metaData");
testColumnLobMeta();
testColumnMetaData();
testColumnPrecision();
testColumnDefault();
......@@ -195,6 +196,20 @@ public class TestMetaData extends TestBase {
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 {
String statement = "select substring('Hello',0,1)";
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论