Class PvtSqlGenerator
Builds the Props part of a query in both forms, as parameterized SQL. The streams form (planner
on, every field with one row per object): the objects of the scheme drive, each field is a
LEFT JOIN of its own to its rows of _values, no GROUP BY. The aggregate pivot (planner off,
or a field with several rows per object, such as an array element form): one row per object folded
with FILTER per field. A field of a nested class has one row per object and reads as a stream.
public class PvtSqlGenerator
Inheritance
Methods
GenerateDrivenStreamsSelect(IReadOnlyList<FieldInfo>, string, string, string, IReadOnlyList<string>?)
The bare SELECT of the streams source driven by the rows of an open CTE that exposes the object id as
public string GenerateDrivenStreamsSelect(IReadOnlyList<FieldInfo> fields, string schemeIdParam, string drivingCte, string indent, IReadOnlyList<string>? driverColumns = null)
GenerateLeadingCte(IReadOnlyList<FieldInfo>, FieldInfo, bool, string, string, string, string, int, int, string?, string?, IReadOnlyCollection<string>?, bool)
The leading form of a page sorted by one Props field: the index of values of that field is
public PvtSqlGenerator.PvtCteResult GenerateLeadingCte(IReadOnlyList<FieldInfo> fields, FieldInfo sortField, bool descending, string whereCondition, string schemeIdParam, string streamsOrderBy, string paginationClause, int limit, int walkCap, string? walkCondition = null, string? thenByClause = null, IReadOnlyCollection<string>? baseColumns = null, bool wideBySubqueries = false)
GenerateNestedDictCte(IReadOnlyList<FieldInfo>, string)
Generates CTE for nested Dictionary fields like AddressBook[home].City.
public string GenerateNestedDictCte(IReadOnlyList<FieldInfo> nestedFields, string tableAlias = "o")
GenerateProbedStreamsCte(IReadOnlyList<FieldInfo>, string, string, string?, string, string, IReadOnlyCollection<string>?, string, int, bool)
The streams form with a probe for a condition that is wide by its shape (an open range) but may
public PvtSqlGenerator.PvtCteResult GenerateProbedStreamsCte(IReadOnlyList<FieldInfo> fields, string whereCondition, string schemeIdParam, string? additionalObjectFilter, string orderByClause, string paginationClause, IReadOnlyCollection<string>? baseColumns, string probeCondition, int probeCap, bool probeElements = false)
GenerateProbedStreamsSource(IReadOnlyList<FieldInfo>, string, string?, IReadOnlyCollection<string>?, string, int, bool)
public string GenerateProbedStreamsSource(IReadOnlyList<FieldInfo> fields, string schemeIdParam, string? additionalObjectFilter, IReadOnlyCollection<string>? baseColumns, string probeCondition, int probeCap, bool probeElements = false)
GeneratePvtCte(IReadOnlyList<FieldInfo>, string, string, string?, bool, string?, bool)
Generates CTE-based PVT (NOT correlated - single pass!).
public PvtSqlGenerator.PvtCteResult GeneratePvtCte(IReadOnlyList<FieldInfo> fields, string whereCondition, string schemeIdParam, string? additionalObjectFilter = null, bool hasNullCheck = false, string? rowPrefilter = null, bool schemeCheckRequired = false)
GenerateStreamsCte(IReadOnlyList<FieldInfo>, string, string, string?, string, string, bool, IReadOnlyCollection<string>?, IReadOnlyCollection<long>?, FieldInfo?)
The streams form of the pivot CTE: the objects of the scheme drive, every field is its own
public PvtSqlGenerator.PvtCteResult GenerateStreamsCte(IReadOnlyList<FieldInfo> fields, string whereCondition, string schemeIdParam, string? additionalObjectFilter, string orderByClause, string paginationClause, bool overTree = false, IReadOnlyCollection<string>? baseColumns = null, IReadOnlyCollection<long>? absentFields = null, FieldInfo? idFromField = null)
GenerateStreamsSource(IReadOnlyList<FieldInfo>, string, string?, IReadOnlyCollection<string>?)
The streams source on its own, as a derived table aliased pvt: one row per object of
public string GenerateStreamsSource(IReadOnlyList<FieldInfo> fields, string schemeIdParam, string? additionalObjectFilter, IReadOnlyCollection<string>? baseColumns = null)
GenerateTreeStreamsSelect(IReadOnlyList<FieldInfo>, string, string?, IReadOnlyCollection<string>?, string)
The bare SELECT of the streams source over an open tree CTE, for a caller that writes
public string GenerateTreeStreamsSelect(IReadOnlyList<FieldInfo> fields, string schemeIdParam, string? additionalObjectFilter, IReadOnlyCollection<string>? baseColumns, string indent)
GetNestedDictFields(IReadOnlyList<FieldInfo>)
Gets nested Dictionary fields that require CTE.
public IReadOnlyList<FieldInfo> GetNestedDictFields(IReadOnlyList<FieldInfo> fields)
GetSimpleFields(IReadOnlyList<FieldInfo>)
Gets simple fields (including simple Dictionary fields) for PVT.
public IReadOnlyList<FieldInfo> GetSimpleFields(IReadOnlyList<FieldInfo> fields)