public ToDateFunction(List<Expression> children, StatementContext context) throws SQLException { super(children); String dateFormat = (String) ((LiteralExpression) children.get(1)).getValue(); String timeZoneId = (String) ((LiteralExpression) children.get(2)).getValue(); if (dateFormat == null) { dateFormat = context.getDateFormat(); } if (timeZoneId == null) { timeZoneId = context.getDateFormatTimeZone().getID(); } init(dateFormat, timeZoneId); }
public ToNumberFunction(List<Expression> children, StatementContext context) throws SQLException { super(children.subList(0, 1)); PDataType dataType = children.get(0).getDataType(); String formatString = (String)((LiteralExpression)children.get(1)).getValue(); // either date or number format string Format formatter = null; FunctionArgumentType type; if (dataType.isCoercibleTo(PTimestamp.INSTANCE)) { if (formatString == null) { formatString = context.getDateFormat(); formatter = context.getDateFormatter(); } else { formatter = FunctionArgumentType.TEMPORAL.getFormatter(formatString); } type = FunctionArgumentType.TEMPORAL; } else if (dataType.isCoercibleTo(PChar.INSTANCE)) { if (formatString != null) { formatter = FunctionArgumentType.CHAR.getFormatter(formatString); } type = FunctionArgumentType.CHAR; } else { throw new SQLException(dataType + " type is unsupported for TO_NUMBER(). Numeric and temporal types are supported."); } Preconditions.checkNotNull(type); this.type = type; this.formatString = formatString; this.format = formatter; }
if (dataType.isCoercibleTo(PTimestamp.INSTANCE)) { if (formatString == null) { formatString = context.getDateFormat(); formatter = context.getDateFormatter(); } else {
@Override public FunctionExpression create(List<Expression> children, StatementContext context) throws SQLException { String dateFormat = (String) ((LiteralExpression) children.get(1)).getValue(); String timeZoneId = (String) ((LiteralExpression) children.get(2)).getValue(); if (dateFormat == null) { dateFormat = context.getDateFormat(); } if (timeZoneId == null) { timeZoneId = context.getDateFormatTimeZone().getID(); } return new ToDateFunction(children, dateFormat, timeZoneId); } }
@Override public FunctionExpression create(List<Expression> children, StatementContext context) throws SQLException { PDataType dataType = children.get(0).getDataType(); String formatString = (String)((LiteralExpression)children.get(1)).getValue(); // either date or number format string Format formatter = null; FunctionArgumentType type; if (dataType.isCoercibleTo(PTimestamp.INSTANCE)) { if (formatString == null) { formatString = context.getDateFormat(); formatter = context.getDateFormatter(); } else { formatter = FunctionArgumentType.TEMPORAL.getFormatter(formatString); } type = FunctionArgumentType.TEMPORAL; } else if (dataType.isCoercibleTo(PChar.INSTANCE)) { if (formatString != null) { formatter = FunctionArgumentType.CHAR.getFormatter(formatString); } type = FunctionArgumentType.CHAR; } else { throw new SQLException(dataType + " type is unsupported for TO_NUMBER(). Numeric and temporal types are supported."); } return new ToNumberFunction(children, type, formatString, formatter); } }
public ToDateFunction(List<Expression> children, StatementContext context) throws SQLException { super(children); String dateFormat = (String) ((LiteralExpression) children.get(1)).getValue(); String timeZoneId = (String) ((LiteralExpression) children.get(2)).getValue(); if (dateFormat == null) { dateFormat = context.getDateFormat(); } if (timeZoneId == null) { timeZoneId = context.getDateFormatTimeZone().getID(); } init(dateFormat, timeZoneId); }
@Override public FunctionExpression create(List<Expression> children, StatementContext context) throws SQLException { PDataType dataType = children.get(0).getDataType(); String formatString = (String)((LiteralExpression)children.get(1)).getValue(); // either date or number format string Format formatter; FunctionArgumentType type; if (dataType.isCoercibleTo(PTimestamp.INSTANCE)) { if (formatString == null) { formatString = context.getDateFormat(); formatter = context.getDateFormatter(); } else { formatter = FunctionArgumentType.TEMPORAL.getFormatter(formatString); } type = FunctionArgumentType.TEMPORAL; } else if (dataType.isCoercibleTo(PDecimal.INSTANCE)) { if (formatString == null) formatString = context.getNumberFormat(); formatter = FunctionArgumentType.NUMERIC.getFormatter(formatString); type = FunctionArgumentType.NUMERIC; } else { throw new SQLException(dataType + " type is unsupported for TO_CHAR(). Numeric and temporal types are supported."); } return new ToCharFunction(children, type, formatString, formatter); } }
@Override public FunctionExpression create(List<Expression> children, StatementContext context) throws SQLException { String dateFormat = (String) ((LiteralExpression) children.get(1)).getValue(); String timeZoneId = (String) ((LiteralExpression) children.get(2)).getValue(); if (dateFormat == null) { dateFormat = context.getDateFormat(); } if (timeZoneId == null) { timeZoneId = context.getDateFormatTimeZone().getID(); } return new ToDateFunction(children, dateFormat, timeZoneId); } }
public ToNumberFunction(List<Expression> children, StatementContext context) throws SQLException { super(children.subList(0, 1)); PDataType dataType = children.get(0).getDataType(); String formatString = (String)((LiteralExpression)children.get(1)).getValue(); // either date or number format string Format formatter = null; FunctionArgumentType type; if (dataType.isCoercibleTo(PTimestamp.INSTANCE)) { if (formatString == null) { formatString = context.getDateFormat(); formatter = context.getDateFormatter(); } else { formatter = FunctionArgumentType.TEMPORAL.getFormatter(formatString); } type = FunctionArgumentType.TEMPORAL; } else if (dataType.isCoercibleTo(PChar.INSTANCE)) { if (formatString != null) { formatter = FunctionArgumentType.CHAR.getFormatter(formatString); } type = FunctionArgumentType.CHAR; } else { throw new SQLException(dataType + " type is unsupported for TO_NUMBER(). Numeric and temporal types are supported."); } Preconditions.checkNotNull(type); this.type = type; this.formatString = formatString; this.format = formatter; }
public ToDateFunction(List<Expression> children, StatementContext context) throws SQLException { super(children); String dateFormat = (String) ((LiteralExpression) children.get(1)).getValue(); String timeZoneId = (String) ((LiteralExpression) children.get(2)).getValue(); if (dateFormat == null) { dateFormat = context.getDateFormat(); } if (timeZoneId == null) { timeZoneId = context.getDateFormatTimeZone().getID(); } init(dateFormat, timeZoneId); }
public ToNumberFunction(List<Expression> children, StatementContext context) throws SQLException { super(children.subList(0, 1)); PDataType dataType = children.get(0).getDataType(); String formatString = (String)((LiteralExpression)children.get(1)).getValue(); // either date or number format string Format formatter = null; FunctionArgumentType type; if (dataType.isCoercibleTo(PTimestamp.INSTANCE)) { if (formatString == null) { formatString = context.getDateFormat(); formatter = context.getDateFormatter(); } else { formatter = FunctionArgumentType.TEMPORAL.getFormatter(formatString); } type = FunctionArgumentType.TEMPORAL; } else if (dataType.isCoercibleTo(PChar.INSTANCE)) { if (formatString != null) { formatter = FunctionArgumentType.CHAR.getFormatter(formatString); } type = FunctionArgumentType.CHAR; } else { throw new SQLException(dataType + " type is unsupported for TO_NUMBER(). Numeric and temporal types are supported."); } Preconditions.checkNotNull(type); this.type = type; this.formatString = formatString; this.format = formatter; }
@Override public FunctionExpression create(List<Expression> children, StatementContext context) throws SQLException { String dateFormat = (String) ((LiteralExpression) children.get(1)).getValue(); String timeZoneId = (String) ((LiteralExpression) children.get(2)).getValue(); if (dateFormat == null) { dateFormat = context.getDateFormat(); } if (timeZoneId == null) { timeZoneId = context.getDateFormatTimeZone().getID(); } return new ToDateFunction(children, dateFormat, timeZoneId); } }
if (dataType.isCoercibleTo(PTimestamp.INSTANCE)) { if (formatString == null) { formatString = context.getDateFormat(); formatter = context.getDateFormatter(); } else {
if (dataType.isCoercibleTo(PTimestamp.INSTANCE)) { if (formatString == null) { formatString = context.getDateFormat(); formatter = context.getDateFormatter(); } else {
@Override public FunctionExpression create(List<Expression> children, StatementContext context) throws SQLException { PDataType dataType = children.get(0).getDataType(); String formatString = (String)((LiteralExpression)children.get(1)).getValue(); // either date or number format string Format formatter = null; FunctionArgumentType type; if (dataType.isCoercibleTo(PTimestamp.INSTANCE)) { if (formatString == null) { formatString = context.getDateFormat(); formatter = context.getDateFormatter(); } else { formatter = FunctionArgumentType.TEMPORAL.getFormatter(formatString); } type = FunctionArgumentType.TEMPORAL; } else if (dataType.isCoercibleTo(PChar.INSTANCE)) { if (formatString != null) { formatter = FunctionArgumentType.CHAR.getFormatter(formatString); } type = FunctionArgumentType.CHAR; } else { throw new SQLException(dataType + " type is unsupported for TO_NUMBER(). Numeric and temporal types are supported."); } return new ToNumberFunction(children, type, formatString, formatter); } }
@Override public FunctionExpression create(List<Expression> children, StatementContext context) throws SQLException { PDataType dataType = children.get(0).getDataType(); String formatString = (String)((LiteralExpression)children.get(1)).getValue(); // either date or number format string Format formatter = null; FunctionArgumentType type; if (dataType.isCoercibleTo(PTimestamp.INSTANCE)) { if (formatString == null) { formatString = context.getDateFormat(); formatter = context.getDateFormatter(); } else { formatter = FunctionArgumentType.TEMPORAL.getFormatter(formatString); } type = FunctionArgumentType.TEMPORAL; } else if (dataType.isCoercibleTo(PChar.INSTANCE)) { if (formatString != null) { formatter = FunctionArgumentType.CHAR.getFormatter(formatString); } type = FunctionArgumentType.CHAR; } else { throw new SQLException(dataType + " type is unsupported for TO_NUMBER(). Numeric and temporal types are supported."); } return new ToNumberFunction(children, type, formatString, formatter); } }
@Override public FunctionExpression create(List<Expression> children, StatementContext context) throws SQLException { PDataType dataType = children.get(0).getDataType(); String formatString = (String)((LiteralExpression)children.get(1)).getValue(); // either date or number format string Format formatter; FunctionArgumentType type; if (dataType.isCoercibleTo(PTimestamp.INSTANCE)) { if (formatString == null) { formatString = context.getDateFormat(); formatter = context.getDateFormatter(); } else { formatter = FunctionArgumentType.TEMPORAL.getFormatter(formatString); } type = FunctionArgumentType.TEMPORAL; } else if (dataType.isCoercibleTo(PDecimal.INSTANCE)) { if (formatString == null) formatString = context.getNumberFormat(); formatter = FunctionArgumentType.NUMERIC.getFormatter(formatString); type = FunctionArgumentType.NUMERIC; } else { throw new SQLException(dataType + " type is unsupported for TO_CHAR(). Numeric and temporal types are supported."); } return new ToCharFunction(children, type, formatString, formatter); } }
@Override public FunctionExpression create(List<Expression> children, StatementContext context) throws SQLException { PDataType dataType = children.get(0).getDataType(); String formatString = (String)((LiteralExpression)children.get(1)).getValue(); // either date or number format string Format formatter; FunctionArgumentType type; if (dataType.isCoercibleTo(PTimestamp.INSTANCE)) { if (formatString == null) { formatString = context.getDateFormat(); formatter = context.getDateFormatter(); } else { formatter = FunctionArgumentType.TEMPORAL.getFormatter(formatString); } type = FunctionArgumentType.TEMPORAL; } else if (dataType.isCoercibleTo(PDecimal.INSTANCE)) { if (formatString == null) formatString = context.getNumberFormat(); formatter = FunctionArgumentType.NUMERIC.getFormatter(formatString); type = FunctionArgumentType.NUMERIC; } else { throw new SQLException(dataType + " type is unsupported for TO_CHAR(). Numeric and temporal types are supported."); } return new ToCharFunction(children, type, formatString, formatter); } }