org.h2.value.Value.getTimestamp()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(7.8k)|赞(0)|评价(0)|浏览(115)

本文整理了Java中org.h2.value.Value.getTimestamp()方法的一些代码示例,展示了Value.getTimestamp()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Value.getTimestamp()方法的具体详情如下:
包路径:org.h2.value.Value
类名称:Value
方法名:getTimestamp

Value.getTimestamp介绍

暂无

代码示例

代码示例来源:origin: com.h2database/h2

/**
 * Returns time zone display name or ID for the specified date-time value.
 *
 * @param value
 *            value
 * @param tzd
 *            if {@code true} return TZD (time zone region with Daylight Saving
 *            Time information included), if {@code false} return TZR (time zone
 *            region)
 * @return time zone display name or ID
 */
private static String getTimeZone(Value value, boolean tzd) {
  if (!(value instanceof ValueTimestampTimeZone)) {
    TimeZone tz = TimeZone.getDefault();
    if (tzd) {
      boolean daylight = tz.inDaylightTime(value.getTimestamp());
      return tz.getDisplayName(daylight, TimeZone.SHORT);
    }
    return tz.getID();
  }
  return DateTimeUtils.timeZoneNameFromOffsetMins(((ValueTimestampTimeZone) value).getTimeZoneOffsetMins());
}

代码示例来源:origin: com.h2database/h2

/**
 * Converts a value to a Instant.
 *
 * <p>This method should only called from Java 8 or later.</p>
 *
 * @param value the value to convert
 * @return the Instant
 */
public static Object valueToInstant(Value value) {
  try {
    return TIMESTAMP_TO_INSTANT.invoke(value.getTimestamp());
  } catch (IllegalAccessException e) {
    throw DbException.convert(e);
  } catch (InvocationTargetException e) {
    throw DbException.convertInvocation(e, "timestamp conversion failed");
  }
}

代码示例来源:origin: com.h2database/h2

/**
 * Returns the value of the specified column as a java.sql.Timestamp.
 *
 * @param columnIndex (1,2,...)
 * @return the value
 * @throws SQLException if the column is not found or if the result set is
 *             closed
 */
@Override
public Timestamp getTimestamp(int columnIndex) throws SQLException {
  try {
    debugCodeCall("getTimestamp", columnIndex);
    return get(columnIndex).getTimestamp();
  } catch (Exception e) {
    throw logAndConvert(e);
  }
}

代码示例来源:origin: com.h2database/h2

/**
 * Returns the value of the specified column as a java.sql.Timestamp.
 *
 * @param columnLabel the column label
 * @return the value
 * @throws SQLException if the column is not found or if the result set is
 *             closed
 */
@Override
public Timestamp getTimestamp(String columnLabel) throws SQLException {
  try {
    debugCodeCall("getTimestamp", columnLabel);
    return get(columnLabel).getTimestamp();
  } catch (Exception e) {
    throw logAndConvert(e);
  }
}

代码示例来源:origin: com.h2database/h2

return type.cast(value.getTime());
} else if (type == Timestamp.class) {
  return type.cast(value.getTimestamp());
} else if (type == java.util.Date.class) {
  return type.cast(new java.util.Date(value.getTimestamp().getTime()));
} else if (type == Calendar.class) {
  Calendar calendar = DateTimeUtils.createGregorianCalendar();
  calendar.setTime(value.getTimestamp());
  return type.cast(calendar);
} else if (type == UUID.class) {

代码示例来源:origin: com.h2database/h2

v0.getTimestamp(), v1.getString(), locale, tz),
database.getMode().treatEmptyStringsAsNull);

代码示例来源:origin: com.h2database/com.springsource.org.h2

/**
 * Returns the value of the specified column as a java.sql.Timestamp.
 *
 * @param columnName the name of the column label
 * @return the value
 * @throws SQLException if the column is not found or if the result set is closed
 */
public Timestamp getTimestamp(String columnName) throws SQLException {
  try {
    debugCodeCall("getTimestamp", columnName);
    return get(columnName).getTimestamp();
  } catch (Throwable e) {
    throw logAndConvert(e);
  }
}

代码示例来源:origin: com.h2database/com.springsource.org.h2

/**
 * Returns the value of the specified column as a java.sql.Timestamp.
 *
 * @param columnIndex (1,2,...)
 * @return the value
 * @throws SQLException if the column is not found or if the result set is closed
 */
public Timestamp getTimestamp(int columnIndex) throws SQLException {
  try {
    debugCodeCall("getTimestamp", columnIndex);
    return get(columnIndex).getTimestamp();
  } catch (Throwable e) {
    throw logAndConvert(e);
  }
}

代码示例来源:origin: com.eventsourcing/h2

/**
 * Returns the value of the specified column as a java.sql.Timestamp.
 *
 * @param columnLabel the column label
 * @return the value
 * @throws SQLException if the column is not found or if the result set is
 *             closed
 */
@Override
public Timestamp getTimestamp(String columnLabel) throws SQLException {
  try {
    debugCodeCall("getTimestamp", columnLabel);
    return get(columnLabel).getTimestamp();
  } catch (Exception e) {
    throw logAndConvert(e);
  }
}

代码示例来源:origin: com.eventsourcing/h2

