Top Description Inners Fields Constructors Methods
org.h2.mode

public final Class ToDateParser

extends Object
Class Inheritance
Static Imports
java.lang.String.format

Emulates Oracle's TO_DATE function.
This class holds and handles the input data form the TO_DATE-method

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static enum
ToDateParser.ConfigParam

The configuration of the date parser.

Field Summary

Modifier and TypeField and Description
private long
private boolean
private boolean
private int
private int
private int
private int
private boolean
private String
private final ToDateParser.ConfigParam
private int
private int
private boolean
private String
private boolean
private int
private int
private int
private int
private final SessionLocal
private TimeZoneProvider
private boolean
private int
private int
private final String
private final String
private int

Constructor Summary

AccessConstructor and Description
private
ToDateParser(SessionLocal
the database session
session
,
ToDateParser.ConfigParam
one of [TO_DATE, TO_TIMESTAMP] (both share the same code)
functionName
,
String
the input date with the date-time info
input
,
String
the format of date-time info
format
)

Method Summary

Modifier and TypeMethod and Description
pack-priv int
pack-priv int
pack-priv String
pack-priv String
pack-priv String
private ValueTimestamp
private ValueTimestampTimeZone
private static ToDateParser
private boolean
private static ToDateParser
private void
pack-priv void
remove(String
the input fragment
inputFragmentStr
,
String
the format fragment
formatFragment
)

Remove a token from a string.

private void
pack-priv void
setAbsoluteDay(int absoluteDay)

pack-priv void
setAmPm(boolean isAM)

pack-priv void
setBC(boolean bc)

pack-priv void
setDay(int day)

pack-priv void
setDayOfYear(int dayOfYear)

pack-priv void
setHour(int hour)

pack-priv void
setHour12(int hour12)

pack-priv void
setMinute(int minute)

pack-priv void
setMonth(int month)

pack-priv void
setNanos(int nanos)

pack-priv void
setSecond(int second)

pack-priv void
pack-priv void
setTimeZoneHour(int timeZoneHour)

pack-priv void
setTimeZoneMinute(int timeZoneMinute)

pack-priv void
setYear(int year)

public static ValueTimestamp

Returns:

the date as a timestamp
toDate
(SessionLocal
the database session
session
,
String
the input
input
,
String
the format
format
)

Parse a string as a date with the given format.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

public static ValueTimestamp

Returns:

the timestamp
toTimestamp
(SessionLocal
the database session
session
,
String
the input
input
,
String
the format
format
)

Parse a string as a timestamp with the given format.

public static ValueTimestampTimeZone

Returns:

the timestamp
toTimestampTz
(SessionLocal
the database session
session
,
String
the input
input
,
String
the format
format
)

Parse a string as a timestamp with the given format.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

absoluteDayback to summary
private long absoluteDay
absoluteDayValidback to summary
private boolean absoluteDayValid
bcback to summary
private boolean bc
currentMonthback to summary
private int currentMonth
currentYearback to summary
private int currentYear
dayback to summary
private int day
dayOfYearback to summary
private int dayOfYear
doyValidback to summary
private boolean doyValid
formatStrback to summary
private String formatStr
functionNameback to summary
private final ToDateParser.ConfigParam functionName
hourback to summary
private int hour
hour12back to summary
private int hour12
hour12Validback to summary
private boolean hour12Valid
inputStrback to summary
private String inputStr
isAMback to summary
private boolean isAM
minuteback to summary
private int minute
monthback to summary
private int month
nanosback to summary
private int nanos
secondback to summary
private int second
sessionback to summary
private final SessionLocal session
timeZoneback to summary
private TimeZoneProvider timeZone
timeZoneHMValidback to summary
private boolean timeZoneHMValid
timeZoneHourback to summary
private int timeZoneHour
timeZoneMinuteback to summary
private int timeZoneMinute
unmodifiedFormatStrback to summary
private final String unmodifiedFormatStr
unmodifiedInputStrback to summary
private final String unmodifiedInputStr
yearback to summary
private int year

Constructor Detail

ToDateParserback to summary
private ToDateParser(SessionLocal session, ToDateParser.ConfigParam functionName, String input, String format)
Parameters
session:SessionLocal

the database session

functionName:ToDateParser.ConfigParam

one of [TO_DATE, TO_TIMESTAMP] (both share the same code)

input:String

the input date with the date-time info

format:String

the format of date-time info

Method Detail

