SelectStatement

Classes > Nimblesite.Sql.Model > SelectStatement

Represents a parsed SQL SELECT statement with extracted metadata that is generic for all SQL flavors

public sealed record SelectStatement : IEquatable<SelectStatement>

Properties

SelectList

public IReadOnlyList<ColumnInfo> SelectList { get; init; }

Gets the SELECT list columns

Tables

public FrozenSet<TableInfo> Tables { get; init; }

Gets the tables in the FROM clause

Parameters

public FrozenSet<ParameterInfo> Parameters { get; init; }

Gets the query parameters

JoinGraph

public JoinGraph JoinGraph { get; init; }

Gets the join graph

WhereConditions

public IReadOnlyList<WhereCondition> WhereConditions { get; init; }

Gets the WHERE conditions

GroupByColumns

public FrozenSet<ColumnInfo> GroupByColumns { get; init; }

Gets the GROUP BY columns

OrderByItems

public IReadOnlyList<OrderByItem> OrderByItems { get; init; }

Gets the ORDER BY items

HavingCondition

public string? HavingCondition { get; init; }

Gets the HAVING condition TODO: this is wrong. This should be a collection, not a string

Limit

public string? Limit { get; init; }

Gets the LIMIT value

Offset

public string? Offset { get; init; }

Gets the OFFSET value

IsDistinct

public bool IsDistinct { get; init; }

Gets whether the query uses DISTINCT

Unions

public FrozenSet<UnionOperation> Unions { get; init; }

Gets the UNION operations

HasJoins

public bool HasJoins { get; }

Gets a value indicating whether the query has joins

Methods

From<T>(string?, string?)

public static SelectQueryable<T> From<T>(string? tableName = null, string? alias = null)

Creates a new SelectQueryable from a table name

Parameters:

Name Type Description
tableName String
alias String

Returns: SelectQueryable<<T>>

From(string, string?)

public static SelectQueryable<dynamic> From(string tableName, string? alias = null)

Creates a new dynamic SelectQueryable from a table name

Parameters:

Name Type Description
tableName String
alias String

Returns: Object>