Ejemplo n.º 1
0
            internal override SqlExpression VisitIn(SqlIn sin)
            {
                // Treat the IN as a series of binary comparison expressions (and coerce if necessary).
                // Check to see if any expressions need to change as a result of coercion, where we start
                // with "sin.Expression IN sin.Values" and coerced expressions are "test IN newValues".
                SqlExpression test             = sin.Expression;
                bool          requiresCoercion = false;
                var           newValues        = new System.Collections.Generic.List <SqlExpression>(sin.Values.Count);
                ProviderType  valueType        = null;

                for (int i = 0, n = sin.Values.Count; i < n; i++)
                {
                    SqlExpression value = sin.Values[i];
                    this.CoerceBinaryArgs(ref test, ref value);
                    if (value != sin.Values[i])
                    {
                        // Build up 'widest' type by repeatedly applying PredictType
                        valueType = null == valueType
                            ? value.SqlType
                            : this.typeProvider.PredictTypeForBinary(SqlNodeType.EQ, value.SqlType, valueType);
                        requiresCoercion = true;
                    }
                    newValues.Add(value);
                }
                if (test != sin.Expression)
                {
                    requiresCoercion = true;
                }
                if (requiresCoercion)
                {
                    ProviderType providerType = this.typeProvider.PredictTypeForBinary(SqlNodeType.EQ, test.SqlType, valueType);
                    sin = new SqlIn(sin.ClrType, providerType, test, newValues, sin.SourceExpression);
                }
                return(sin);
            }
Ejemplo n.º 2
0
 internal virtual SqlExpression VisitIn(SqlIn sin)
 {
     sin.Expression = this.VisitExpression(sin.Expression);
     for (int i = 0, n = sin.Values.Count; i < n; i++)
     {
         sin.Values[i] = this.VisitExpression(sin.Values[i]);
     }
     return(sin);
 }
            internal override SqlExpression VisitIn(SqlIn sin)
            {
                SqlIn nin = new SqlIn(sin.ClrType, sin.SqlType, this.VisitExpression(sin.Expression), sin.Values, sin.SourceExpression);

                for (int i = 0, n = nin.Values.Count; i < n; i++)
                {
                    nin.Values[i] = this.VisitExpression(nin.Values[i]);
                }
                return(nin);
            }
Ejemplo n.º 4
0
            internal override SqlExpression VisitIn(SqlIn sin)
            {
                var sqlIn = new SqlIn(sin.ClrType, sin.SqlType, VisitExpression(sin.Expression), sin.Values, sin.SourceExpression);
                var i     = 0;

                for (var count = sqlIn.Values.Count; i < count; i++)
                {
                    sqlIn.Values[i] = VisitExpression(sqlIn.Values[i]);
                }
                return(sqlIn);
            }