Ejemplo n.º 1
0
        private static Type GetClrType(SqlNode node)
        {
            SqlTableValuedFunctionCall tvf = node as SqlTableValuedFunctionCall;

            if (tvf != null)
            {
                return(tvf.RowType.Type);
            }
            SqlExpression exp = node as SqlExpression;

            if (exp != null)
            {
                if (TypeSystem.IsSequenceType(exp.ClrType))
                {
                    return(TypeSystem.GetElementType(exp.ClrType));
                }
                return(exp.ClrType);
            }
            SqlSelect sel = node as SqlSelect;

            if (sel != null)
            {
                return(sel.Selection.ClrType);
            }
            SqlTable tab = node as SqlTable;

            if (tab != null)
            {
                return(tab.RowType.Type);
            }
            SqlUnion su = node as SqlUnion;

            if (su != null)
            {
                return(su.GetClrType());
            }
            throw Error.UnexpectedNode(node.NodeType);
        }
		internal override SqlNode VisitUnion(SqlUnion su)
		{
			// we don't want to descend inward

			// just check that it's not a UNION ALL
			if(su.All)
			{
				_isValid = false;
			}

			// UNIONs are distinct
			_isDistinct = true;

			// get all members from selection
			this.AddIdentityMembers(su.GetClrType().GetProperties());
			return su;
		}