예제 #1
0
 public SqlUnion(SelectQuery selectQuery, bool isAll)
 {
     SelectQuery = selectQuery;
     IsAll       = isAll;
 }
예제 #2
0
 /// <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);
 }
예제 #3
0
 internal SqlSelectClause(SelectQuery selectQuery) : base(selectQuery)
 {
 }
예제 #4
0
 public SelectQueryOptimizer(SqlProviderFlags flags, SelectQuery selectQuery)
 {
     _flags       = flags;
     _selectQuery = selectQuery;
 }
예제 #5
0
        /// <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);
        }
예제 #6
0
 internal SqlOrderByClause(SelectQuery selectQuery) : base(selectQuery)
 {
 }
예제 #7
0
 public SqlColumn(SelectQuery builder, ISqlExpression expression)
     : this(builder, expression, null)
 {
 }
예제 #8
0
 public static SqlFromClause.Join OuterApply(this ISqlTableSource table, params SqlFromClause.Join[] joins)
 {
     return(SelectQuery.OuterApply(table, joins));
 }
예제 #9
0
 public static SqlFromClause.Join WeakLeftJoin(this ISqlTableSource table, params SqlFromClause.Join[] joins)
 {
     return(SelectQuery.WeakLeftJoin(table, joins));
 }
예제 #10
0
 public override StringBuilder ToString(StringBuilder sb, Dictionary <IQueryElement, IQueryElement> dic)
 {
     return(SelectQuery.ToString(sb, dic));
 }
예제 #11
0
 public SqlSelectStatement(SelectQuery selectQuery) : base(selectQuery)
 {
 }
예제 #12
0
 protected override void Walk(WalkOptions options, Func <ISqlExpression, ISqlExpression> func)
 {
     base.Walk(options, func);
     SubQuery = (SelectQuery)((ISqlExpression)SubQuery).Walk(options, func) !;
 }
예제 #13
0
 public InSubQuery(ISqlExpression exp1, bool isNot, SelectQuery subQuery)
     : base(exp1, isNot, SqlQuery.Precedence.Comparison)
 {
     SubQuery = subQuery;
 }
예제 #14
0
 internal SqlFromClause(SelectQuery selectQuery) : base(selectQuery)
 {
 }
예제 #15
0
 internal SqlWhereClause(SelectQuery selectQuery) : base(selectQuery)
 {
     SearchCondition = new SqlSearchCondition();
 }
예제 #16
0
 public static SqlFromClause.Join WeakJoin(this ISqlTableSource table, string alias, params SqlFromClause.Join[] joins)
 {
     return(SelectQuery.WeakJoin(table, alias, joins));
 }
예제 #17
0
 public static SqlFunction CreateAny(SelectQuery subQuery)
 {
     return(new SqlFunction(typeof(bool), "ANY", false, SqlQuery.Precedence.Comparison, subQuery));
 }
예제 #18
0
 public HierarchyInfo(SelectQuery masterQuery, HierarchyType hierarchyType, IQueryElement parentElement)
 {
     MasterQuery   = masterQuery;
     HierarchyType = hierarchyType;
     ParentElement = parentElement;
 }
예제 #19
0
        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);
//				}
        }
예제 #20
0
 /// <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));
 }
예제 #21
0
 internal SqlGroupByClause(SelectQuery selectQuery) : base(selectQuery)
 {
 }
예제 #22
0
 protected override void Walk(bool skipColumns, Func <ISqlExpression, ISqlExpression> func)
 {
     base.Walk(skipColumns, func);
     SubQuery = (SelectQuery)((ISqlExpression)SubQuery).Walk(skipColumns, func);
 }