Exemplo n.º 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
        }
Exemplo n.º 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;
 }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 5
0
 public SqlDeleteStatement(SelectQuery?selectQuery) : base(selectQuery)
 {
 }
Exemplo n.º 6
0
 public SqlInfo(IEnumerable <MemberInfo> mi, ISqlExpression sql, SelectQuery?query = null, int index = -1) : this(mi.ToArray(), sql, query, index)
 {
 }
Exemplo n.º 7
0
 public SqlInfo(MemberInfo mi, ISqlExpression sql, SelectQuery?query = null, int index = -1) : this(new[] { mi }, sql, query, index)
 {
 }
Exemplo n.º 8
0
 public SqlInfo(ISqlExpression sql, SelectQuery?query = null, int index = -1) : this(Array <MemberInfo> .Empty, sql, query, index)
 {
 }
Exemplo n.º 9
0
 protected override void StartStatementQueryExtensions(SelectQuery?selectQuery)
 {
 }
Exemplo n.º 10
0
 protected ClauseBase(SelectQuery?selectQuery)
 {
     SelectQuery = selectQuery !;
 }
Exemplo n.º 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));
 }
Exemplo n.º 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());
 }