C# 클래스 Serenity.Data.SqlQuery

상속: QueryWithParams, IFilterableQuery, IGetExpressionByName
파일 보기 프로젝트 열기: volkanceylan/Serenity 1 사용 예제들

Private Properties

프로퍼티 타입 설명
AppendFromWhereOrderByGroupByHaving void
EnsureJoin void
IFilterableQuery void
IGetExpressionByName string
ISqlQueryExtensible int
ISqlQueryExtensible void
JoinToString void

공개 메소드들

메소드 설명
Clone ( ) : SqlQuery

Creates a clone of the query.

Clones states like TrackAssignments, AssignedFields etc, creates a copy of Params dictionary

Dialect ( ) : ISqlDialect

Gets the dialect (SQL server type / version) for query.

Dialect ( ISqlDialect dialect ) : SqlQuery

Sets the dialect (SQL server type / version) for query.

TODO: SqlDialect system should be improved.

Distinct ( bool distinct ) : SqlQuery

Sets DISTINCT flag.

EnsureJoin ( Serenity.Data.Join join ) : SqlQuery
EnsureJoinsInExpression ( string expression ) : SqlQuery
ForXml ( string forXml ) : SqlQuery
From ( IAlias alias ) : SqlQuery

Adds a table to the FROM statement, with given short name.

This overload requires that alias has a table name.

From ( ISqlQuery subQuery, IAlias alias ) : SqlQuery

Adds a subquery to the FROM statement, with given short name.

This overload requires that alias has a table name.

From ( string table ) : SqlQuery

Adds a table to the FROM statement. When it is called more than once, puts a comma between table names (cross join)

From ( string table, IAlias alias ) : SqlQuery

Adds a table to the FROM statement with an alias. When it is called more than once, puts a comma between table names (cross join)

GroupBy ( IAlias alias, string fieldName ) : SqlQuery

Adds a field of a given table alias to the GROUP BY clause.

GroupBy ( string expression ) : SqlQuery

Adds a field name or an SQL expression to the GROUP BY clause.

Having ( string expression ) : SqlQuery

Adds an SQL expression to the GROUP BY clause.

InnerJoin ( IAlias alias, ICriteria onCriteria ) : SqlQuery
Join ( Serenity.Data.Join join ) : SqlQuery
LeftJoin ( IAlias alias, ICriteria onCriteria ) : SqlQuery
LeftJoin ( string toTable, IAlias alias, ICriteria onCriteria ) : SqlQuery
OrderBy ( IAlias alias, string fieldName, bool desc = false ) : SqlQuery

Adds a field of a given table alias to the ORDER BY clause.

OrderBy ( string expression, bool desc = false ) : SqlQuery

Adds a field name or an SQL expression to the ORDER BY clause.

OrderByFirst ( string expression, bool desc = false ) : SqlQuery

Inserts a field name or an SQL expression to the start of ORDER BY clause.

This method is designed to help apply user defined orders (for example by clicking headers on a grid) to a query with existing order. SQL server throws an error if a field is used more than once in ORDER BY expression, so this function first removes normal and DESC versions of the expression from the ORDER BY statement.

RightJoin ( IAlias alias, ICriteria onCriteria ) : SqlQuery
RightJoin ( string toTable, IAlias alias, ICriteria onCriteria ) : SqlQuery
Select ( IAlias alias, string fieldName ) : SqlQuery

Adds a field of a given table alias to the SELECT statement.

No column name is used for the field or expression.

Select ( IAlias alias, string fieldName, string columnName ) : SqlQuery

Adds a field of a given table alias to the SELECT statement with a column name.

Select ( ISqlQuery expression ) : SqlQuery

Adds a subquery to the SELECT statement.

Select ( ISqlQuery expression, string columnName ) : SqlQuery

Adds a subquery to the SELECT statement.

Select ( string expression ) : SqlQuery

Adds a field name or an SQL expression to the SELECT statement.

No column name is used for the field or expression.

Select ( string expression, string columnName ) : SqlQuery

Adds a field name or expression to the SELECT statement with a column name

SelectMany ( ) : SqlQuery

Adds field names or SQL expressions to the SELECT statement.

No aliases are used for the fields or expressions.

Skip ( int skipRows ) : SqlQuery

Sets SKIP value. Used for paging.

Skip ( ) : int

Gets current SKIP value.

SqlQuery ( ) : System

Creates a new SqlQuery instance.

SubQuery ( ) : SqlQuery

Creates a new query that shares parameter dictionary with this query.

Take ( int rowCount ) : SqlQuery

Sets TAKE/TOP value. Used for paging.

Take ( ) : int

Gets TAKE/TOP value.

ToString ( ) : string

SqlSelect sorgusunu formatlayıp bir SELECT sorgusuna çevirir. Sayfalama sözkonusuysa (atlanan kayıt varsa) birden fazla sorgu arka arkaya oluşturulur.

Where ( ) : SqlQuery

