Table of Contents

Class SelectQuery

Namespace
LinqToDB.SqlQuery
Assembly
linq2db.dll
public class SelectQuery : ISqlTableSource, ISqlExpression, IQueryElement, IEquatable<ISqlExpression>, ISqlExpressionWalkable
Inheritance
SelectQuery
Implements
Extension Methods

Constructors

SelectQuery()

public SelectQuery()

Fields

SourceIDCounter

public static int SourceIDCounter

Field Value

int

Properties

All

public SqlField All { get; }

Property Value

SqlField

CanBeNull

public bool CanBeNull { get; }

Property Value

bool

DebugSqlText

protected string DebugSqlText { get; }

Property Value

string

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

public 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 SqlWhereClause Having { get; }

Property Value

SqlWhereClause

IsParameterDependent

public bool IsParameterDependent { get; set; }

Property Value

bool

IsSimple

public bool IsSimple { get; }

Property Value

bool

IsSimpleOrSet

public bool IsSimpleOrSet { get; }

Property Value

bool

OrderBy

public SqlOrderByClause OrderBy { get; }

Property Value

SqlOrderByClause

ParentSelect

public SelectQuery? ParentSelect { get; set; }

Property Value

SelectQuery

Precedence

public 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 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

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

public 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

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(StringBuilder, Dictionary<IQueryElement, IQueryElement>)

public StringBuilder ToString(StringBuilder sb, Dictionary<IQueryElement, IQueryElement> dic)

Parameters

sb StringBuilder
dic Dictionary<IQueryElement, IQueryElement>

Returns

StringBuilder

Walk<TContext>(WalkOptions, TContext, Func<TContext, ISqlExpression, ISqlExpression>)

public ISqlExpression Walk<TContext>(WalkOptions options, TContext context, Func<TContext, ISqlExpression, ISqlExpression> func)

Parameters

options WalkOptions
context TContext
func Func<TContext, ISqlExpression, ISqlExpression>

Returns

ISqlExpression

Type Parameters

TContext