Table of Contents

Class SelectQuery

Namespace
LinqToDB.Internal.SqlQuery
Assembly
linq2db.dll
public sealed class SelectQuery : SqlExpressionBase, ISqlTableSource, ISqlExpression, IQueryElement, IEquatable<ISqlExpression>
Inheritance
SelectQuery
Implements
Inherited Members
Extension Methods

Constructors

SelectQuery()

public SelectQuery()

Fields

SourceIDCounter

public static int SourceIDCounter

Field Value

int

Properties

All

public SqlField All { get; }

Property Value

SqlField

DoNotRemove

Gets or sets flag when sub-query can be removed during optimization.

public bool DoNotRemove { get; set; }

Property Value

bool

DoNotSetAliases

public bool DoNotSetAliases { get; set; }

Property Value

bool

ElementType

AST node type.

public override QueryElementType ElementType { get; }

Property Value

QueryElementType

From

public SqlFromClause From { get; }

Property Value

SqlFromClause

GroupBy

public SqlGroupByClause GroupBy { get; }

Property Value

SqlGroupByClause

HasSetOperators

public bool HasSetOperators { get; }

Property Value

bool

HasUniqueKeys

public bool HasUniqueKeys { get; }

Property Value

bool

Having

public SqlHavingClause Having { get; }

Property Value

SqlHavingClause

IsLimited

public bool IsLimited { get; }

Property Value

bool

IsParameterDependent

public bool IsParameterDependent { get; set; }

Property Value

bool

IsSimple

public bool IsSimple { get; }

Property Value

bool

IsSimpleButWhere

public bool IsSimpleButWhere { get; }

Property Value

bool

IsSimpleOrSet

public bool IsSimpleOrSet { get; }

Property Value

bool

OrderBy

public SqlOrderByClause OrderBy { get; }

Property Value

SqlOrderByClause

Precedence

public override int Precedence { get; }

Property Value

int

Properties

public List<object> Properties { get; }

Property Value

List<object>

QueryName

public string? QueryName { get; set; }

Property Value

string

Select

public SqlSelectClause Select { get; }

Property Value

SqlSelectClause

SetOperators

public List<SqlSetOperator> SetOperators { get; }

Property Value

List<SqlSetOperator>

SourceID

public int SourceID { get; }

Property Value

int

SqlQueryExtensions

public List<SqlQueryExtension>? SqlQueryExtensions { get; set; }

Property Value

List<SqlQueryExtension>

SqlTableType

public SqlTableType SqlTableType { get; }

Property Value

SqlTableType

SqlText

public string SqlText { get; }

Property Value

string

SystemType

public override Type? SystemType { get; }

Property Value

Type

UniqueKeys

Contains list of columns that build unique key for this sub-query. Used in JoinOptimizer for safely removing sub-query from resulting SQL.

public List<ISqlExpression[]> UniqueKeys { get; }

Property Value

List<ISqlExpression[]>

Where

public SqlWhereClause Where { get; }

Property Value

SqlWhereClause

Methods

AddUnion(SelectQuery, bool)

public void AddUnion(SelectQuery union, bool isAll)

Parameters

union SelectQuery
isAll bool

CanBeNullable(NullabilityContext)

public override bool CanBeNullable(NullabilityContext nullability)

Parameters

nullability NullabilityContext

Returns

bool

Cleanup()

public void Cleanup()

CloneQuery()

public SelectQuery CloneQuery()

Returns

SelectQuery

Equals(ISqlExpression, Func<ISqlExpression, ISqlExpression, bool>)

public override bool Equals(ISqlExpression other, Func<ISqlExpression, ISqlExpression, bool> comparer)

Parameters

other ISqlExpression
comparer Func<ISqlExpression, ISqlExpression, bool>

Returns

bool

ForEachTable<TContext>(TContext, Action<TContext, SqlTableSource>, HashSet<SelectQuery>)

public void ForEachTable<TContext>(TContext context, Action<TContext, SqlTableSource> action, HashSet<SelectQuery> visitedQueries)

Parameters

context TContext
action Action<TContext, SqlTableSource>
visitedQueries HashSet<SelectQuery>

Type Parameters

TContext

GetElementHashCode()

public override int GetElementHashCode()

Returns

int

GetKeys(bool)

public IList<ISqlExpression>? GetKeys(bool allIfEmpty)

Parameters

allIfEmpty bool

Returns

IList<ISqlExpression>

GetTableSource(ISqlTableSource)

public ISqlTableSource? GetTableSource(ISqlTableSource table)

Parameters

table ISqlTableSource

Returns

ISqlTableSource

ToString(QueryElementTextWriter)

Generates debug text representation of AST node.

public override QueryElementTextWriter ToString(QueryElementTextWriter writer)

Parameters

writer QueryElementTextWriter

Returns

QueryElementTextWriter