Adds expressions to WHERE clause, inserting AND between them.

Where ( string expression ) : SqlQuery

Adds an expression to WHERE clause. If query already has a WHERE clause, inserts AND between existing one and new one.

비공개 메소드들

메소드 설명
AppendFromWhereOrderByGroupByHaving ( StringBuilder sb, string extraWhere, bool includeOrderBy ) : void

Verilen StringBuilder nesnesine SqlSelect'in FROM, WHERE, ORDER BY, GROUP BY, HAVING kısımlarını, belirtilirse bir ek filtre de gözönüne alınarak ekler.

Sayfalama için üretilen sorgularda SqlSelect'in bu kısımları iki ayrı yerde (birinde ek bir koşulla birlikte) kullanıldığından, bu şekilde yapılarak, kod tekrarının önüne geçilmiştir.

EnsureJoin ( string joinAlias ) : void
IFilterableQuery ( string expression ) : void

Implements IDBFilterable.Where, by calling original Where method.

IGetExpressionByName ( string columnName ) : string

Gets the source expression for a column name in the query.

This function uses a linear search in column list, so use with caution.

ISqlQueryExtensible ( IField field ) : int
ISqlQueryExtensible ( object row ) : void
JoinToString ( Serenity.Data.Join join, StringBuilder sb, bool modifySelf ) : void

메소드 상세

Clone() 공개 메소드

Creates a clone of the query.
Clones states like TrackAssignments, AssignedFields etc, creates a copy of Params dictionary
public Clone ( ) : SqlQuery
리턴 SqlQuery

Dialect() 공개 메소드

Gets the dialect (SQL server type / version) for query.
public Dialect ( ) : ISqlDialect
리턴 ISqlDialect

Dialect() 공개 메소드

Sets the dialect (SQL server type / version) for query.
TODO: SqlDialect system should be improved.
public Dialect ( ISqlDialect dialect ) : SqlQuery
dialect ISqlDialect
리턴 SqlQuery

Distinct() 공개 메소드

Sets DISTINCT flag.
public Distinct ( bool distinct ) : SqlQuery
distinct bool Distinct flag.
리턴 SqlQuery

EnsureJoin() 공개 메소드

public EnsureJoin ( Serenity.Data.Join join ) : SqlQuery
join Serenity.Data.Join
리턴 SqlQuery

EnsureJoinsInExpression() 공개 메소드

public EnsureJoinsInExpression ( string expression ) : SqlQuery
expression string
리턴 SqlQuery

ForXml() 공개 메소드

public ForXml ( string forXml ) : SqlQuery
forXml string
리턴 SqlQuery

From() 공개 메소드

Adds a table to the FROM statement, with given short name.
This overload requires that alias has a table name.
public From ( IAlias alias ) : SqlQuery
alias IAlias Alias that contains table name and short name.
리턴 SqlQuery

From() 공개 메소드

Adds a subquery to the FROM statement, with given short name.
This overload requires that alias has a table name.
public From ( ISqlQuery subQuery, IAlias alias ) : SqlQuery
subQuery ISqlQuery A subquery
alias IAlias Alias that contains the short name.
리턴 SqlQuery

From() 공개 메소드

Adds a table to the FROM statement. When it is called more than once, puts a comma between table names (cross join)
public From ( string table ) : SqlQuery
table string Table name
리턴 SqlQuery

From() 공개 메소드

Adds a table to the FROM statement with an alias. When it is called more than once, puts a comma between table names (cross join)
public From ( string table, IAlias alias ) : SqlQuery
table string Table
alias IAlias Alias for the table
리턴 SqlQuery

GroupBy() 공개 메소드

Adds a field of a given table alias to the GROUP BY clause.
public GroupBy ( IAlias alias, string fieldName ) : SqlQuery
alias IAlias A table alias that will be prepended to the field name with "." between
fieldName string A field name of the aliased table.
리턴 SqlQuery

GroupBy() 공개 메소드

Adds a field name or an SQL expression to the GROUP BY clause.
public GroupBy ( string expression ) : SqlQuery
expression string Array of fields or expressions.
리턴 SqlQuery

Having() 공개 메소드

Adds an SQL expression to the GROUP BY clause.
public Having ( string expression ) : SqlQuery
expression string Array of fields or expressions.
리턴 SqlQuery

InnerJoin() 공개 메소드

public InnerJoin ( IAlias alias, ICriteria onCriteria ) : SqlQuery
alias IAlias
onCriteria ICriteria
리턴 SqlQuery

Join() 공개 메소드

public Join ( Serenity.Data.Join join ) : SqlQuery
join Serenity.Data.Join
리턴 SqlQuery

LeftJoin() 공개 메소드

public LeftJoin ( IAlias alias, ICriteria onCriteria ) : SqlQuery
alias IAlias
onCriteria ICriteria
리턴 SqlQuery

LeftJoin() 공개 메소드

public LeftJoin ( string toTable, IAlias alias, ICriteria onCriteria ) : SqlQuery
toTable string
alias IAlias
onCriteria ICriteria
리턴 SqlQuery

