Esempio n. 1
0
        public void ResolveRangeTable(Session session, RangeVariable[] rangeVariables, int rangeCount, RangeVariable[] outerRanges)
        {
            SubQuery subQuery = this.RangeTable.GetSubQuery();

            if ((subQuery != null) && !subQuery.IsResolved())
            {
                if (subQuery.DataExpression != null)
                {
                    List <Expression> list = subQuery.DataExpression.ResolveColumnReferences(EmptyArray, null);
                    if (list != null)
                    {
                        list = subQuery.DataExpression.ResolveColumnReferences(rangeVariables, rangeCount, null, true);
                    }
                    if (list != null)
                    {
                        list = subQuery.DataExpression.ResolveColumnReferences(outerRanges, null);
                    }
                    if (list != null)
                    {
                        throw Error.GetError(0x157d, list[0].GetSql());
                    }
                    subQuery.DataExpression.ResolveTypes(session, null);
                    this.SetRangeTableVariables();
                }
                if (subQuery.queryExpression != null)
                {
                    subQuery.queryExpression.ResolveReferences(session, outerRanges);
                    List <Expression> unresolvedExpressions = subQuery.queryExpression.GetUnresolvedExpressions();
                    List <Expression> list3 = Expression.ResolveColumnSet(rangeVariables, rangeCount, unresolvedExpressions, null);
                    if (list3 != null)
                    {
                        throw Error.GetError(0x157d, list3[0].GetSql());
                    }
                    subQuery.queryExpression.ResolveTypes(session);
                    subQuery.PrepareTable(session);
                    subQuery.SetCorrelated();
                    this.SetRangeTableVariables();
                }
            }
        }