public static SqlDateLiteral parseDateLiteral(String s, SqlParserPos pos) { final String dateStr = parseString(s); final Calendar cal = DateTimeUtils.parseDateFormat(dateStr, Format.PER_THREAD.get().date, DateTimeUtils.UTC_ZONE); if (cal == null) { throw SqlUtil.newContextException(pos, RESOURCE.illegalLiteral("DATE", s, RESOURCE.badFormat(DateTimeUtils.DATE_FORMAT_STRING).str())); } final DateString d = DateString.fromCalendarFields(cal); return SqlLiteral.createDate(d, pos); }
public static SqlDateLiteral parseDateLiteral(String s, SqlParserPos pos) { final String dateStr = parseString(s); final Calendar cal = DateTimeUtils.parseDateFormat(dateStr, Format.PER_THREAD.get().date, DateTimeUtils.UTC_ZONE); if (cal == null) { throw SqlUtil.newContextException(pos, RESOURCE.illegalLiteral("DATE", s, RESOURCE.badFormat(DateTimeUtils.DATE_FORMAT_STRING).str())); } final DateString d = DateString.fromCalendarFields(cal); return SqlLiteral.createDate(d, pos); }
public static SqlTimeLiteral parseTimeLiteral(String s, SqlParserPos pos) { final String dateStr = parseString(s); final DateTimeUtils.PrecisionTime pt = DateTimeUtils.parsePrecisionDateTimeLiteral(dateStr, Format.PER_THREAD.get().time, DateTimeUtils.UTC_ZONE, -1); if (pt == null) { throw SqlUtil.newContextException(pos, RESOURCE.illegalLiteral("TIME", s, RESOURCE.badFormat(DateTimeUtils.TIME_FORMAT_STRING).str())); } final TimeString t = TimeString.fromCalendarFields(pt.getCalendar()) .withFraction(pt.getFraction()); return SqlLiteral.createTime(t, pt.getPrecision(), pos); }
public static SqlTimestampLiteral parseTimestampLiteral(String s, SqlParserPos pos) { final String dateStr = parseString(s); final DateTimeUtils.PrecisionTime pt = DateTimeUtils.parsePrecisionDateTimeLiteral(dateStr, Format.PER_THREAD.get().timestamp, DateTimeUtils.UTC_ZONE, -1); if (pt == null) { throw SqlUtil.newContextException(pos, RESOURCE.illegalLiteral("TIMESTAMP", s, RESOURCE.badFormat(DateTimeUtils.TIMESTAMP_FORMAT_STRING).str())); } final TimestampString ts = TimestampString.fromCalendarFields(pt.getCalendar()) .withFraction(pt.getFraction()); return SqlLiteral.createTimestamp(ts, pt.getPrecision(), pos); }
public static SqlTimeLiteral parseTimeLiteral(String s, SqlParserPos pos) { final String dateStr = parseString(s); final DateTimeUtils.PrecisionTime pt = DateTimeUtils.parsePrecisionDateTimeLiteral(dateStr, Format.PER_THREAD.get().time, DateTimeUtils.UTC_ZONE, -1); if (pt == null) { throw SqlUtil.newContextException(pos, RESOURCE.illegalLiteral("TIME", s, RESOURCE.badFormat(DateTimeUtils.TIME_FORMAT_STRING).str())); } final TimeString t = TimeString.fromCalendarFields(pt.getCalendar()) .withFraction(pt.getFraction()); return SqlLiteral.createTime(t, pt.getPrecision(), pos); }
@Override public String toString() { return RESOURCE.parserContext(lineNumber, columnNumber).str(); }
public static SqlTimestampLiteral parseTimestampLiteral(String s, SqlParserPos pos) { final String dateStr = parseString(s); final DateTimeUtils.PrecisionTime pt = DateTimeUtils.parsePrecisionDateTimeLiteral(dateStr, Format.PER_THREAD.get().timestamp, DateTimeUtils.UTC_ZONE, -1); if (pt == null) { throw SqlUtil.newContextException(pos, RESOURCE.illegalLiteral("TIMESTAMP", s, RESOURCE.badFormat(DateTimeUtils.TIMESTAMP_FORMAT_STRING).str())); } final TimestampString ts = TimestampString.fromCalendarFields(pt.getCalendar()) .withFraction(pt.getFraction()); return SqlLiteral.createTimestamp(ts, pt.getPrecision(), pos); }
SqlTimestampLiteral parseTimestampLiteral(String s, SqlParserPos pos) throws ParseException { String dateStr = SqlParserUtil.parseString(s); DateTimeUtils.PrecisionTime pt = DateTimeUtils.parsePrecisionDateTimeLiteral( dateStr, DateTimeUtils.TIMESTAMP_FORMAT_STRING, DateTimeUtils.GMT_ZONE); if (null == pt) { throw SqlUtil.newContextException(pos, RESOURCE.illegalLiteral("TIMESTAMP", s, RESOURCE.badFormat(DateTimeUtils.TIMESTAMP_FORMAT_STRING).str())); } return SqlLiteral.createTimestamp(pt.getCalendar(), pt.getPrecision(), pos); }
SqlTimeLiteral parseTimeLiteral(String s, SqlParserPos pos) throws ParseException { String dateStr = SqlParserUtil.parseString(s); DateTimeUtils.PrecisionTime pt = DateTimeUtils.parsePrecisionDateTimeLiteral( dateStr, DateTimeUtils.TIME_FORMAT_STRING, DateTimeUtils.GMT_ZONE); if (null == pt) { throw SqlUtil.newContextException(pos, RESOURCE.illegalLiteral("TIME", s, RESOURCE.badFormat(DateTimeUtils.TIME_FORMAT_STRING).str())); } return SqlLiteral.createTime(pt.getCalendar(), pt.getPrecision(), pos); }
SqlTimeLiteral parseTimeLiteral(String s, SqlParserPos pos) throws ParseException { String dateStr = SqlParserUtil.parseString(s); DateTimeUtils.PrecisionTime pt = DateTimeUtils.parsePrecisionDateTimeLiteral( dateStr, DateTimeUtils.TIME_FORMAT_STRING, DateTimeUtils.GMT_ZONE); if (null == pt) { throw SqlUtil.newContextException(pos, RESOURCE.illegalLiteral("TIME", s, RESOURCE.badFormat(DateTimeUtils.TIME_FORMAT_STRING).str())); } return SqlLiteral.createTime(pt.getCalendar(), pt.getPrecision(), pos); }
SqlTimeLiteral parseTimeLiteral(String s, SqlParserPos pos) throws ParseException { String dateStr = SqlParserUtil.parseString(s); DateTimeUtils.PrecisionTime pt = DateTimeUtils.parsePrecisionDateTimeLiteral( dateStr, DateTimeUtils.TIME_FORMAT_STRING, DateTimeUtils.GMT_ZONE); if (null == pt) { throw SqlUtil.newContextException(pos, RESOURCE.illegalLiteral("TIME", s, RESOURCE.badFormat(DateTimeUtils.TIME_FORMAT_STRING).str())); } return SqlLiteral.createTime(pt.getCalendar(), pt.getPrecision(), pos); }
@Override public String toString() { return RESOURCE.parserContext(lineNumber, columnNumber).str(); }
SqlTimestampLiteral parseTimestampLiteral(String s, SqlParserPos pos) throws ParseException { String dateStr = SqlParserUtil.parseString(s); DateTimeUtils.PrecisionTime pt = DateTimeUtils.parsePrecisionDateTimeLiteral( dateStr, DateTimeUtils.TIMESTAMP_FORMAT_STRING, DateTimeUtils.GMT_ZONE); if (null == pt) { throw SqlUtil.newContextException(pos, RESOURCE.illegalLiteral("TIMESTAMP", s, RESOURCE.badFormat(DateTimeUtils.TIMESTAMP_FORMAT_STRING).str())); } return SqlLiteral.createTimestamp(pt.getCalendar(), pt.getPrecision(), pos); }
SqlDateLiteral parseDateLiteral(String s, SqlParserPos pos) throws ParseException { String dateStr = SqlParserUtil.parseString(s); Calendar cal = DateTimeUtils.parseDateFormat( dateStr, DateTimeUtils.DATE_FORMAT_STRING, DateTimeUtils.GMT_ZONE); if (null == cal) { throw SqlUtil.newContextException(pos, RESOURCE.illegalLiteral("DATE", s, RESOURCE.badFormat(DateTimeUtils.DATE_FORMAT_STRING).str())); } return SqlLiteral.createDate(cal, pos); }
SqlDateLiteral parseDateLiteral(String s, SqlParserPos pos) throws ParseException { String dateStr = SqlParserUtil.parseString(s); Calendar cal = DateTimeUtils.parseDateFormat( dateStr, DateTimeUtils.DATE_FORMAT_STRING, DateTimeUtils.GMT_ZONE); if (null == cal) { throw SqlUtil.newContextException(pos, RESOURCE.illegalLiteral("DATE", s, RESOURCE.badFormat(DateTimeUtils.DATE_FORMAT_STRING).str())); } return SqlLiteral.createDate(cal, pos); }
SqlDateLiteral parseDateLiteral(String s, SqlParserPos pos) throws ParseException { String dateStr = SqlParserUtil.parseString(s); Calendar cal = DateTimeUtils.parseDateFormat( dateStr, DateTimeUtils.DATE_FORMAT_STRING, DateTimeUtils.GMT_ZONE); if (null == cal) { throw SqlUtil.newContextException(pos, RESOURCE.illegalLiteral("DATE", s, RESOURCE.badFormat(DateTimeUtils.DATE_FORMAT_STRING).str())); } return SqlLiteral.createDate(cal, pos); }
SqlTimestampLiteral parseTimestampLiteral(String s, SqlParserPos pos) throws ParseException { String dateStr = SqlParserUtil.parseString(s); DateTimeUtils.PrecisionTime pt = DateTimeUtils.parsePrecisionDateTimeLiteral( dateStr, DateTimeUtils.TIMESTAMP_FORMAT_STRING, DateTimeUtils.GMT_ZONE); if (null == pt) { throw SqlUtil.newContextException(pos, RESOURCE.illegalLiteral("TIMESTAMP", s, RESOURCE.badFormat(DateTimeUtils.TIMESTAMP_FORMAT_STRING).str())); } return SqlLiteral.createTimestamp(pt.getCalendar(), pt.getPrecision(), pos); }