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)
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)
GenerateExistsClause(IReadOnlyList<FieldInfo>, string, string)
Generates EXISTS with PVT subquery for WHERE condition.
public CompiledPvtQuery GenerateExistsClause(IReadOnlyList<FieldInfo> fields, string whereCondition, string tableAlias = "o")
GenerateLeadingCte(IReadOnlyList<FieldInfo>, FieldInfo, bool, string, string, string, string, int, int, string?, string?)
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)
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)
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)
GenerateProbedStreamsSource(IReadOnlyList<FieldInfo>, string, string?, IReadOnlyCollection<string>?, string, int)
with the probe of , for an
public string GenerateProbedStreamsSource(IReadOnlyList<FieldInfo> fields, string schemeIdParam, string? additionalObjectFilter, IReadOnlyCollection<string>? baseColumns, string probeCondition, int probeCap)
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)
GeneratePvtCte(IReadOnlyList<FieldInfo>, string, string, string?)
Generates CTE-based PVT (NOT correlated - single pass!).
public PvtSqlGenerator.PvtCteResult GeneratePvtCte(IReadOnlyList<FieldInfo> fields, string whereCondition, string schemeIdParam, string? additionalObjectFilter = null)
GeneratePvtSelect(IReadOnlyList<FieldInfo>, string)
Generates PVT subquery for SELECT (data retrieval).
public string GeneratePvtSelect(IReadOnlyList<FieldInfo> fields, string tableAlias = "o")
GenerateStreamsCte(IReadOnlyList<FieldInfo>, string, string, string?, string, string, bool, IReadOnlyCollection<string>?, bool, string?, string?, (long StructureId, string DbColumn)?)
Generates the streams form of the pivot CTE: the objects of the scheme drive, and every field
public PvtSqlGenerator.PvtCteResult GenerateStreamsCte(IReadOnlyList<FieldInfo> fields, string whereCondition, string schemeIdParam, string? additionalObjectFilter, string orderByClause, string paginationClause, bool overTree = false, IReadOnlyCollection<string>? baseColumns = null, bool fence = true, string? chainedName = null, string? drivingCondition = null, (long StructureId, string DbColumn)? drivingField = null)
GenerateStreamsSource(IReadOnlyList<FieldInfo>, string, string?, IReadOnlyCollection<string>?, bool, string?, (long StructureId, string DbColumn)?)
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, bool fence = true, string? drivingCondition = null, (long StructureId, string DbColumn)? drivingField = 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)