Пример #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 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);
        }
Пример #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);
        }
Пример #4
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;
 }
Пример #5
0
 internal override SqlExpression VisitIn(SqlIn sin) {
     this.VisitWithParens(sin.Expression, sin);
     sb.Append(" IN (");
     for (int i = 0, n = sin.Values.Count; i < n; i++) {
         if (i > 0) {
             sb.Append(", ");
         }
         this.Visit(sin.Values[i]);
     }
     sb.Append(")");
     return sin;
 }
Пример #6
0
 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;
 }
Пример #7
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;
 }