Top Description Fields Constructors Methods
org.h2.value

public final Class ValueTimestampTimeZone

extends Value
Class Inheritance
Imports
org.h2.api.ErrorCode, org.h2.engine.CastDataProvider, org.h2.message.DbException, org.h2.util.DateTimeUtils

Implementation of the TIMESTAMP WITH TIME ZONE data type.

Field Summary

Modifier and TypeField and Description
private final long
dateValue

A bit field with bits for the year, month, and day (see DateTimeUtils for encoding)

public static final int
DEFAULT_PRECISION

The default precision and display size of the textual representation of a timestamp.

public static final int
MAXIMUM_PRECISION

The maximum precision and display size of the textual representation of a timestamp.

private final long
timeNanos

The nanoseconds since midnight.

private final int
timeZoneOffsetSeconds

Time zone offset from UTC in seconds, range of -18 hours to +18 hours.

Inherited from org.h2.value.Value:
ARRAYASSIGN_TOBIGINTBINARYBLOBBOOLEANCAST_TOCHARCLOBCONVERT_TODATEDECFLOATDOUBLEEMPTY_VALUESENUMGEOMETRYGROUP_BINARY_STRINGGROUP_BOOLEANGROUP_CHARACTER_STRINGGROUP_COLLECTIONGROUP_DATETIMEGROUP_INTERVAL_DTGROUP_INTERVAL_YMGROUP_NULLGROUP_NUMERICGROUP_OTHERGROUPSINTEGERINTERVAL_DAYINTERVAL_DAY_TO_HOURINTERVAL_DAY_TO_MINUTEINTERVAL_DAY_TO_SECONDINTERVAL_HOURINTERVAL_HOUR_TO_MINUTEINTERVAL_HOUR_TO_SECONDINTERVAL_MINUTEINTERVAL_MINUTE_TO_SECONDINTERVAL_MONTHINTERVAL_SECONDINTERVAL_YEARINTERVAL_YEAR_TO_MONTHJAVA_OBJECTJSONMAX_LONG_DECIMALMIN_LONG_DECIMALNULLNUMERICREALROWSMALLINTTIMETIME_TZTIMESTAMPTIMESTAMP_TZTINYINTTYPE_COUNTUNKNOWNUUIDVARBINARYVARCHARVARCHAR_IGNORECASE

Constructor Summary

AccessConstructor and Description
private
ValueTimestampTimeZone(long dateValue, long timeNanos, int timeZoneOffsetSeconds)

Method Summary

Modifier and TypeMethod and Description
public int
compareTypeSafe(Value
the other value
o
,
CompareMode
the compare mode
mode
,
CastDataProvider
the cast information provider
provider
)

Implements abstract org.h2.value.Value.compareTypeSafe.

Compare this value against another value given that the values are of the same data type.

public boolean
equals(Object
the other value
other
)

Implements abstract org.h2.value.Value.equals.

Check if the two values have the same hash code.

public static ValueTimestampTimeZone

Returns:

the value
fromDateValueAndNanos
(long
the date value, a bit field with bits for the year, month, and day
dateValue
,
long
the nanoseconds since midnight
timeNanos
,
int
the timezone offset in seconds
timeZoneOffsetSeconds
)

Get or create a date value for the given date.

public long

Returns:

the data value
getDateValue
()

A bit field with bits for the year, month, and day (see DateTimeUtils for encoding).

public String

Returns:

value as string in ISO format
getISOString
()

Returns value as string in ISO format.

public int
getMemory()

Overrides org.h2.value.Value.getMemory.

Get the memory used by this object.

public StringBuilder
getSQL(StringBuilder
string builder
builder
,
int
formatting flags
sqlFlags
)

Implements org.h2.util.HasSQL.getSQL.

Appends the SQL statement of this object to the specified builder.

public String
getString()

Implements abstract org.h2.value.Value.getString.

Get the value as a string.

public long

Returns:

the nanoseconds
getTimeNanos
()

The nanoseconds since midnight.

public int

Returns:

the offset
getTimeZoneOffsetSeconds
()

The time zone offset in seconds.

public TypeInfo
getType()

Implements abstract org.h2.value.Value.getType.

Implements org.h2.value.Typed.getType.

Returns the data type.

public int
getValueType()

Implements abstract org.h2.value.Value.getValueType.

Get the value type.

public int
hashCode()

Implements abstract org.h2.value.Value.hashCode.

Returns a hash code value for this object.

public static ValueTimestampTimeZone

Returns:

the date
parse
(String
the string to parse
s
,
CastDataProvider
the cast information provider, may be null for literals with time zone
provider
)

Parse a string to a ValueTimestamp.

private StringBuilder
toString(StringBuilder builder, boolean iso)

Inherited from org.h2.value.Value:
addcachecastTocharLengthclearCachecompareTocompareWithNullcontainsNullconvertForAssignToconvertToconvertToconvertToconvertToconvertToconvertToAnyArrayconvertToAnyJsonconvertToAnyRowconvertToBigintconvertToBooleanconvertToCharconvertToDateconvertToDoubleconvertToEnumconvertToGeometryconvertToIntconvertToIntconvertToJavaObjectconvertToJsonconvertToLongconvertToRealconvertToSmallintconvertToTinyintconvertToUuiddividegetBigDecimalgetBooleangetBytegetBytesgetBytesNoCopygetDataConversionErrorgetDataConversionErrorgetDoublegetFloatgetHigherOrdergetHigherOrderKnowngetInputStreamgetInputStreamgetIntgetLonggetReadergetReadergetShortgetSignumgetTypeNamegetUnsupportedExceptionForOperationgetValueTooLongExceptiongetValueWithFirstNullgetValueWithFirstNullImplisFalseisTruemodulusmultiplynegateoctetLengthrangeChecksubtracttoString

