Ejemplo n.º 1
0
            private void CheckJoinCondition(SqlExpression expr)
            {
                switch (expr.NodeType)
                {
                case SqlNodeType.EQ:
                case SqlNodeType.EQ2V:
                {
                    SqlBinary    binary2 = (SqlBinary)expr;
                    SqlColumnRef left    = binary2.Left as SqlColumnRef;
                    SqlColumnRef right   = binary2.Right as SqlColumnRef;
                    if ((left != null) && (right != null))
                    {
                        SqlColumn rootColumn = left.GetRootColumn();
                        SqlColumn column2    = right.GetRootColumn();
                        this.map[rootColumn] = column2;
                        this.map[column2]    = rootColumn;
                    }
                    return;
                }

                case SqlNodeType.And:
                {
                    SqlBinary binary = (SqlBinary)expr;
                    this.CheckJoinCondition(binary.Left);
                    this.CheckJoinCondition(binary.Right);
                    return;
                }
                }
            }
Ejemplo n.º 2
0
 internal override SqlExpression VisitColumnRef(SqlColumnRef cref)
 {
     if (this.ingoreExternalRefs && !this.nodeMap.ContainsKey(cref.Column))
     {
         return(cref);
     }
     return(new SqlColumnRef((SqlColumn)this.Visit(cref.Column)));
 }
Ejemplo n.º 3
0
 internal override SqlExpression VisitColumnRef(SqlColumnRef cref)
 {
     if ((cref.Column.Name == null) && (this.lastName != null))
     {
         cref.Column.Name = this.lastName;
     }
     return(cref);
 }
Ejemplo n.º 4
0
 internal override SqlExpression VisitColumnRef(SqlColumnRef cref)
 {
     if (this.expressionSink != null)
     {
         this.expressionSink.ReferencedExpressions[cref.Column] = true;
     }
     return(cref);
 }
Ejemplo n.º 5
0
            internal override SqlSelect VisitSelect(SqlSelect select)
            {
                base.VisitSelect(select);
                SqlUnion union = this.GetUnion(select.From);

                if (union != null)
                {
                    SqlSelect left  = union.Left as SqlSelect;
                    SqlSelect right = union.Right as SqlSelect;
                    if (!((left != null) & (right != null)))
                    {
                        return(select);
                    }
                    int num   = 0;
                    int count = left.Row.Columns.Count;
                    while (num < count)
                    {
                        left.Row.Columns[num].Ordinal = select.Row.Columns.Count + num;
                        num++;
                    }
                    int num3 = 0;
                    int num4 = right.Row.Columns.Count;
                    while (num3 < num4)
                    {
                        right.Row.Columns[num3].Ordinal = select.Row.Columns.Count + num3;
                        num3++;
                    }
                    int num5 = 0;
                    int num6 = select.Row.Columns.Count;
                    while (num5 < num6)
                    {
                        SqlExprSet expression = select.Row.Columns[num5].Expression as SqlExprSet;
                        if (expression != null)
                        {
                            int num7 = 0;
                            int num8 = expression.Expressions.Count;
                            while (num7 < num8)
                            {
                                SqlColumnRef ref2 = expression.Expressions[num7] as SqlColumnRef;
                                if ((ref2 != null) && (num7 >= select.Row.Columns.Count))
                                {
                                    ref2.Column.Ordinal = num5;
                                }
                                num7++;
                            }
                        }
                        num5++;
                    }
                    Comparison <SqlColumn> comparison = delegate(SqlColumn x, SqlColumn y)
                    {
                        return(x.Ordinal - y.Ordinal);
                    };
                    left.Row.Columns.Sort(comparison);
                    right.Row.Columns.Sort(comparison);
                }
                return(select);
            }
Ejemplo n.º 6
0
                internal override SqlExpression VisitColumnRef(SqlColumnRef cref)
                {
                    SqlExpression literalValue = this.GetLiteralValue(cref);

                    if (literalValue != null)
                    {
                        return(literalValue);
                    }
                    return(cref);
                }
Ejemplo n.º 7
0
            internal override SqlExpression VisitColumnRef(SqlColumnRef cref)
            {
                SqlExpression expr = base.VisitColumnRef(cref);

                if (expr == cref)
                {
                    return(this.ExtractParameter(expr));
                }
                return(expr);
            }
Ejemplo n.º 8
0
                internal override SqlExpression VisitColumnRef(SqlColumnRef cref)
                {
                    SqlColumnRef ref2;

                    if (this.map.TryGetValue(cref.Column, out ref2))
                    {
                        return(ref2);
                    }
                    return(cref);
                }
Ejemplo n.º 9
0
            internal override SqlExpression VisitColumnRef(SqlColumnRef cref)
            {
                SqlColumn column;

                if (this.map.TryGetValue(cref.Column, out column))
                {
                    return(new SqlColumnRef(column));
                }
                return(cref);
            }
