コード例 #1
0
        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));
        }
コード例 #2
0
 public override SqlObject Visit(SqlLiteralScalarExpression sqlLiteralScalarExpression)
 {
     return(SqlLiteralScalarExpression.Create(sqlLiteralScalarExpression.Literal.Accept(this) as SqlLiteral));
 }