Esempio n. 1
0
 internal override SqlExpression VisitMultiset(SqlSubSelect sms)
 {
     if (((((this.options & SqlMultiplexer.Options.EnableBigJoin) != SqlMultiplexer.Options.None) && !this.hasBigJoin) &&
          (this.canJoin && this.isTopLevel)) && (((this.outerSelect != null) && !MultisetChecker.HasMultiset(sms.Select.Selection)) &&
                                                 BigJoinChecker.CanBigJoin(sms.Select)))
     {
         sms.Select = this.VisitSelect(sms.Select);
         SqlAlias right = new SqlAlias(sms.Select);
         SqlJoin  join  = new SqlJoin(SqlJoinType.OuterApply, this.outerSelect.From, right, null, sms.SourceExpression);
         this.outerSelect.From         = join;
         this.outerSelect.OrderingType = SqlOrderingType.Always;
         SqlExpression expression = (SqlExpression)SqlDuplicator.Copy(sms.Select.Selection);
         SqlSelect     node       = (SqlSelect)SqlDuplicator.Copy(sms.Select);
         SqlAlias      from       = new SqlAlias(node);
         SqlSelect     select     = new SqlSelect(this.sql.Unary(SqlNodeType.Count, null, sms.SourceExpression), from, sms.SourceExpression);
         select.OrderingType = SqlOrderingType.Never;
         SqlExpression       count   = this.sql.SubSelect(SqlNodeType.ScalarSubSelect, select);
         SqlJoinedCollection joineds = new SqlJoinedCollection(sms.ClrType, sms.SqlType, expression, count, sms.SourceExpression);
         this.hasBigJoin = true;
         return(joineds);
     }
     return(QueryExtractor.Extract(sms, this.parentParameters, sqlIdentity));
 }
Esempio n. 2
0
 internal override SqlExpression VisitElement(SqlSubSelect elem)
 {
     return(QueryExtractor.Extract(elem, this.parentParameters, sqlIdentity));
 }