Package org.h2.mode

Class ToDateTokenizer

java.lang.Object
org.h2.mode.ToDateTokenizer

final class ToDateTokenizer extends Object
Emulates Oracle's TO_DATE function. This class knows all about the TO_DATE-format conventions and how to parse the corresponding data.
  • Field Details

    • PATTERN_INLINE

      static final Pattern PATTERN_INLINE
      The pattern for a number.
    • PATTERN_NUMBER

      static final Pattern PATTERN_NUMBER
      The pattern for a number.
    • PATTERN_FOUR_DIGITS

      static final Pattern PATTERN_FOUR_DIGITS
      The pattern for four digits (typically a year).
    • PATTERN_TWO_TO_FOUR_DIGITS

      static final Pattern PATTERN_TWO_TO_FOUR_DIGITS
      The pattern 2-4 digits (e.g. for RRRR).
    • PATTERN_THREE_DIGITS

      static final Pattern PATTERN_THREE_DIGITS
      The pattern for three digits.
    • PATTERN_TWO_DIGITS

      static final Pattern PATTERN_TWO_DIGITS
      The pattern for two digits.
    • PATTERN_TWO_DIGITS_OR_LESS

      static final Pattern PATTERN_TWO_DIGITS_OR_LESS
      The pattern for one or two digits.
    • PATTERN_ONE_DIGIT

      static final Pattern PATTERN_ONE_DIGIT
      The pattern for one digit.
    • PATTERN_FF

      static final Pattern PATTERN_FF
      The pattern for a fraction (of a second for example).
    • PATTERN_AM_PM

      static final Pattern PATTERN_AM_PM
      The pattern for "am" or "pm".
    • PATTERN_BC_AD

      static final Pattern PATTERN_BC_AD
      The pattern for "bc" or "ad".
    • PARSLET_YEAR

      static final ToDateTokenizer.YearParslet PARSLET_YEAR
      The parslet for a year.
    • PARSLET_MONTH

      static final ToDateTokenizer.MonthParslet PARSLET_MONTH
      The parslet for a month.
    • PARSLET_DAY

      static final ToDateTokenizer.DayParslet PARSLET_DAY
      The parslet for a day.
    • PARSLET_TIME

      static final ToDateTokenizer.TimeParslet PARSLET_TIME
      The parslet for time.
    • PARSLET_INLINE

      static final ToDateTokenizer.InlineParslet PARSLET_INLINE
      The inline parslet. E.g. 'YYYY-MM-DD"T"HH24:MI:SS"Z"' where "T" and "Z" are inlined
  • Constructor Details

    • ToDateTokenizer

      private ToDateTokenizer()
  • Method Details

    • matchStringOrThrow

      static String matchStringOrThrow(Pattern p, ToDateParser params, Enum<?> aEnum)
      Match the pattern, or if not possible throw an exception.
      Parameters:
      p - the pattern
      params - the parameters with the input string
      aEnum - the pattern name
      Returns:
      the matched value
    • setByName

      static String setByName(ToDateParser params, int field)
      Set the given field in the calendar.
      Parameters:
      params - the parameters with the input string
      field - the field to set
      Returns:
      the matched value
    • throwException

      static void throwException(ToDateParser params, String errorStr)
      Throw a parse exception.
      Parameters:
      params - the parameters with the input string
      errorStr - the error string