Added (basic) support for clob. Slightly improved debugging information.
This commit is contained in:
parent
649f2dec53
commit
4f437acf63
@ -2,6 +2,7 @@ package com.binarythought.jdbcjson;
|
|||||||
|
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.FileWriter;
|
import java.io.FileWriter;
|
||||||
|
import java.sql.Clob;
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.DriverManager;
|
import java.sql.DriverManager;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
@ -197,12 +198,30 @@ public class JDBCJSON
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case Types.CLOB:
|
||||||
|
Clob clob = rs.getClob(i);
|
||||||
|
if(clob == null){
|
||||||
|
if(column == null){ writer.name(rsmd.getColumnName(i)); }
|
||||||
|
writer.nullValue();
|
||||||
|
} else if(clob.length() <= Integer.MAX_VALUE){
|
||||||
|
if(column == null){ writer.name(rsmd.getColumnName(i)); }
|
||||||
|
writer.value(clob.getSubString(1, (int)clob.length()));
|
||||||
|
} else if(debug){
|
||||||
|
warnings.add(
|
||||||
|
"CLOB column " +
|
||||||
|
(column == null ? rsmd.getColumnName(i) : column) +
|
||||||
|
" too big"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if(debug){
|
if(debug){
|
||||||
warnings.add(
|
warnings.add(
|
||||||
"Unsupported column, " +
|
"Unsupported column, " +
|
||||||
(column == null ? rsmd.getColumnName(i) : column) +
|
(column == null ? rsmd.getColumnName(i) : column) +
|
||||||
", type " + rsmd.getColumnTypeName(i)
|
", type " + rsmd.getColumnTypeName(i) + " [" +
|
||||||
|
rsmd.getColumnType(i) + "]"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user