public static SqlOffsetSpec Create(SqlNumberLiteral sqlNumberLiteral) { if (sqlNumberLiteral == null) { throw new ArgumentNullException(nameof(sqlNumberLiteral)); } long value; if (!sqlNumberLiteral.Value.IsInteger) { throw new ArgumentOutOfRangeException($"Expected {nameof(sqlNumberLiteral)} to be an integer."); } value = Number64.ToLong(sqlNumberLiteral.Value); if (value < PremadeOffsetIndex && value >= 0) { return(SqlOffsetSpec.PremadeOffsetSpecs[value]); } SqlScalarExpression offsetExpression = SqlLiteralScalarExpression.Create( SqlNumberLiteral.Create( value)); return(new SqlOffsetSpec(offsetExpression)); }
public override SqlObject Visit(SqlLiteralScalarExpression sqlLiteralScalarExpression) { return(SqlLiteralScalarExpression.Create(sqlLiteralScalarExpression.Literal.Accept(this) as SqlLiteral)); }