Field Detail

dateValueback to summary
private final long dateValue

A bit field with bits for the year, month, and day (see DateTimeUtils for encoding)

DEFAULT_PRECISIONback to summary
public static final int DEFAULT_PRECISION

The default precision and display size of the textual representation of a timestamp. Example: 2001-01-01 23:59:59.123456+10:00

MAXIMUM_PRECISIONback to summary
public static final int MAXIMUM_PRECISION

The maximum precision and display size of the textual representation of a timestamp. Example: 2001-01-01 23:59:59.123456789+10:00

timeNanosback to summary
private final long timeNanos

The nanoseconds since midnight.

timeZoneOffsetSecondsback to summary
private final int timeZoneOffsetSeconds

Time zone offset from UTC in seconds, range of -18 hours to +18 hours. This range is compatible with OffsetDateTime from JSR-310.

Constructor Detail

ValueTimestampTimeZoneback to summary
private ValueTimestampTimeZone(long dateValue, long timeNanos, int timeZoneOffsetSeconds)

Method Detail

compareTypeSafeback to summary
public int compareTypeSafe(Value o, CompareMode mode, CastDataProvider provider)

Implements abstract org.h2.value.Value.compareTypeSafe.

Doc from org.h2.value.Value.compareTypeSafe.

Compare this value against another value given that the values are of the same data type.

Parameters
o:Value

the other value

mode:CompareMode

the compare mode

provider:CastDataProvider

the cast information provider

Returns:int

0 if both values are equal, -1 if the other value is smaller, and 1 otherwise

Annotations
@Override
equalsback to summary
public boolean equals(Object other)

Implements abstract org.h2.value.Value.equals.

Doc from org.h2.value.Value.equals.

Check if the two values have the same hash code. No data conversion is made; this method returns false if the other object is not of the same class. For some values, compareTo may return 0 even if equals return false. Example: ValueDecimal 0.0 and 0.00.

Parameters
other:Object

the other value

Returns:boolean

true if they are equal

Annotations
@Override
fromDateValueAndNanosback to summary
public static ValueTimestampTimeZone fromDateValueAndNanos(long dateValue, long timeNanos, int timeZoneOffsetSeconds)

Get or create a date value for the given date.

Parameters
dateValue:long

the date value, a bit field with bits for the year, month, and day

timeNanos:long

the nanoseconds since midnight

timeZoneOffsetSeconds:int

the timezone offset in seconds

Returns:ValueTimestampTimeZone

the value

getDateValueback to summary
public long getDateValue()

A bit field with bits for the year, month, and day (see DateTimeUtils for encoding).

Returns:long

the data value

getISOStringback to summary
public String getISOString()

Returns value as string in ISO format.

Returns:String

value as string in ISO format

getMemoryback to summary
public int getMemory()

Overrides org.h2.value.Value.getMemory.

Doc from org.h2.value.Value.getMemory.

Get the memory used by this object.

Returns:int

the memory used in bytes

Annotations
@Override
getSQLback to summary
public StringBuilder getSQL(StringBuilder builder, int sqlFlags)

Implements org.h2.util.HasSQL.getSQL.

Doc from org.h2.util.HasSQL.getSQL.

Appends the SQL statement of this object to the specified builder.

Parameters
builder:StringBuilder

string builder

sqlFlags:int

formatting flags

Returns:StringBuilder

the specified string builder

Annotations
@Override
getStringback to summary
public String getString()

Implements abstract org.h2.value.Value.getString.

Doc from org.h2.value.Value.getString.

Get the value as a string.

Returns:String

the string

Annotations
@Override
getTimeNanosback to summary
public long getTimeNanos()

The nanoseconds since midnight.

Returns:long

the nanoseconds

getTimeZoneOffsetSecondsback to summary
public int getTimeZoneOffsetSeconds()

The time zone offset in seconds.

Returns:int

the offset

getTypeback to summary
public TypeInfo getType()

Implements abstract org.h2.value.Value.getType.

Implements org.h2.value.Typed.getType.

Doc from org.h2.value.Typed.getType.

Returns the data type.

Returns:TypeInfo

the data type

Annotations
@Override
getValueTypeback to summary
public int getValueType()

Implements abstract org.h2.value.Value.getValueType.

Doc from org.h2.value.Value.getValueType.

Get the value type.

Returns:int

the value type

Annotations
@Override
hashCodeback to summary
public int hashCode()

Implements abstract org.h2.value.Value.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object

Annotations
@Override
parseback to summary
public static ValueTimestampTimeZone parse(String s, CastDataProvider provider)

Parse a string to a ValueTimestamp. This method supports the format +/-year-month-day hour:minute:seconds.fractional and an optional timezone part.

Parameters
s:String

the string to parse

provider:CastDataProvider

the cast information provider, may be null for literals with time zone

Returns:ValueTimestampTimeZone

the date

toStringback to summary
private StringBuilder toString(StringBuilder builder, boolean iso)