comparison src/main/java/nl/cwi/monetdb/jdbc/MonetDriver.java.in @ 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 c38d4eaf5479
children ea729e0cf24d
comparison
equal deleted inserted replaced
222:75a5b5754020 223:e8139dbe3883
353 typeMap.put("varchar", Integer.valueOf(Types.VARCHAR)); 353 typeMap.put("varchar", Integer.valueOf(Types.VARCHAR));
354 typeMap.put("wrd", Integer.valueOf(Types.BIGINT)); // keep it in for older MonetDB servers 354 typeMap.put("wrd", Integer.valueOf(Types.BIGINT)); // keep it in for older MonetDB servers
355 } 355 }
356 356
357 /** 357 /**
358 * Returns the java.sql.Types equivalent of the given MonetDB type. 358 * Returns the java.sql.Types equivalent of the given MonetDB type name.
359 * 359 *
360 * @param type the type as used by MonetDB 360 * @param type the SQL data type name as used by MonetDB
361 * @return the mathing java.sql.Types constant or java.sql.Types.OTHER if 361 * @return the matching java.sql.Types constant or
362 * nothing matched on the given string 362 * java.sql.Types.OTHER if nothing matched the given type name
363 */ 363 */
364 static int getJavaType(String type) { 364 static int getJdbcSQLType(String type) {
365 // match the column type on a java.sql.Types constant 365 // find the column type name in the typeMap
366 Integer tp = typeMap.get(type); 366 Integer tp = typeMap.get(type);
367 if (tp != null) { 367 if (tp != null) {
368 return tp.intValue(); 368 return tp.intValue();
369 } else { 369 }
370 // this should not be able to happen 370 // When type name is not found in the map, for instance
371 // do not assert, since maybe future versions introduce 371 // when it is a new type (not yet added in the above typeMap) or
372 // new types 372 // when type name is: any or geometry or geometrya or mbr or ptr or table.
373 return Types.OTHER; 373 return Types.OTHER;
374 }
375 } 374 }
376 375
377 /** 376 /**
378 * Returns a String usable in an SQL statement to map the server types 377 * Returns a String usable in an SQL statement to map the server types
379 * to values of java.sql.Types using the global static type map. 378 * to values of java.sql.Types using the global static type map.