Mercurial > hg > monetdb-java
comparison src/main/java/org/monetdb/jdbc/MonetResultSet.java @ 973:32f246853ec4 default tip
Optimisation, call connection.mapClobAsVarChar() and connection.mapBlobAsVarBinary() outside the for-loop, as it does not change.
author | Martin van Dinther <martin.van.dinther@monetdbsolutions.com> |
---|---|
date | Thu, 10 Apr 2025 19:26:59 +0200 (3 days ago) |
parents | ff075ed5ce81 |
children |
comparison
equal
deleted
inserted
replaced
972:f19623e0f527 | 973:32f246853ec4 |
---|---|
213 MonetConnection connection = null; | 213 MonetConnection connection = null; |
214 try { | 214 try { |
215 connection = (MonetConnection) statement.getConnection(); | 215 connection = (MonetConnection) statement.getConnection(); |
216 } catch (SQLException se) { /* ignore it */ } | 216 } catch (SQLException se) { /* ignore it */ } |
217 | 217 |
218 final boolean mapClobAsVarChar = connection != null && connection.mapClobAsVarChar(); | |
219 final boolean mapBlobAsVarBinary = connection != null && connection.mapBlobAsVarBinary(); | |
218 for (int i = 0; i < types.length; i++) { | 220 for (int i = 0; i < types.length; i++) { |
219 int javaSQLtype = MonetDriver.getJdbcSQLType(types[i]); | 221 int javaSQLtype = MonetDriver.getJdbcSQLType(types[i]); |
220 if (javaSQLtype == Types.CLOB) { | 222 if (javaSQLtype == Types.CLOB && mapClobAsVarChar) { |
221 if (connection != null && connection.mapClobAsVarChar()) | 223 javaSQLtype = Types.VARCHAR; |
222 javaSQLtype = Types.VARCHAR; | |
223 } else | 224 } else |
224 if (javaSQLtype == Types.BLOB) { | 225 if (javaSQLtype == Types.BLOB && mapBlobAsVarBinary) { |
225 if (connection != null && connection.mapBlobAsVarBinary()) | 226 javaSQLtype = Types.VARBINARY; |
226 javaSQLtype = Types.VARBINARY; | |
227 } | 227 } |
228 JdbcSQLTypes[i] = javaSQLtype; | 228 JdbcSQLTypes[i] = javaSQLtype; |
229 } | 229 } |
230 } | 230 } |
231 | 231 |