getCurrentMonthback to summary
pack-priv int getCurrentMonth()
getCurrentYearback to summary
pack-priv int getCurrentYear()
getFormatStrback to summary
pack-priv String getFormatStr()
getFunctionNameback to summary
pack-priv String getFunctionName()
getInputStrback to summary
pack-priv String getInputStr()
getResultingValueback to summary
private ValueTimestamp getResultingValue()
getResultingValueWithTimeZoneback to summary
private ValueTimestampTimeZone getResultingValueWithTimeZone()
getTimestampParserback to summary
private static ToDateParser getTimestampParser(SessionLocal session, ToDateParser.ConfigParam param, String input, String format)
hasToParseDataback to summary
private boolean hasToParseData()
parseback to summary
private static ToDateParser parse(ToDateParser p)
queryCurrentYearAndMonthback to summary
private void queryCurrentYearAndMonth()
removeback to summary
pack-priv void remove(String inputFragmentStr, String formatFragment)

Remove a token from a string.

Parameters
inputFragmentStr:String

the input fragment

formatFragment:String

the format fragment

removeFirstCharback to summary
private void removeFirstChar()
setAbsoluteDayback to summary
pack-priv void setAbsoluteDay(int absoluteDay)
setAmPmback to summary
pack-priv void setAmPm(boolean isAM)
setBCback to summary
pack-priv void setBC(boolean bc)
setDayback to summary
pack-priv void setDay(int day)
setDayOfYearback to summary
pack-priv void setDayOfYear(int dayOfYear)
setHourback to summary
pack-priv void setHour(int hour)
setHour12back to summary
pack-priv void setHour12(int hour12)
setMinuteback to summary
pack-priv void setMinute(int minute)
setMonthback to summary
pack-priv void setMonth(int month)
setNanosback to summary
pack-priv void setNanos(int nanos)
setSecondback to summary
pack-priv void setSecond(int second)
setTimeZoneback to summary
pack-priv void setTimeZone(TimeZoneProvider timeZone)
setTimeZoneHourback to summary
pack-priv void setTimeZoneHour(int timeZoneHour)
setTimeZoneMinuteback to summary
pack-priv void setTimeZoneMinute(int timeZoneMinute)
setYearback to summary
pack-priv void setYear(int year)
toDateback to summary
public static ValueTimestamp toDate(SessionLocal session, String input, String format)

Parse a string as a date with the given format.

Parameters
session:SessionLocal

the database session

input:String

the input

format:String

the format

Returns:ValueTimestamp

the date as a timestamp

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override
toTimestampback to summary
public static ValueTimestamp toTimestamp(SessionLocal session, String input, String format)

Parse a string as a timestamp with the given format.

Parameters
session:SessionLocal

the database session

input:String

the input

format:String

the format

Returns:ValueTimestamp

the timestamp

toTimestampTzback to summary
public static ValueTimestampTimeZone toTimestampTz(SessionLocal session, String input, String format)

Parse a string as a timestamp with the given format.

Parameters
session:SessionLocal

the database session

input:String

the input

format:String

the format

Returns:ValueTimestampTimeZone

the timestamp

org.h2.mode back to summary

private final Enum ToDateParser.ConfigParam

extends Enum<ToDateParser.ConfigParam>
Class Inheritance

The configuration of the date parser.

Field Summary

Modifier and TypeField and Description
private final String
public static final ToDateParser.ConfigParam
public static final ToDateParser.ConfigParam
public static final ToDateParser.ConfigParam

Constructor Summary

AccessConstructor and Description
private
ConfigParam(String defaultFormatStr)

Method Summary

Modifier and TypeMethod and Description
pack-priv String
public static ToDateParser.ConfigParam
public static ToDateParser.ConfigParam[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

defaultFormatStrback to summary
private final String defaultFormatStr
TO_DATEback to summary
public static final ToDateParser.ConfigParam TO_DATE
TO_TIMESTAMPback to summary
public static final ToDateParser.ConfigParam TO_TIMESTAMP
TO_TIMESTAMP_TZback to summary
public static final ToDateParser.ConfigParam TO_TIMESTAMP_TZ

Constructor Detail

ConfigParamback to summary
private ConfigParam(String defaultFormatStr)

Method Detail

getDefaultFormatStrback to summary
pack-priv String getDefaultFormatStr()
valueOfback to summary
public static ToDateParser.ConfigParam valueOf(String name)
valuesback to summary
public static ToDateParser.ConfigParam[] values()