# HG changeset patch
# User Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
# Date 1525348376 -7200
# Node ID e8139dbe388312020f917bcbd86c17cdfc8318e8
# Parent  75a5b5754020b753dd90afb2d909ca1e8edf7fe5
Rename internal method MonetDriver.getJavaType() into MonetDriver.getJdbcSQLType()

diff --git a/src/main/java/nl/cwi/monetdb/jdbc/MonetDriver.java.in b/src/main/java/nl/cwi/monetdb/jdbc/MonetDriver.java.in
--- 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;
 	}
 
 	/**
diff --git a/src/main/java/nl/cwi/monetdb/jdbc/MonetPreparedStatement.java b/src/main/java/nl/cwi/monetdb/jdbc/MonetPreparedStatement.java
--- 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;
 		}
 	}
diff --git a/src/main/java/nl/cwi/monetdb/jdbc/MonetResultSet.java b/src/main/java/nl/cwi/monetdb/jdbc/MonetResultSet.java
--- 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;