Mercurial > hg > monetdb-java
diff src/main/java/org/monetdb/jdbc/MonetResultSetMetaData.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 (9 days ago) |
parents | ff075ed5ce81 |
children |
line wrap: on
line diff
--- a/src/main/java/org/monetdb/jdbc/MonetResultSetMetaData.java +++ b/src/main/java/org/monetdb/jdbc/MonetResultSetMetaData.java @@ -121,17 +121,17 @@ final class MonetResultSetMetaData throw new IllegalArgumentException("Inconsistent Header metadata"); } + final boolean mapClobAsVarChar = connection.mapClobAsVarChar(); + final boolean mapBlobAsVarBinary = connection.mapBlobAsVarBinary(); // derive the JDBC SQL type codes from the types[] names once JdbcSQLTypes = new int[types.length]; for (int i = 0; i < types.length; i++) { int javaSQLtype = MonetDriver.getJdbcSQLType(types[i]); - if (javaSQLtype == Types.CLOB) { - if (connection.mapClobAsVarChar()) - javaSQLtype = Types.VARCHAR; + if (javaSQLtype == Types.CLOB && mapClobAsVarChar) { + javaSQLtype = Types.VARCHAR; } else - if (javaSQLtype == Types.BLOB) { - if (connection.mapBlobAsVarBinary()) - javaSQLtype = Types.VARBINARY; + if (javaSQLtype == Types.BLOB && mapBlobAsVarBinary) { + javaSQLtype = Types.VARBINARY; } JdbcSQLTypes[i] = javaSQLtype; }