Mercurial > hg > monetdb-java
comparison src/main/java/org/monetdb/util/XMLExporter.java @ 424:709300b32284
Added entries 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, 03 Feb 2021 16:23:39 +0100 (2021-02-03) |
parents | bf9f6b6ecf40 |
children | 6aa38e8c0f2d |
comparison
equal
deleted
inserted
replaced
423:de2ef68b672f | 424:709300b32284 |
---|---|
217 out.println(">"); | 217 out.println(">"); |
218 out.println(" <xsd:restriction base=\"xsd:date\" />"); | 218 out.println(" <xsd:restriction base=\"xsd:date\" />"); |
219 out.println(" </xsd:simpleType>"); | 219 out.println(" </xsd:simpleType>"); |
220 break; | 220 break; |
221 case Types.TIME: | 221 case Types.TIME: |
222 case Types.TIME_WITH_TIMEZONE: | |
222 if ("timetz".equals(cols.getString(colTypeNmIndex))) { | 223 if ("timetz".equals(cols.getString(colTypeNmIndex))) { |
223 ident = "TIME_WTZ"; | 224 ident = "TIME_WTZ"; |
224 } else { | 225 } else { |
225 ident = "TIME"; | 226 ident = "TIME"; |
226 } | 227 } |
233 out.println(">"); | 234 out.println(">"); |
234 out.println(" <xsd:restriction base=\"xsd:time\" />"); | 235 out.println(" <xsd:restriction base=\"xsd:time\" />"); |
235 out.println(" </xsd:simpleType>"); | 236 out.println(" </xsd:simpleType>"); |
236 break; | 237 break; |
237 case Types.TIMESTAMP: | 238 case Types.TIMESTAMP: |
239 case Types.TIMESTAMP_WITH_TIMEZONE: | |
238 if ("timestamptz".equals(cols.getString(colTypeNmIndex))) { | 240 if ("timestamptz".equals(cols.getString(colTypeNmIndex))) { |
239 ident = "TIMESTAMP_WTZ"; | 241 ident = "TIMESTAMP_WTZ"; |
240 } else { | 242 } else { |
241 ident = "TIMESTAMP"; | 243 ident = "TIMESTAMP"; |
242 } | 244 } |
302 break; | 304 break; |
303 case Types.DATE: | 305 case Types.DATE: |
304 ident = "DATE"; | 306 ident = "DATE"; |
305 break; | 307 break; |
306 case Types.TIME: | 308 case Types.TIME: |
309 case Types.TIME_WITH_TIMEZONE: | |
307 if ("timetz".equals(cols.getString(colTypeNmIndex))) { | 310 if ("timetz".equals(cols.getString(colTypeNmIndex))) { |
308 ident = "TIME_WTZ"; | 311 ident = "TIME_WTZ"; |
309 } else { | 312 } else { |
310 ident = "TIME"; | 313 ident = "TIME"; |
311 } | 314 } |
312 break; | 315 break; |
313 case Types.TIMESTAMP: | 316 case Types.TIMESTAMP: |
317 case Types.TIMESTAMP_WITH_TIMEZONE: | |
314 if ("timestamptz".equals(cols.getString(colTypeNmIndex))) { | 318 if ("timestamptz".equals(cols.getString(colTypeNmIndex))) { |
315 ident = "TIMESTAMP_WTZ"; | 319 ident = "TIMESTAMP_WTZ"; |
316 } else { | 320 } else { |
317 ident = "TIMESTAMP"; | 321 ident = "TIMESTAMP"; |
318 } | 322 } |
359 while (rs.next()) { | 363 while (rs.next()) { |
360 out.println(" <row>"); | 364 out.println(" <row>"); |
361 for (int i = 1; i <= rsmd.getColumnCount(); i++) { | 365 for (int i = 1; i <= rsmd.getColumnCount(); i++) { |
362 switch (rsmd.getColumnType(i)) { | 366 switch (rsmd.getColumnType(i)) { |
363 case Types.TIMESTAMP: | 367 case Types.TIMESTAMP: |
368 case Types.TIMESTAMP_WITH_TIMEZONE: | |
364 final Timestamp ts = rs.getTimestamp(i); | 369 final Timestamp ts = rs.getTimestamp(i); |
365 if ("timestamptz".equals(rsmd.getColumnTypeName(i))) { | 370 if ("timestamptz".equals(rsmd.getColumnTypeName(i))) { |
366 if (xsd_tstz == null) { | 371 if (xsd_tstz == null) { |
367 // first time it is needed, create it | 372 // first time it is needed, create it |
368 xsd_tstz = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ"); | 373 xsd_tstz = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ"); |