public SqlColumn(SelectQuery?parent, ISqlExpression expression, string?alias) { Parent = parent; _expression = expression ?? throw new ArgumentNullException(nameof(expression)); RawAlias = alias; #if DEBUG _columnNumber = ++_columnCounter; #endif }
void CorrectQueryHierarchy(SelectQuery?parentQuery) { if (parentQuery == null) { return; } new QueryVisitor().Visit(parentQuery, element => { if (element is SelectQuery q) { q.ParentSelect = parentQuery; } }); parentQuery.ParentSelect = null; }
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); }
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); }
public SqlDeleteStatement(SelectQuery?selectQuery) : base(selectQuery) { }
public SqlInfo(IEnumerable <MemberInfo> mi, ISqlExpression sql, SelectQuery?query = null, int index = -1) : this(mi.ToArray(), sql, query, index) { }
public SqlInfo(MemberInfo mi, ISqlExpression sql, SelectQuery?query = null, int index = -1) : this(new[] { mi }, sql, query, index) { }
public SqlInfo(ISqlExpression sql, SelectQuery?query = null, int index = -1) : this(Array <MemberInfo> .Empty, sql, query, index) { }
protected override void StartStatementQueryExtensions(SelectQuery?selectQuery) { }
protected ClauseBase(SelectQuery?selectQuery) { SelectQuery = selectQuery !; }
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)); }
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()); }