Package org.h2.mode

Class ToDateTokenizer


  • final class ToDateTokenizer
    extends java.lang.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 Detail

      • PATTERN_INLINE

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

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

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

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

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

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

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

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

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

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

        static final java.util.regex.Pattern PATTERN_BC_AD
        The pattern for "bc" or "ad".
      • 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 Detail

      • ToDateTokenizer

        private ToDateTokenizer()
    • Method Detail

      • matchStringOrThrow

        static java.lang.String matchStringOrThrow​(java.util.regex.Pattern p,
                                                   ToDateParser params,
                                                   java.lang.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 java.lang.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,
                                   java.lang.String errorStr)
        Throw a parse exception.
        Parameters:
        params - the parameters with the input string
        errorStr - the error string