private SqlJoin GetLeftOuterWithUnreferencedSingletonOnLeft(SqlSource source)
            {
                SqlAlias alias = source as SqlAlias;

                if (alias != null)
                {
                    SqlSelect node = alias.Node as SqlSelect;
                    if ((((node != null) && (node.Where == null)) && ((node.Top == null) && (node.GroupBy.Count == 0))) &&
                        (node.OrderBy.Count == 0))
                    {
                        return(this.GetLeftOuterWithUnreferencedSingletonOnLeft(node.From));
                    }
                }
                SqlJoin join = source as SqlJoin;

                if ((join == null) || (join.JoinType != SqlJoinType.LeftOuter))
                {
                    return(null);
                }
                if (!this.IsSingletonSelect(join.Left))
                {
                    return(null);
                }
                Dictionary <SqlAlias, bool> dictionary = SqlGatherProducedAliases.Gather(join.Left);

                foreach (SqlAlias alias2 in SqlGatherConsumedAliases.Gather(join.Right).Keys)
                {
                    if (dictionary.ContainsKey(alias2))
                    {
                        return(null);
                    }
                }
                return(join);
            }
Exemple #2
0
            // Methods
            internal override SqlSource VisitJoin(SqlJoin join)
            {
                if (join.JoinType != SqlJoinType.CrossApply)
                {
                    return(base.VisitJoin(join));
                }
                Dictionary <SqlAlias, bool> dictionary = SqlGatherProducedAliases.Gather(join.Left);

                foreach (SqlAlias alias in SqlGatherConsumedAliases.Gather(join.Right).Keys)
                {
                    if (dictionary.ContainsKey(alias))
                    {
                        this.Annotations.Add(join,
                                             new SqlServerCompatibilityAnnotation(
                                                 Strings.SourceExpressionAnnotation(join.SourceExpression),
                                                 new SqlProvider.ProviderMode[] { SqlProvider.ProviderMode.Sql2000 }));
                        return(base.VisitJoin(join));
                    }
                }
                join.JoinType = SqlJoinType.Cross;
                return(this.VisitJoin(join));
            }