diff src/main/java/nl/cwi/monetdb/jdbc/MonetPreparedStatement.java @ 175:8700d9ef2ace

Added possibility via a connection property to let the JDBC driver return columnType value Types.VARCHAR instead of Types.CLOB in case the result column of a ResultSet or parameter in a PreparedStatement is of data type 'clob'. With this connection property set, you can reduce the overhead when working with clob column data from generic JDBC programs.
author Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
date Thu, 28 Sep 2017 16:17:51 +0200 (2017-09-28)
parents 5c575fb21be0
children 4767b005a531
line wrap: on
line diff
--- a/src/main/java/nl/cwi/monetdb/jdbc/MonetPreparedStatement.java
+++ b/src/main/java/nl/cwi/monetdb/jdbc/MonetPreparedStatement.java
@@ -156,6 +156,14 @@ public class MonetPreparedStatement
 			for (int i = 0; rs.next(); i++) {
 				monetdbType[i] = rs.getString(type_colnr);
 				javaType[i] = MonetDriver.getJavaType(monetdbType[i]);
+				if (javaType[i] == Types.CLOB) {
+					if (connection.mapClobAsVarChar())
+						javaType[i] = Types.VARCHAR;
+				} else
+				if (javaType[i] == Types.BLOB) {
+					if (connection.mapBlobAsVarBinary())
+						javaType[i] = Types.VARBINARY;
+				}
 				digits[i] = rs.getInt(digits_colnr);
 				scale[i] = rs.getInt(scale_colnr);
 				if (rscolcnt == 3)