Ejemplo n.º 10
0
                internal override SqlExpression VisitColumnRef(SqlColumnRef cref)
                {
                    //===============================================================================

                    SqlColumn col = this.FindColumn(this.row.Columns, cref.Column);

                    if (col == null)
                    {
                        return(this.MakeFlattenedColumn(cref, null));
                    }
                    return(new SqlColumnRef(col));
                }
Ejemplo n.º 11
0
 internal override SqlExpression VisitColumnRef(SqlColumnRef cref)
 {
     if (!this.columns.ContainsKey(cref.Column))
     {
         this.columns[cref.Column] = true;
         if (cref.Column.Expression != null)
         {
             this.Visit(cref.Column.Expression);
         }
     }
     return(cref);
 }
Ejemplo n.º 12
0
 internal override SqlExpression VisitColumnRef(SqlColumnRef cref)
 {
     if (this.aliasesToCheck.ContainsKey(cref.Column.Alias))
     {
         this.hasDependency = true;
         return(cref);
     }
     if (cref.Column.Expression != null)
     {
         this.Visit(cref.Column.Expression);
     }
     return(cref);
 }
Ejemplo n.º 13
0
 internal override SqlExpression VisitColumnRef(SqlColumnRef cref)
 {
     if (this.parent.aliases.ContainsKey(cref.Column.Alias))
     {
         this.parent.referencesAny = true;
         return(cref);
     }
     if (cref.Column.Expression != null)
     {
         this.Visit(cref.Column.Expression);
     }
     return(cref);
 }
Ejemplo n.º 14
0
            internal bool AreEquivalent(SqlExpression e1, SqlExpression e2)
            {
                SqlColumn column3;

                if (SqlComparer.AreEqual(e1, e2))
                {
                    return(true);
                }
                SqlColumnRef ref2 = e1 as SqlColumnRef;
                SqlColumnRef ref3 = e2 as SqlColumnRef;

                if ((ref2 == null) || (ref3 == null))
                {
                    return(false);
                }
                SqlColumn rootColumn = ref2.GetRootColumn();
                SqlColumn column2    = ref3.GetRootColumn();

                return(this.map.TryGetValue(rootColumn, out column3) && (column3 == column2));
            }
Ejemplo n.º 15
0
            internal override SqlExpression VisitColumnRef(SqlColumnRef cref)
            {
                if ((cref.Column.Alias == null) || !this.removedMap.ContainsKey(cref.Column.Alias))
                {
                    return(cref);
                }

                SqlColumnRef expression;

                //if (cref.Column is SqlDynamicColumn)
                //    expression = cref;
                //else
                expression = cref.Column.Expression as SqlColumnRef;

                if ((expression != null) && (expression.ClrType != cref.ClrType))
                {
                    expression.SetClrType(cref.ClrType);
                    return(this.VisitColumnRef(expression));
                }
                return(expression);
            }
Ejemplo n.º 16
0
            internal override SqlExpression VisitColumnRef(SqlColumnRef cref)
            {
                SqlExpression expression = base.VisitColumnRef(cref);

                if ((expression != null) && (expression == cref))
                {
                    SqlColumn column = cref.Column;
                    SqlColumn col;
                    //if (column is SqlDynamicColumn)
                    //{
                    //    col = new SqlDynamicColumn(column.ClrType, column.SqlType, column.Name, column.MetaMember, null, column.SourceExpression);
                    //}
                    //else
                    //{
                    col = new SqlColumn(column.ClrType, column.SqlType, column.Name, column.MetaMember, null, column.SourceExpression);
                    //}

                    col.Ordinal = column.Ordinal;
                    expression  = new SqlColumnRef(col);
                    col.ClearSourceExpression();
                }
                return(expression);
            }
Ejemplo n.º 17
0
 internal override SqlExpression VisitColumnRef(SqlColumnRef cref)
 {
     this.Visit(cref.Column);
     return(base.VisitColumnRef(cref));
 }
Ejemplo n.º 18
0
 internal override SqlExpression VisitColumnRef(SqlColumnRef cref)
 {
     return(cref);
 }
Ejemplo n.º 19
0
        public override bool Equals(object obj)
        {
            SqlColumnRef ref2 = obj as SqlColumnRef;

            return((ref2 != null) && (ref2.Column == this.column));
        }
Ejemplo n.º 20
0
 internal override SqlExpression VisitColumnRef(SqlColumnRef cref)
 {
     this.VisitAliasConsumed(cref.Column.Alias);
     this.VisitExpression(cref.Column.Expression);
     return(cref);
 }
Ejemplo n.º 21
0
 internal virtual SqlExpression VisitColumnRef(SqlColumnRef cref)
 {
     return(cref);
 }
Ejemplo n.º 22
0
 internal override SqlExpression VisitColumnRef(SqlColumnRef cref)
 {
     this.referenceMap[cref.Column] = cref.Column;
     return(cref);
 }