public SqlUnion(SelectQuery selectQuery, bool isAll) { SelectQuery = selectQuery; IsAll = isAll; }
/// <summary> /// Returns HirarchyInfo for specific selectQuery /// </summary> /// <param name="selectQuery"></param> /// <returns></returns> public HierarchyInfo GetHierarchyInfo(SelectQuery selectQuery) { CheckInitialized(); _parents.TryGetValue(selectQuery, out var result); return(result); }
internal SqlSelectClause(SelectQuery selectQuery) : base(selectQuery) { }
public SelectQueryOptimizer(SqlProviderFlags flags, SelectQuery selectQuery) { _flags = flags; _selectQuery = selectQuery; }
/// <summary> /// Returns parent query if query is subquery for select /// </summary> /// <param name="selectQuery"></param> /// <returns></returns> public SelectQuery GetParentQuery(SelectQuery selectQuery) { var info = GetHierarchyInfo(selectQuery); return(info?.HierarchyType == HierarchyType.From ? info.MasterQuery : null); }
internal SqlOrderByClause(SelectQuery selectQuery) : base(selectQuery) { }
public SqlColumn(SelectQuery builder, ISqlExpression expression) : this(builder, expression, null) { }
public static SqlFromClause.Join OuterApply(this ISqlTableSource table, params SqlFromClause.Join[] joins) { return(SelectQuery.OuterApply(table, joins)); }
public static SqlFromClause.Join WeakLeftJoin(this ISqlTableSource table, params SqlFromClause.Join[] joins) { return(SelectQuery.WeakLeftJoin(table, joins)); }
public override StringBuilder ToString(StringBuilder sb, Dictionary <IQueryElement, IQueryElement> dic) { return(SelectQuery.ToString(sb, dic)); }
public SqlSelectStatement(SelectQuery selectQuery) : base(selectQuery) { }
protected override void Walk(WalkOptions options, Func <ISqlExpression, ISqlExpression> func) { base.Walk(options, func); SubQuery = (SelectQuery)((ISqlExpression)SubQuery).Walk(options, func) !; }
public InSubQuery(ISqlExpression exp1, bool isNot, SelectQuery subQuery) : base(exp1, isNot, SqlQuery.Precedence.Comparison) { SubQuery = subQuery; }
internal SqlFromClause(SelectQuery selectQuery) : base(selectQuery) { }
internal SqlWhereClause(SelectQuery selectQuery) : base(selectQuery) { SearchCondition = new SqlSearchCondition(); }
public static SqlFromClause.Join WeakJoin(this ISqlTableSource table, string alias, params SqlFromClause.Join[] joins) { return(SelectQuery.WeakJoin(table, alias, joins)); }
public static SqlFunction CreateAny(SelectQuery subQuery) { return(new SqlFunction(typeof(bool), "ANY", false, SqlQuery.Precedence.Comparison, subQuery)); }
public HierarchyInfo(SelectQuery masterQuery, HierarchyType hierarchyType, IQueryElement parentElement) { MasterQuery = masterQuery; HierarchyType = hierarchyType; ParentElement = parentElement; }
void Visit2X(SelectQuery q) { Visit2(q.Select); // Visit2(q.From); // if (q.From != null && (_all || !_visitedElements.ContainsKey(q.From))) { foreach (var t in q.From.Tables) { //Visit2(t); // if (t != null && (_all || !_visitedElements.ContainsKey(t))) { Visit2(t.Source); foreach (var j in t.Joins) { Visit2(j); } _action2 !(t); if (!_all && !_visitedElements.ContainsKey(t)) { _visitedElements.Add(t, t); } } } _action2 !(q.From); if (!_all && !_visitedElements.ContainsKey(q.From)) { _visitedElements.Add(q.From, q.From); } } Visit2(q.Where); Visit2(q.GroupBy); Visit2(q.Having); Visit2(q.OrderBy); if (q.HasSetOperators) { foreach (var i in q.SetOperators) { if (i.SelectQuery == q) { throw new InvalidOperationException(); } Visit2(i); } } // decided to do not enumerate unique keys // if (q.HasUniqueKeys) // foreach (var keyList in q.UniqueKeys) // { // Visit2X(keyList); // } }
/// <summary> /// This is internal API and is not intended for use by Linq To DB applications. /// It may change or be removed without further notice. /// </summary> public QueryInformation([NotNull] SelectQuery rootQuery) { _rootQuery = rootQuery ?? throw new ArgumentNullException(nameof(rootQuery)); }
internal SqlGroupByClause(SelectQuery selectQuery) : base(selectQuery) { }
protected override void Walk(bool skipColumns, Func <ISqlExpression, ISqlExpression> func) { base.Walk(skipColumns, func); SubQuery = (SelectQuery)((ISqlExpression)SubQuery).Walk(skipColumns, func); }