private void setTime(int i, LocalTime localTime) throws SQLException { int oid = Oid.TIME; bindString(i, connection.getTimestampUtils().toString(localTime), oid); }
public java.sql.Date getDate(int i, java.util.Calendar cal) throws SQLException { checkClosed(); checkIndex(i, Types.DATE, "Date"); if (callResult[i-1] == null) return null; if (cal != null) cal = (Calendar)cal.clone(); String value = callResult[i-1].toString(); return connection.getTimestampUtils().toDate(cal, value); }
public Time getTime(int i, java.util.Calendar cal) throws SQLException { checkClosed(); checkIndex(i, Types.TIME, "Time"); if (callResult[i-1] == null) return null; if (cal != null) cal = (Calendar)cal.clone(); String value = callResult[i-1].toString(); return connection.getTimestampUtils().toTime(cal, value); }
private void setDate(int i, LocalDate localDate) throws SQLException { int oid = Oid.DATE; bindString(i, connection.getTimestampUtils().toString(localDate), oid); }
private void setTimestamp(int i, OffsetDateTime offsetDateTime) throws SQLException { int oid = Oid.TIMESTAMPTZ; bindString(i, connection.getTimestampUtils().toString(offsetDateTime), oid); } //JCP! endif
private Calendar getDefaultCalendar() { TimestampUtils timestampUtils = connection.getTimestampUtils(); if (timestampUtils.hasFastDefaultTimeZone()) { return timestampUtils.getSharedCalendar(null); } Calendar sharedCalendar = timestampUtils.getSharedCalendar(defaultTimeZone); if (defaultTimeZone == null) { defaultTimeZone = sharedCalendar.getTimeZone(); } return sharedCalendar; }
private void setTimestamp(int i, LocalDateTime localDateTime) throws SQLException { int oid = Oid.TIMESTAMP; bindString(i, connection.getTimestampUtils().toString(localDateTime), oid); }
public Timestamp getTimestamp(int i, java.util.Calendar cal) throws SQLException { checkClosed(); checkIndex(i, Types.TIMESTAMP, "Timestamp"); if (callResult[i-1] == null) return null; if (cal != null) cal = (Calendar)cal.clone(); String value = callResult[i-1].toString(); return connection.getTimestampUtils().toTimestamp(cal, value); }
private Calendar getDefaultCalendar() { TimestampUtils timestampUtils = connection.getTimestampUtils(); if (timestampUtils.hasFastDefaultTimeZone()) { return timestampUtils.getSharedCalendar(null); } Calendar sharedCalendar = timestampUtils.getSharedCalendar(defaultTimeZone); if (defaultTimeZone == null) { defaultTimeZone = sharedCalendar.getTimeZone(); } return sharedCalendar; } }
public java.sql.Date getDate(int i, java.util.Calendar cal) throws SQLException { checkResultSet(i); if (wasNullFlag) return null; if (cal != null) cal = (Calendar)cal.clone(); return connection.getTimestampUtils().toDate(cal, getString(i)); }
public java.sql.Date getDate(int i, java.util.Calendar cal) throws SQLException { checkClosed(); checkIndex(i, Types.DATE, "Date"); if (callResult[i - 1] == null) { return null; } String value = callResult[i - 1].toString(); return connection.getTimestampUtils().toDate(cal, value); }
public Time getTime(int i, java.util.Calendar cal) throws SQLException { checkClosed(); checkIndex(i, Types.TIME, "Time"); if (callResult[i - 1] == null) { return null; } String value = callResult[i - 1].toString(); return connection.getTimestampUtils().toTime(cal, value); }
public Timestamp getTimestamp(int i, java.util.Calendar cal) throws SQLException { checkClosed(); checkIndex(i, Types.TIMESTAMP, "Timestamp"); if (callResult[i - 1] == null) { return null; } String value = callResult[i - 1].toString(); return connection.getTimestampUtils().toTimestamp(cal, value); }
public Timestamp getTimestamp(int i, java.util.Calendar cal) throws SQLException { checkResultSet(i); if (wasNullFlag) return null; if (cal != null) cal = (Calendar)cal.clone(); // If this is actually a timestamptz, the server-provided timezone will override // the one we pass in, which is the desired behaviour. Otherwise, we'll // interpret the timezone-less value in the provided timezone. return connection.getTimestampUtils().toTimestamp(cal, getString(i)); }
public Time getTime(int i, java.util.Calendar cal) throws SQLException { checkResultSet(i); if (wasNullFlag) return null; if (cal != null) cal = (Calendar)cal.clone(); return connection.getTimestampUtils().toTime(cal, getString(i)); }
public void setTime(int i, Time t, java.util.Calendar cal) throws SQLException { checkClosed(); if (t == null) { setNull(i, Types.TIME); return; } if (cal != null) cal = (Calendar)cal.clone(); bindString(i, connection.getTimestampUtils().toString(cal, t), Oid.UNSPECIFIED); }
@Override public java.sql.Date getDate(int i, java.util.Calendar cal) throws SQLException { checkResultSet(i); if (wasNullFlag) { return null; } if (cal == null) { cal = getDefaultCalendar(); } if (isBinary(i)) { int col = i - 1; int oid = fields[col].getOID(); TimeZone tz = cal.getTimeZone(); if (oid == Oid.DATE) { return connection.getTimestampUtils().toDateBin(tz, this_row[col]); } else if (oid == Oid.TIMESTAMP || oid == Oid.TIMESTAMPTZ) { // If backend provides just TIMESTAMP, we use "cal" timezone // If backend provides TIMESTAMPTZ, we ignore "cal" as we know true instant value Timestamp timestamp = getTimestamp(i, cal); // Here we just truncate date to 00:00 in a given time zone return connection.getTimestampUtils().convertToDate(timestamp.getTime(), tz); } else { throw new PSQLException( GT.tr("Cannot convert the column of type {0} to requested type {1}.", Oid.toString(oid), "date"), PSQLState.DATA_TYPE_MISMATCH); } } return connection.getTimestampUtils().toDate(cal, getString(i)); }
private LocalDateTime getLocalDateTime(int i) throws SQLException { checkResultSet(i); if (wasNullFlag) { return null; } int col = i - 1; int oid = fields[col].getOID(); if (oid != Oid.TIMESTAMP) { throw new PSQLException( GT.tr("Cannot convert the column of type {0} to requested type {1}.", Oid.toString(oid), "timestamp"), PSQLState.DATA_TYPE_MISMATCH); } if (isBinary(i)) { TimeZone timeZone = getDefaultCalendar().getTimeZone(); return connection.getTimestampUtils().toLocalDateTimeBin(timeZone, this_row[col]); } String string = getString(i); return connection.getTimestampUtils().toLocalDateTime(string); } //JCP! endif
private LocalTime getLocalTime(int i) throws SQLException { checkResultSet(i); if (wasNullFlag) { return null; } if (isBinary(i)) { int col = i - 1; int oid = fields[col].getOID(); if (oid == Oid.TIME) { return connection.getTimestampUtils().toLocalTimeBin(this_row[col]); } else { throw new PSQLException( GT.tr("Cannot convert the column of type {0} to requested type {1}.", Oid.toString(oid), "time"), PSQLState.DATA_TYPE_MISMATCH); } } String string = getString(i); return connection.getTimestampUtils().toLocalTime(string); } //JCP! endif
public void setTime(int i, Time t, java.util.Calendar cal) throws SQLException { checkClosed(); if (t == null) { setNull(i, Types.TIME); return; } int oid = Oid.UNSPECIFIED; // If a PGTime is used, we can define the OID explicitly. if (t instanceof PGTime) { PGTime pgTime = (PGTime) t; if (pgTime.getCalendar() == null) { oid = Oid.TIME; } else { oid = Oid.TIMETZ; cal = pgTime.getCalendar(); } } if (cal == null) { cal = getDefaultCalendar(); } bindString(i, connection.getTimestampUtils().toString(cal, t), oid); }