public override SqlObject Visit(SqlInScalarExpression sqlInScalarExpression)
        {
            SqlScalarExpression[] items = new SqlScalarExpression[sqlInScalarExpression.Items.Count];
            for (int i = 0; i < sqlInScalarExpression.Items.Count; i++)
            {
                items[i] = sqlInScalarExpression.Items[i].Accept(this) as SqlScalarExpression;
            }

            return(SqlInScalarExpression.Create(
                       sqlInScalarExpression.Expression.Accept(this) as SqlScalarExpression,
                       sqlInScalarExpression.Not,
                       items));
        }
Esempio n. 2
0
        public override int Visit(SqlInScalarExpression sqlInScalarExpression)
        {
            int hashCode = SqlInScalarExpressionHashCode;

            hashCode = CombineHashes(hashCode, sqlInScalarExpression.Expression.Accept(this));
            if (sqlInScalarExpression.Not)
            {
                hashCode = CombineHashes(hashCode, SqlInScalarExpressionNotHashCode);
            }

            for (int i = 0; i < sqlInScalarExpression.Items.Count; i++)
            {
                hashCode = CombineHashes(hashCode, sqlInScalarExpression.Items[i].Accept(this));
            }

            return(hashCode);
        }
        public override void Visit(SqlInScalarExpression sqlInScalarExpression)
        {
            this.writer.Write("(");
            sqlInScalarExpression.Expression.Accept(this);
            if (sqlInScalarExpression.Not)
            {
                this.writer.Write(" NOT");
            }

            this.writer.Write(" IN ");

            int numberOfItems = sqlInScalarExpression.Items.Count();

            if (numberOfItems == 0)
            {
                this.writer.Write("()");
            }
            else if (numberOfItems == 1)
            {
                this.writer.Write("(");
                sqlInScalarExpression.Items[0].Accept(this);
                this.writer.Write(")");
            }
            else
            {
                this.WriteStartContext("(");

                for (int i = 0; i < sqlInScalarExpression.Items.Count; i++)
                {
                    if (i > 0)
                    {
                        this.WriteDelimiter(",");
                    }

                    sqlInScalarExpression.Items[i].Accept(this);
                }

                this.WriteEndContext(")");
            }
            this.writer.Write(")");
        }
        public override void Visit(SqlInScalarExpression sqlInScalarExpression)
        {
            this.writer.Write("(");
            sqlInScalarExpression.Expression.Accept(this);
            if (sqlInScalarExpression.Not)
            {
                this.writer.Write(" NOT");
            }

            this.writer.Write(" IN ");
            this.writer.Write("(");
            for (int i = 0; i < sqlInScalarExpression.Items.Count; i++)
            {
                if (i > 0)
                {
                    this.writer.Write(", ");
                }

                sqlInScalarExpression.Items[i].Accept(this);
            }

            this.writer.Write(")");
            this.writer.Write(")");
        }
 public abstract void Visit(SqlInScalarExpression scalarExpression);
 protected abstract SqlScalarExpression Visit(SqlInScalarExpression expression);