EFIngresProvider/SqlGen/SqlGenerator/SqlGeneratorCommonVisitors.cs
/// <summary>
/// This is called by the relational nodes.  It does the following
/// <list>
/// <item>If the input is not a SqlSelectStatement, it assumes that the input
/// is a collection expression, and creates a new SqlSelectStatement </item>
/// </list>
/// </summary>
/// <param name="inputExpression"></param>
/// <param name="inputVarName"></param>
/// <param name="inputVarType"></param>
/// <param name="fromSymbol"></param>
/// <returns>A <see cref="SqlSelectStatement"/> and the main fromSymbol
/// for this select statement.</returns>
This is called by the relational nodes.  It does the following
If the input is not a SqlSelectStatement, it assumes that the input
is a collection expression, and creates a new SqlSelectStatement
This is called by the relational nodes . It does the following If the input is not a SqlSelectStatement it assumes that the input is a collection expression and creates a new SqlSelectStatement
private SqlSelectStatement VisitInputExpression(DbExpression inputExpression, string inputVarName, TypeUsage inputVarType, out Symbol fromSymbol)
        {
            SqlSelectStatement result;
            ISqlFragment sqlFragment = inputExpression.Accept(this);
            result = sqlFragment as SqlSelectStatement;
            if (result == null)
            {
                result = new SqlSelectStatement();
                WrapNonQueryExtent(result, sqlFragment, inputExpression.ExpressionKind);
            }
            if (result.FromExtents.Count == 0)
            {
                fromSymbol = new Symbol(inputVarName, inputVarType);
            }
            else if (result.FromExtents.Count == 1)
            {
                fromSymbol = result.FromExtents[0];
            }
            else
            {
                JoinSymbol joinSymbol = new JoinSymbol(inputVarName, inputVarType, result.FromExtents);
                joinSymbol.FlattenedExtentList = result.AllJoinExtents;
                fromSymbol = joinSymbol;
                result.FromExtents.Clear();
                result.FromExtents.Add(fromSymbol);
            }
            return result;
        }
private SqlSelectStatement VisitInputExpression ( DbExpression inputExpression , string inputVarName , TypeUsage inputVarType , out Symbol fromSymbol ) { SqlSelectStatement result ; ISqlFragment sqlFragment = inputExpression . Accept ( this ) ; result = sqlFragment as SqlSelectStatement ; if ( result == null ) { result = new SqlSelectStatement ( ) ; WrapNonQueryExtent ( result , sqlFragment , inputExpression . ExpressionKind ) ; } if ( result . FromExtents . Count == 0 ) { fromSymbol = new Symbol ( inputVarName , inputVarType ) ; } else if ( result . FromExtents . Count == 1 ) { fromSymbol = result . FromExtents [ 0 ] ; } else { JoinSymbol joinSymbol = new JoinSymbol ( inputVarName , inputVarType , result . FromExtents ) ; joinSymbol . FlattenedExtentList = result . AllJoinExtents ; fromSymbol = joinSymbol ; result . FromExtents . Clear ( ) ; result . FromExtents . Add ( fromSymbol ) ; } return result ; }
This is called by the relational nodes.
This is called by the relational nodes .
// input was an extent // input was Filter/GroupBy/Project/OrderBy // we are likely to reuse this statement. // input was a join. // we are reusing the select statement produced by a Join node // we need to remove the original extents, and replace them with a // new extent with just the Join symbol.
A  and the main fromSymbol
for this select statement.
A and the main fromSymbol for this select statement .
inputExpression
DbExpression
None
inputVarName
string
None
inputVarType
TypeUsage
None
Symbol
out
fromSymbol
None