示例#1
0
        public SqlColumn(SelectQuery?parent, ISqlExpression expression, string?alias)
        {
            Parent      = parent;
            _expression = expression ?? throw new ArgumentNullException(nameof(expression));
            RawAlias    = alias;

#if DEBUG
            _columnNumber = ++_columnCounter;
#endif
        }
示例#2
0
 void CorrectQueryHierarchy(SelectQuery?parentQuery)
 {
     if (parentQuery == null)
     {
         return;
     }
     new QueryVisitor().Visit(parentQuery, element =>
     {
         if (element is SelectQuery q)
         {
             q.ParentSelect = parentQuery;
         }
     });
     parentQuery.ParentSelect = null;
 }
示例#3
0
        protected override void BuildColumnExpression(SelectQuery?selectQuery, ISqlExpression expr, string?alias, ref bool addAlias)
        {
            // ODBC provider doesn't support NULL parameter as top-level select column value
            if (expr is SqlParameter p &&
                p.IsQueryParameter &&
                selectQuery != null &&
                Statement.QueryType == QueryType.Select &&
                Statement.SelectQuery == selectQuery &&
                p.GetParameterValue(OptimizationContext.Context.ParameterValues).ProviderValue == null)
            {
                expr = new SqlValue(p.Type, null);
            }

            base.BuildColumnExpression(selectQuery, expr, alias, ref addAlias);
        }
示例#4
0
        internal void Init(
            SqlSelectClause select,
            SqlFromClause from,
            SqlWhereClause where,
            SqlGroupByClause groupBy,
            SqlWhereClause having,
            SqlOrderByClause orderBy,
            List <SqlSetOperator>?setOperators,
            List <ISqlExpression[]>?uniqueKeys,
            SelectQuery?parentSelect,
            bool parameterDependent,
            string?queryName,
            bool doNotSetAliases)
        {
            Select               = select;
            From                 = from;
            Where                = where;
            GroupBy              = groupBy;
            Having               = having;
            OrderBy              = orderBy;
            _setOperators        = setOperators;
            ParentSelect         = parentSelect;
            IsParameterDependent = parameterDependent;
            QueryName            = queryName;
            DoNotSetAliases      = doNotSetAliases;

            if (uniqueKeys != null)
            {
                UniqueKeys.AddRange(uniqueKeys);
            }

            foreach (var col in select.Columns)
            {
                col.Parent = this;
            }

            Select.SetSqlQuery(this);
            From.SetSqlQuery(this);
            Where.SetSqlQuery(this);
            GroupBy.SetSqlQuery(this);
            Having.SetSqlQuery(this);
            OrderBy.SetSqlQuery(this);
        }
示例#5
0
 public SqlDeleteStatement(SelectQuery?selectQuery) : base(selectQuery)
 {
 }
示例#6
0
 public SqlInfo(IEnumerable <MemberInfo> mi, ISqlExpression sql, SelectQuery?query = null, int index = -1) : this(mi.ToArray(), sql, query, index)
 {
 }
示例#7
0
 public SqlInfo(MemberInfo mi, ISqlExpression sql, SelectQuery?query = null, int index = -1) : this(new[] { mi }, sql, query, index)
 {
 }
示例#8
0
 public SqlInfo(ISqlExpression sql, SelectQuery?query = null, int index = -1) : this(Array <MemberInfo> .Empty, sql, query, index)
 {
 }
示例#9
0
 protected override void StartStatementQueryExtensions(SelectQuery?selectQuery)
 {
 }
示例#10
0
 protected ClauseBase(SelectQuery?selectQuery)
 {
     SelectQuery = selectQuery !;
 }
示例#11
0
 public Task <List <T> > GetAsync <T>(string?className = default, string?condition = default, EnumerationOptions?options = default, SelectQuery?query = default)
     where T : WMIBase, new()
 {
     (query, options) = WMIRepository.GetQueryParams <T>(className, condition, options, query);
     return(this.QueryAsync <T>(query, options));
 }
示例#12
0
 public async Task <T?> GetOneAsync <T>(string?className = default, string?condition = default, EnumerationOptions?options = default, SelectQuery?query = default)
     where T : WMIBase, new()
 {
     (query, options) = WMIRepository.GetQueryParams <T>(className, condition, options, query);
     return((await this.QueryAsync <T>(query, options)).SingleOrDefault());
 }