Class ProQueryProvider
ProQueryProvider: PVT-based Batch Aggregation.
SECURITY: Parameterized SQL queries.
NO FALLBACK to SQL functions.
DRY: One method generates SQL for Execute and Preview.
public class ProQueryProvider : SqliteQueryProvider, IRedbQueryProvider
Inheritance
Implements
Inherited Members
Properties
SortsByPropsLikeLinq
The Pro ordering keeps objects without a value and places them as LINQ does (QueryProviderBase).
protected override bool SortsByPropsLikeLinq { get; }
Methods
CheckProOnlyDistinctFeatures<TProps>(QueryContext<TProps>)
Pro version supports all Distinct features.
protected override void CheckProOnlyDistinctFeatures<TProps>(QueryContext<TProps> context) where TProps : class, new()
CreateFilterParser()
Pro: Uses ProFilterExpressionParser with arithmetic and function support.
protected override ProFilterExpressionParser CreateFilterParser()
ExecuteAggregateAsync(long, string, AggregateFunction, FilterExpression?, CancellationToken)
Pro: Single field aggregation with FilterExpression (preferred).
public override Task<decimal?> ExecuteAggregateAsync(long schemeId, string fieldPath, AggregateFunction function, FilterExpression? filter, CancellationToken cancellationToken = default)
ExecuteAggregateAsync(long, string, AggregateFunction, string?, CancellationToken)
Pro: Single field aggregation with filterJson (legacy).
public override Task<decimal?> ExecuteAggregateAsync(long schemeId, string fieldPath, AggregateFunction function, string? filterJson = null, CancellationToken cancellationToken = default)
ExecuteAggregateBatchAsync(long, IEnumerable<AggregateRequest>, FilterExpression?, CancellationToken)
Pro Override: Batch aggregation with FilterExpression (preferred).
public override Task<AggregateResult> ExecuteAggregateBatchAsync(long schemeId, IEnumerable<AggregateRequest> requests, FilterExpression? filter, CancellationToken cancellationToken = default)
ExecuteAggregateBatchAsync(long, IEnumerable<AggregateRequest>, string?, CancellationToken)
Pro Override: Batch aggregation with filterJson (legacy).
public override Task<AggregateResult> ExecuteAggregateBatchAsync(long schemeId, IEnumerable<AggregateRequest> requests, string? filterJson = null, CancellationToken cancellationToken = default)
ExecuteAnyAsync<TProps>(QueryContext<TProps>, CancellationToken)
Pro Override: existence without counting. Where the streams form applies, the scan stops at
protected override Task<bool> ExecuteAnyAsync<TProps>(QueryContext<TProps> context, CancellationToken cancellationToken = default) where TProps : class, new()
ExecuteArrayGroupQueryAsync(ArrayGroupQuery, CancellationToken)
GroupByArray on the free SQLite provider: pvt_build_array_groupby_sql of the extension builds the
public override Task<JsonDocument> ExecuteArrayGroupQueryAsync(ArrayGroupQuery query, CancellationToken cancellationToken = default)
ExecuteCountAsync<TProps>(QueryContext<TProps>, CancellationToken)
Pro Override: COUNT via CTE + JOIN (uses BuildQuerySqlAsync).
protected override Task<int> ExecuteCountAsync<TProps>(QueryContext<TProps> context, CancellationToken cancellationToken = default) where TProps : class, new()
ExecuteDeleteAsync(long, FilterExpression?, CancellationToken)
Pro Override: Delete objects by FilterExpression using PVT for efficient filtering.
public override Task<int> ExecuteDeleteAsync(long schemeId, FilterExpression? filter, CancellationToken cancellationToken = default)
ExecuteGroupedAggregateAsync(long, IEnumerable<GroupFieldRequest>, IEnumerable<AggregateRequest>, FilterExpression?, string?, CancellationToken)
Pro Override: GroupBy via PVT with FilterExpression (preferred).
public override Task<JsonDocument?> ExecuteGroupedAggregateAsync(long schemeId, IEnumerable<GroupFieldRequest> groupFields, IEnumerable<AggregateRequest> aggregations, FilterExpression? filter, string? havingJson = null, CancellationToken cancellationToken = default)
ExecuteGroupedAggregateAsync(long, IEnumerable<GroupFieldRequest>, IEnumerable<AggregateRequest>, string?, string?, CancellationToken)
Pro Override: GroupBy via PVT with filterJson (legacy compatibility).
public override Task<JsonDocument?> ExecuteGroupedAggregateAsync(long schemeId, IEnumerable<GroupFieldRequest> groupFields, IEnumerable<AggregateRequest> aggregations, string? filterJson = null, string? havingJson = null, CancellationToken cancellationToken = default)
ExecuteGroupedWindowQueryAsync(long, IEnumerable<GroupFieldRequest>, IEnumerable<AggregateRequest>, IEnumerable<WindowFuncRequest>, IEnumerable<WindowFieldRequest>, IEnumerable<WindowOrderRequest>, FilterExpression?, string?, CancellationToken)
Execute GroupBy + Window query with FilterExpression (preferred).
public override Task<JsonDocument?> ExecuteGroupedWindowQueryAsync(long schemeId, IEnumerable<GroupFieldRequest> groupFields, IEnumerable<AggregateRequest> aggregations, IEnumerable<WindowFuncRequest> windowFuncs, IEnumerable<WindowFieldRequest> partitionBy, IEnumerable<WindowOrderRequest> orderBy, FilterExpression? filter, string? havingJson = null, CancellationToken cancellationToken = default)
ExecuteGroupedWindowQueryAsync(long, IEnumerable<GroupFieldRequest>, IEnumerable<AggregateRequest>, IEnumerable<WindowFuncRequest>, IEnumerable<WindowFieldRequest>, IEnumerable<WindowOrderRequest>, string?, string?, CancellationToken)
Execute GroupBy + Window query with filterJson (legacy).
public override Task<JsonDocument?> ExecuteGroupedWindowQueryAsync(long schemeId, IEnumerable<GroupFieldRequest> groupFields, IEnumerable<AggregateRequest> aggregations, IEnumerable<WindowFuncRequest> windowFuncs, IEnumerable<WindowFieldRequest> partitionBy, IEnumerable<WindowOrderRequest> orderBy, string? filterJson = null, string? havingJson = null, CancellationToken cancellationToken = default)
ExecuteToListAsync<TProps>(QueryContext<TProps>, Type, CancellationToken)
PVT-based search (uses BuildQuerySqlAsync)
protected override Task<object> ExecuteToListAsync<TProps>(QueryContext<TProps> context, Type propsType, CancellationToken cancellationToken = default) where TProps : class, new()
ExecuteWindowQueryAsync(long, IEnumerable<WindowFieldRequest>, IEnumerable<WindowFuncRequest>, IEnumerable<WindowFieldRequest>, IEnumerable<WindowOrderRequest>, FilterExpression?, string?, int?, int?, CancellationToken)
Pro: Window Functions with FilterExpression (preferred).
public override Task<JsonDocument?> ExecuteWindowQueryAsync(long schemeId, IEnumerable<WindowFieldRequest> selectFields, IEnumerable<WindowFuncRequest> windowFuncs, IEnumerable<WindowFieldRequest> partitionBy, IEnumerable<WindowOrderRequest> orderBy, FilterExpression? filter, string? frameJson = null, int? take = null, int? skip = null, CancellationToken cancellationToken = default)
ExecuteWindowQueryAsync(long, IEnumerable<WindowFieldRequest>, IEnumerable<WindowFuncRequest>, IEnumerable<WindowFieldRequest>, IEnumerable<WindowOrderRequest>, string?, string?, int?, int?, CancellationToken)
Pro: Window Functions with filterJson (legacy).
public override Task<JsonDocument?> ExecuteWindowQueryAsync(long schemeId, IEnumerable<WindowFieldRequest> selectFields, IEnumerable<WindowFuncRequest> windowFuncs, IEnumerable<WindowFieldRequest> partitionBy, IEnumerable<WindowOrderRequest> orderBy, string? filterJson = null, string? frameJson = null, int? take = null, int? skip = null, CancellationToken cancellationToken = default)
GetAggregateSqlPreviewAsync<TProps, TResult>(QueryContext<TProps>, Expression<Func<RedbObject<TProps>, TResult>>, CancellationToken)
Pro Override: SQL Preview for aggregation
public override Task<string> GetAggregateSqlPreviewAsync<TProps, TResult>(QueryContext<TProps> context, Expression<Func<RedbObject<TProps>, TResult>> selector, CancellationToken cancellationToken = default) where TProps : class, new()
GetArrayGroupQuerySqlAsync(ArrayGroupQuery, CancellationToken)
SQL of ; see there.
public override Task<string> GetArrayGroupQuerySqlAsync(ArrayGroupQuery query, CancellationToken cancellationToken = default)
GetGroupBySqlPreviewAsync(long, IEnumerable<GroupFieldRequest>, IEnumerable<AggregateRequest>, FilterExpression?, string?, CancellationToken)
Pro: SQL Preview for GroupBy with FilterExpression (preferred).
public override Task<string> GetGroupBySqlPreviewAsync(long schemeId, IEnumerable<GroupFieldRequest> groupFields, IEnumerable<AggregateRequest> aggregations, FilterExpression? filter, string? havingJson = null, CancellationToken cancellationToken = default)
GetGroupBySqlPreviewAsync(long, IEnumerable<GroupFieldRequest>, IEnumerable<AggregateRequest>, string?, string?, CancellationToken)
Pro: SQL Preview for GroupBy with filterJson (legacy compatibility).
public override Task<string> GetGroupBySqlPreviewAsync(long schemeId, IEnumerable<GroupFieldRequest> groupFields, IEnumerable<AggregateRequest> aggregations, string? filterJson = null, string? havingJson = null, CancellationToken cancellationToken = default)
GetGroupedWindowSqlPreviewAsync(long, IEnumerable<GroupFieldRequest>, IEnumerable<AggregateRequest>, IEnumerable<WindowFuncRequest>, IEnumerable<WindowFieldRequest>, IEnumerable<WindowOrderRequest>, FilterExpression?, string?, CancellationToken)
SQL preview for GroupBy + Window with FilterExpression (preferred).
public override Task<string> GetGroupedWindowSqlPreviewAsync(long schemeId, IEnumerable<GroupFieldRequest> groupFields, IEnumerable<AggregateRequest> aggregations, IEnumerable<WindowFuncRequest> windowFuncs, IEnumerable<WindowFieldRequest> partitionBy, IEnumerable<WindowOrderRequest> orderBy, FilterExpression? filter, string? havingJson = null, CancellationToken cancellationToken = default)
GetGroupedWindowSqlPreviewAsync(long, IEnumerable<GroupFieldRequest>, IEnumerable<AggregateRequest>, IEnumerable<WindowFuncRequest>, IEnumerable<WindowFieldRequest>, IEnumerable<WindowOrderRequest>, string?, string?, CancellationToken)
SQL preview for GroupBy + Window (filterJson - legacy).
public override Task<string> GetGroupedWindowSqlPreviewAsync(long schemeId, IEnumerable<GroupFieldRequest> groupFields, IEnumerable<AggregateRequest> aggregations, IEnumerable<WindowFuncRequest> windowFuncs, IEnumerable<WindowFieldRequest> partitionBy, IEnumerable<WindowOrderRequest> orderBy, string? filterJson = null, string? havingJson = null, CancellationToken cancellationToken = default)
GetSingleAggregateSqlPreviewAsync(long, string, AggregateFunction, FilterExpression?, CancellationToken)
Pro: SQL Preview for Single Aggregation
public Task<string> GetSingleAggregateSqlPreviewAsync(long schemeId, string fieldPath, AggregateFunction function, FilterExpression? filter = null, CancellationToken cancellationToken = default)
GetSqlPreviewAsync<TProps>(QueryContext<TProps>, CancellationToken)
SQL Preview (uses BuildQuerySqlAsync).
public override Task<string> GetSqlPreviewAsync<TProps>(QueryContext<TProps> context, CancellationToken cancellationToken = default) where TProps : class, new()
GetWindowSqlPreviewAsync(long, IEnumerable<WindowFieldRequest>, IEnumerable<WindowFuncRequest>, IEnumerable<WindowFieldRequest>, IEnumerable<WindowOrderRequest>, FilterExpression?, string?, int?, int?, CancellationToken)
Pro: SQL Preview for Window Functions with FilterExpression: the SQL ExecuteWindowQueryAsync runs.
public override Task<string> GetWindowSqlPreviewAsync(long schemeId, IEnumerable<WindowFieldRequest> selectFields, IEnumerable<WindowFuncRequest> windowFuncs, IEnumerable<WindowFieldRequest> partitionBy, IEnumerable<WindowOrderRequest> orderBy, FilterExpression? filter, string? frameJson = null, int? take = null, int? skip = null, CancellationToken cancellationToken = default)
GetWindowSqlPreviewAsync(long, IEnumerable<WindowFieldRequest>, IEnumerable<WindowFuncRequest>, IEnumerable<WindowFieldRequest>, IEnumerable<WindowOrderRequest>, string?, string?, int?, int?, CancellationToken)
Pro: SQL Preview for Window Functions (legacy filterJson: the Pro path has no filter JSON).
public override Task<string> GetWindowSqlPreviewAsync(long schemeId, IEnumerable<WindowFieldRequest> selectFields, IEnumerable<WindowFuncRequest> windowFuncs, IEnumerable<WindowFieldRequest> partitionBy, IEnumerable<WindowOrderRequest> orderBy, string? filterJson = null, string? frameJson = null, int? take = null, int? skip = null, CancellationToken cancellationToken = default)
TryAllWithoutFilterAsync<TProps>(QueryContext<TProps>, FilterExpression, CancellationToken)
AllAsync over every object of the scheme when the predicate is one condition on a plain scalar field (a comparison, an
protected override Task<bool?> TryAllWithoutFilterAsync<TProps>(QueryContext<TProps> context, FilterExpression predicate, CancellationToken cancellationToken) where TProps : class, new()