/**
 * Returns the value of the specified column as a java.sql.Timestamp.
 *
 * @param columnIndex (1,2,...)
 * @return the value
 * @throws SQLException if the column is not found or if the result set is
 *             closed
 */
@Override
public Timestamp getTimestamp(int columnIndex) throws SQLException {
  try {
    debugCodeCall("getTimestamp", columnIndex);
    return get(columnIndex).getTimestamp();
  } catch (Exception e) {
    throw logAndConvert(e);
  }
}

代码示例来源:origin: org.wowtools/h2

/**
 * Returns the value of the specified column as a java.sql.Timestamp.
 *
 * @param columnIndex (1,2,...)
 * @return the value
 * @throws SQLException if the column is not found or if the result set is
 *             closed
 */
@Override
public Timestamp getTimestamp(int columnIndex) throws SQLException {
  try {
    debugCodeCall("getTimestamp", columnIndex);
    return get(columnIndex).getTimestamp();
  } catch (Exception e) {
    throw logAndConvert(e);
  }
}

代码示例来源:origin: org.wowtools/h2

/**
 * Returns the value of the specified column as a java.sql.Timestamp.
 *
 * @param columnLabel the column label
 * @return the value
 * @throws SQLException if the column is not found or if the result set is
 *             closed
 */
@Override
public Timestamp getTimestamp(String columnLabel) throws SQLException {
  try {
    debugCodeCall("getTimestamp", columnLabel);
    return get(columnLabel).getTimestamp();
  } catch (Exception e) {
    throw logAndConvert(e);
  }
}

代码示例来源:origin: org.wowtools/h2

return type.cast(value.getTime());
} else if (type == Timestamp.class) {
  return type.cast(value.getTimestamp());
} else if (type == UUID.class) {
  return type.cast(value.getObject());

代码示例来源:origin: com.h2database/com.springsource.org.h2

/**
 * Returns the value of the specified column as a java.sql.Timestamp using a
 * specified time zone.
 * 
 * @param columnIndex (1,2,...)
 * @param calendar the calendar
 * @return the value
 * @throws SQLException if the column is not found or if the result set is
 *             closed
 */
public Timestamp getTimestamp(int columnIndex, Calendar calendar) throws SQLException {
  try {
    if (debug()) {
      debugCode("getTimestamp(" + columnIndex + ", calendar)");
    }
    Timestamp x = get(columnIndex).getTimestamp();
    return DateTimeUtils.convertTimestampToCalendar(x, calendar);
  } catch (Throwable e) {
    throw logAndConvert(e);
  }
}

代码示例来源:origin: com.h2database/com.springsource.org.h2

/**
 * Returns the value of the specified column as a java.sql.Timestamp.
 * 
 * @param columnName the name of the column label
 * @param calendar the calendar
 * @return the value
 * @throws SQLException if the column is not found or if the result set is
 *             closed
 */
public Timestamp getTimestamp(String columnName, Calendar calendar) throws SQLException {
  try {
    if (debug()) {
      debugCode("getTimestamp(" + StringUtils.quoteJavaString(columnName) + ", calendar)");
    }
    Timestamp x = get(columnName).getTimestamp();
    return DateTimeUtils.convertTimestampToCalendar(x, calendar);
  } catch (Throwable e) {
    throw logAndConvert(e);
  }
}

代码示例来源:origin: com.eventsourcing/h2

getVarLongLen(nanos);
Timestamp ts = v.getTimestamp();
return 1 + getVarLongLen(DateTimeUtils.getTimeLocalWithoutDst(ts)) +
    getVarIntLen(ts.getNanos() % 1000000);

代码示例来源:origin: org.wowtools/h2

getVarLongLen(nanos);
Timestamp ts = v.getTimestamp();
return 1 + getVarLongLen(DateTimeUtils.getTimeLocalWithoutDst(ts)) +
    getVarIntLen(ts.getNanos() % 1000000);

代码示例来源:origin: org.wowtools/h2

writeLong(ts.getTimeNanos());
} else if (version >= Constants.TCP_PROTOCOL_VERSION_7) {
  Timestamp ts = v.getTimestamp();
  writeLong(DateTimeUtils.getTimeLocalWithoutDst(ts));
  writeInt(ts.getNanos() % 1000000);
} else {
  Timestamp ts = v.getTimestamp();
  writeLong(ts.getTime());
  writeInt(ts.getNanos() % 1000000);

代码示例来源:origin: com.eventsourcing/h2

writeLong(ts.getTimeNanos());
} else if (version >= Constants.TCP_PROTOCOL_VERSION_7) {
  Timestamp ts = v.getTimestamp();
  writeLong(DateTimeUtils.getTimeLocalWithoutDst(ts));
  writeInt(ts.getNanos() % 1000000);
} else {
  Timestamp ts = v.getTimestamp();
  writeLong(ts.getTime());
  writeInt(ts.getNanos() % 1000000);

代码示例来源:origin: com.eventsourcing/h2

writeVarLong(nanos);
} else {
  Timestamp ts = v.getTimestamp();
  writeByte((byte) type);
  writeVarLong(DateTimeUtils.getTimeLocalWithoutDst(ts));

相关文章

微信公众号

最新文章

更多