comparison src/main/java/nl/cwi/monetdb/jdbc/MonetDriver.java.in @ 380:bf521f343172

Added support for new Java 8 java.sql.Types: Types.TIME_WITH_TIMEZONE and Types.TIMESTAMP_WITH_TIMEZONE.
author Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
date Wed, 07 Oct 2020 18:29:02 +0200 (2020-10-07)
parents d7661075ebf7
children 11c30e3b7966
comparison
equal deleted inserted replaced
379:d7661075ebf7 380:bf521f343172
321 return "@JDBC_MAJOR@.@JDBC_MINOR@ (@JDBC_VER_SUFFIX@ based on MCL v@MCL_MAJOR@.@MCL_MINOR@)"; 321 return "@JDBC_MAJOR@.@JDBC_MINOR@ (@JDBC_VER_SUFFIX@ based on MCL v@MCL_MAJOR@.@MCL_MINOR@)";
322 } 322 }
323 323
324 /** A static Map containing the mapping between MonetDB types and Java SQL types */ 324 /** A static Map containing the mapping between MonetDB types and Java SQL types */
325 /* use SELECT sqlname, * FROM sys.types order by 1, id; to view all MonetDB types */ 325 /* use SELECT sqlname, * FROM sys.types order by 1, id; to view all MonetDB types */
326 /* see http://docs.oracle.com/javase/7/docs/api/java/sql/Types.html to view all supported java SQL types */ 326 /* see http://docs.oracle.com/javase/8/docs/api/java/sql/Types.html to view all supported java SQL types */
327 private static final java.util.Map<String, Integer> typeMap = new java.util.HashMap<String, Integer>(); 327 private static final java.util.Map<String, Integer> typeMap = new java.util.HashMap<String, Integer>();
328 static { 328 static {
329 // fill the typeMap once 329 // fill the typeMap once
330 // typeMap.put("any", Integer.valueOf(Types.???)); 330 // typeMap.put("any", Integer.valueOf(Types.???));
331 typeMap.put("bigint", Integer.valueOf(Types.BIGINT)); 331 typeMap.put("bigint", Integer.valueOf(Types.BIGINT));
352 typeMap.put("smallint", Integer.valueOf(Types.SMALLINT)); 352 typeMap.put("smallint", Integer.valueOf(Types.SMALLINT));
353 typeMap.put("str", Integer.valueOf(Types.VARCHAR)); // MonetDB prepare <stmt> uses type 'str' (instead of varchar) for the schema, table and column metadata output 353 typeMap.put("str", Integer.valueOf(Types.VARCHAR)); // MonetDB prepare <stmt> uses type 'str' (instead of varchar) for the schema, table and column metadata output
354 // typeMap.put("table", Integer.valueOf(Types.???)); 354 // typeMap.put("table", Integer.valueOf(Types.???));
355 typeMap.put("time", Integer.valueOf(Types.TIME)); 355 typeMap.put("time", Integer.valueOf(Types.TIME));
356 typeMap.put("timestamp", Integer.valueOf(Types.TIMESTAMP)); 356 typeMap.put("timestamp", Integer.valueOf(Types.TIMESTAMP));
357 typeMap.put("timestamptz", Integer.valueOf(Types.TIMESTAMP)); 357 typeMap.put("timestamptz", Integer.valueOf(Types.TIMESTAMP_WITH_TIMEZONE)); // new in Java 8: Types.TIMESTAMP_WITH_TIMEZONE (value 2014)
358 // new in Java 8: Types.TIMESTAMP_WITH_TIMEZONE (value 2014). Can't use it yet as we compile for java 7 358 typeMap.put("timetz", Integer.valueOf(Types.TIME_WITH_TIMEZONE)); // new in Java 8: Types.TIME_WITH_TIMEZONE (value 2013)
359 typeMap.put("timetz", Integer.valueOf(Types.TIME));
360 // new in Java 8: Types.TIME_WITH_TIMEZONE (value 2013). Can't use it yet as we compile for java 7
361 typeMap.put("tinyint", Integer.valueOf(Types.TINYINT)); 359 typeMap.put("tinyint", Integer.valueOf(Types.TINYINT));
362 typeMap.put("url", Integer.valueOf(Types.VARCHAR)); 360 typeMap.put("url", Integer.valueOf(Types.VARCHAR));
363 typeMap.put("uuid", Integer.valueOf(Types.VARCHAR)); 361 typeMap.put("uuid", Integer.valueOf(Types.VARCHAR));
364 typeMap.put("varchar", Integer.valueOf(Types.VARCHAR)); 362 typeMap.put("varchar", Integer.valueOf(Types.VARCHAR));
365 typeMap.put("wrd", Integer.valueOf(Types.BIGINT)); // keep it in for older MonetDB servers 363 typeMap.put("wrd", Integer.valueOf(Types.BIGINT)); // keep it in for older MonetDB servers