Mercurial > hg > monetdb-java
changeset 223:e8139dbe3883
Rename internal method MonetDriver.getJavaType() into MonetDriver.getJdbcSQLType()
author | Martin van Dinther <martin.van.dinther@monetdbsolutions.com> |
---|---|
date | Thu, 03 May 2018 13:52:56 +0200 (2018-05-03) |
parents | 75a5b5754020 |
children | ea729e0cf24d |
files | src/main/java/nl/cwi/monetdb/jdbc/MonetDriver.java.in src/main/java/nl/cwi/monetdb/jdbc/MonetPreparedStatement.java src/main/java/nl/cwi/monetdb/jdbc/MonetResultSet.java |
diffstat | 3 files changed, 13 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/src/main/java/nl/cwi/monetdb/jdbc/MonetDriver.java.in +++ b/src/main/java/nl/cwi/monetdb/jdbc/MonetDriver.java.in @@ -355,23 +355,22 @@ final public class MonetDriver implement } /** - * Returns the java.sql.Types equivalent of the given MonetDB type. + * Returns the java.sql.Types equivalent of the given MonetDB type name. * - * @param type the type as used by MonetDB - * @return the mathing java.sql.Types constant or java.sql.Types.OTHER if - * nothing matched on the given string + * @param type the SQL data type name as used by MonetDB + * @return the matching java.sql.Types constant or + * java.sql.Types.OTHER if nothing matched the given type name */ - static int getJavaType(String type) { - // match the column type on a java.sql.Types constant + static int getJdbcSQLType(String type) { + // find the column type name in the typeMap Integer tp = typeMap.get(type); if (tp != null) { return tp.intValue(); - } else { - // this should not be able to happen - // do not assert, since maybe future versions introduce - // new types - return Types.OTHER; } + // When type name is not found in the map, for instance + // when it is a new type (not yet added in the above typeMap) or + // when type name is: any or geometry or geometrya or mbr or ptr or table. + return Types.OTHER; } /**
--- a/src/main/java/nl/cwi/monetdb/jdbc/MonetPreparedStatement.java +++ b/src/main/java/nl/cwi/monetdb/jdbc/MonetPreparedStatement.java @@ -155,7 +155,7 @@ public class MonetPreparedStatement int column_colnr = rs.findColumn("column"); for (int i = 0; rs.next(); i++) { monetdbType[i] = rs.getString(type_colnr); - javaType[i] = MonetDriver.getJavaType(monetdbType[i]); + javaType[i] = MonetDriver.getJdbcSQLType(monetdbType[i]); if (javaType[i] == Types.CLOB) { if (connection.mapClobAsVarChar()) javaType[i] = Types.VARCHAR; @@ -253,7 +253,7 @@ public class MonetPreparedStatement */ @Override public void clearParameters() { - for (int i = 0; i < values.length; i++) { + for (int i = 0; i < size; i++) { values[i] = null; } }
--- a/src/main/java/nl/cwi/monetdb/jdbc/MonetResultSet.java +++ b/src/main/java/nl/cwi/monetdb/jdbc/MonetResultSet.java @@ -201,7 +201,7 @@ public class MonetResultSet } catch (SQLException se) { /* ignore it */ } for (int i = 0; i < types.length; i++) { - int javaSQLtype = MonetDriver.getJavaType(types[i]); + int javaSQLtype = MonetDriver.getJdbcSQLType(types[i]); if (javaSQLtype == Types.CLOB) { if (connection != null && connection.mapClobAsVarChar()) javaSQLtype = Types.VARCHAR;