OrderBy() 공개 메소드

Adds a field of a given table alias to the ORDER BY clause.
public OrderBy ( IAlias alias, string fieldName, bool desc = false ) : SqlQuery
alias IAlias A table alias that will be prepended to the field name with "." between
fieldName string A field name of the aliased table.
desc bool True to add " DESC" keyword to the expression.
리턴 SqlQuery

OrderBy() 공개 메소드

Adds a field name or an SQL expression to the ORDER BY clause.
public OrderBy ( string expression, bool desc = false ) : SqlQuery
expression string A field or an SQL expression.
desc bool True to add " DESC" keyword to the expression.
리턴 SqlQuery

OrderByFirst() 공개 메소드

Inserts a field name or an SQL expression to the start of ORDER BY clause.
This method is designed to help apply user defined orders (for example by clicking headers on a grid) to a query with existing order. SQL server throws an error if a field is used more than once in ORDER BY expression, so this function first removes normal and DESC versions of the expression from the ORDER BY statement.
public OrderByFirst ( string expression, bool desc = false ) : SqlQuery
expression string A field or an SQL expression.
desc bool True to add a " DESC" suffix.
리턴 SqlQuery

RightJoin() 공개 메소드

public RightJoin ( IAlias alias, ICriteria onCriteria ) : SqlQuery
alias IAlias
onCriteria ICriteria
리턴 SqlQuery

RightJoin() 공개 메소드

public RightJoin ( string toTable, IAlias alias, ICriteria onCriteria ) : SqlQuery
toTable string
alias IAlias
onCriteria ICriteria
리턴 SqlQuery

Select() 공개 메소드

Adds a field of a given table alias to the SELECT statement.
No column name is used for the field or expression.
public Select ( IAlias alias, string fieldName ) : SqlQuery
alias IAlias A table alias that will be prepended to the field name with "." between
fieldName string A field name of the aliased table.
리턴 SqlQuery

Select() 공개 메소드

Adds a field of a given table alias to the SELECT statement with a column name.
public Select ( IAlias alias, string fieldName, string columnName ) : SqlQuery
alias IAlias A table alias that will be prepended to the field name with "." between
fieldName string A field name of the aliased table.
columnName string A column name
리턴 SqlQuery

Select() 공개 메소드

Adds a subquery to the SELECT statement.
public Select ( ISqlQuery expression ) : SqlQuery
expression ISqlQuery A subquery.
리턴 SqlQuery

Select() 공개 메소드

Adds a subquery to the SELECT statement.
public Select ( ISqlQuery expression, string columnName ) : SqlQuery
expression ISqlQuery A subquery.
columnName string A column name
리턴 SqlQuery

Select() 공개 메소드

Adds a field name or an SQL expression to the SELECT statement.
No column name is used for the field or expression.
public Select ( string expression ) : SqlQuery
expression string A field or an SQL expression.
리턴 SqlQuery

Select() 공개 메소드

Adds a field name or expression to the SELECT statement with a column name
public Select ( string expression, string columnName ) : SqlQuery
expression string A field name or SQL expression.
columnName string A column name.
리턴 SqlQuery

SelectMany() 공개 메소드

Adds field names or SQL expressions to the SELECT statement.
No aliases are used for the fields or expressions.
public SelectMany ( ) : SqlQuery
리턴 SqlQuery

Skip() 공개 메소드

Sets SKIP value. Used for paging.
public Skip ( int skipRows ) : SqlQuery
skipRows int Number of rows to skip (server dependant implementation)
리턴 SqlQuery

Skip() 공개 메소드

Gets current SKIP value.
public Skip ( ) : int
리턴 int

SqlQuery() 공개 메소드

Creates a new SqlQuery instance.
public SqlQuery ( ) : System
리턴 System

SubQuery() 공개 메소드

Creates a new query that shares parameter dictionary with this query.
public SubQuery ( ) : SqlQuery
리턴 SqlQuery

Take() 공개 메소드

Sets TAKE/TOP value. Used for paging.
public Take ( int rowCount ) : SqlQuery
rowCount int Number of rows to take.
리턴 SqlQuery

Take() 공개 메소드

Gets TAKE/TOP value.
public Take ( ) : int
리턴 int

ToString() 공개 메소드

SqlSelect sorgusunu formatlayıp bir SELECT sorgusuna çevirir. Sayfalama sözkonusuysa (atlanan kayıt varsa) birden fazla sorgu arka arkaya oluşturulur.
public ToString ( ) : string
리턴 string

Where() 공개 메소드

Adds expressions to WHERE clause, inserting AND between them.
public Where ( ) : SqlQuery
리턴 SqlQuery

Where() 공개 메소드

Adds an expression to WHERE clause. If query already has a WHERE clause, inserts AND between existing one and new one.
public Where ( string expression ) : SqlQuery
expression string An expression
리턴 SqlQuery