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