C# Class ScrewTurn.Wiki.Plugins.SqlCommon.QueryBuilder

A tool for building queries.
Afficher le fichier Open project: mono/ScrewTurnWiki Class Usage Examples

Méthodes publiques

Méthode Description
AndWhere ( string query, string column, WhereOperator op, string parameter ) : string

Adds another WHERE clause to a query.

AndWhere ( string query, string column, WhereOperator op, string parameter, bool openBracket, bool closeBracket ) : string

Adds another WHERE clause to a query.

AndWhere ( string query, string table, string column, WhereOperator op, string parameter ) : string

Adds another WHERE clause to a query.

AndWhere ( string query, string table, string column, WhereOperator op, string parameter, bool openBracket, bool closeBracket ) : string

Adds another WHERE clause to a query.

AppendForBatch ( string query, string secondQuery ) : string

Appends a query to an existing query for batch execution.

DeleteFrom ( string table ) : string

Builds a DELETE FROM query.

GroupBy ( string query, string columns ) : string

Applies a GROUP BY clause to a query.

InsertInto ( string table, string columns, string parameters ) : string

Builds an INSERT INTO query.

NewQuery ( ICommandBuilder builder ) : QueryBuilder

Initializes a new instance of the T:QueryBuilder class.

OrWhere ( string query, string column, WhereOperator op, string parameter ) : string

Adds another WHERE clause to a query.

OrWhere ( string query, string column, WhereOperator op, string parameter, bool openBracket, bool closeBracket ) : string

Adds another WHERE clause to a query.

OrWhere ( string query, string table, string column, WhereOperator op, string parameter ) : string

Adds another WHERE clause to a query.

OrWhere ( string query, string table, string column, WhereOperator op, string parameter, bool openBracket, bool closeBracket ) : string

Adds another WHERE clause to a query.

OrderBy ( string query, string columns, Ordering orderings ) : string

Applies an ORDER BY clause to a query.

QueryBuilder ( ICommandBuilder builder ) : System

Initializes a new instance of the T:QueryBuilder class.

SelectCountFrom ( string table ) : string

Builds a SELECT COUNT(*) query.

SelectFrom ( string table ) : string

Builds a SELECT query.

SelectFrom ( string table, string columns ) : string

Builds a SELECT query.

SelectFrom ( string table, string joinedTable, string tableColumn, string joinedTableColumn, Join join ) : string

Builds a SELECT query with a JOIN clause.

SelectFrom ( string table, string joinedTable, string tableColumn, string joinedTableColumn, Join join, string tableColumns, string joinedTableColumns ) : string

Builds a SELECT query with a JOIN clause.

SelectFrom ( string table, string joinedTable, string tableColumn, string joinedTableColumn, Join join, string tableColumns, string joinedTableColumns, string otherJoinedTable, string otherJoinedTableColumn, Join otherJoin, string otherJoinedTableColumns ) : string

Builds a SELECT query with two JOIN clauses (both on the main table).

Update ( string table, string columns, string parameters ) : string

Builds an UPDATE query.

UpdateIncrement ( string table, string column, int increment ) : string

Builds an UPDATE query that increments the numerical value of a column by one.

Where ( string query, string column, WhereOperator op, string parameter ) : string

Applies a WHERE clause to a query.

Where ( string query, string column, WhereOperator op, string parameter, bool openBracket, bool closeBracket ) : string

Applies a WHERE clause to a query.

Where ( string query, string table, string column, WhereOperator op, string parameter ) : string

Applies a WHERE clause to a query.

Where ( string query, string table, string column, WhereOperator op, string parameter, bool openBracket, bool closeBracket ) : string

Applies a WHERE clause to a query.

WhereIn ( string query, string column, string parameters ) : string

Applies a WHERE clause with IN operator to a query.

WhereIn ( string query, string table, string column, string parameters ) : string

Applies a WHERE clause with IN operator to a query.

WhereNotInSubquery ( string query, string table, string column, string subQuery ) : string

Applies a WHERE NOT IN (subQuery) clause to a query.

Private Methods

Méthode Description
BuildWhereClause ( string table, string column, WhereOperator op, string parameter ) : string

Builds a WHERE clause condition.

BuildWhereInClause ( string table, string column, string parameters ) : string

Builds a WHERE clause with IN operator.

JoinToString ( Join join ) : string

Converts a Join type to its string representation.

OrderingToString ( Ordering ordering ) : string

Converts an ordering to string.

WhereOperatorToString ( WhereOperator op ) : string

Converts a WHERE operator to its corresponding string.

Method Details

AndWhere() public méthode

Adds another WHERE clause to a query.
public AndWhere ( string query, string column, WhereOperator op, string parameter ) : string
query string The query.
column string The column subject of the WHERE clause.
op WhereOperator The operator.
parameter string The name of the parameter for the WHERE clause.
Résultat string

AndWhere() public méthode

Adds another WHERE clause to a query.
public AndWhere ( string query, string column, WhereOperator op, string parameter, bool openBracket, bool closeBracket ) : string
query string The query.
column string The column subject of the WHERE clause.
op WhereOperator The operator.
parameter string The name of the parameter for the WHERE clause.
openBracket bool A value indicating whether to open a bracket after the AND.
closeBracket bool A value indicating whether to close a bracket after the clause.
Résultat string

AndWhere() public méthode

Adds another WHERE clause to a query.
public AndWhere ( string query, string table, string column, WhereOperator op, string parameter ) : string
query string The query.
table string The table the column belongs to.
column string The column subject of the WHERE clause.
op WhereOperator The operator.
parameter string The name of the parameter for the WHERE clause.
Résultat string

AndWhere() public méthode

Adds another WHERE clause to a query.
public AndWhere ( string query, string table, string column, WhereOperator op, string parameter, bool openBracket, bool closeBracket ) : string
query string The query.
table string The table the column belongs to.
column string The column subject of the WHERE clause.
op WhereOperator The operator.
parameter string The name of the parameter for the WHERE clause.
openBracket bool A value indicating whether to open a bracket after the AND.
closeBracket bool A value indicating whether to close a bracket after the clause.
Résultat string

AppendForBatch() public méthode

Appends a query to an existing query for batch execution.
public AppendForBatch ( string query, string secondQuery ) : string
query string The query.
secondQuery string The second query.
Résultat string

DeleteFrom() public méthode

Builds a DELETE FROM query.
public DeleteFrom ( string table ) : string
table string The table.
Résultat string

GroupBy() public méthode

Applies a GROUP BY clause to a query.
public GroupBy ( string query, string columns ) : string
query string The query.
columns string The columns to group by.
Résultat string

InsertInto() public méthode

Builds an INSERT INTO query.
public InsertInto ( string table, string columns, string parameters ) : string
table string The destination table.
columns string The columns names.
parameters string The parameters names.
Résultat string

NewQuery() public static méthode

Initializes a new instance of the T:QueryBuilder class.
public static NewQuery ( ICommandBuilder builder ) : QueryBuilder
builder ICommandBuilder The command builder.
Résultat QueryBuilder

OrWhere() public méthode

Adds another WHERE clause to a query.
public OrWhere ( string query, string column, WhereOperator op, string parameter ) : string
query string The query.
column string The column subject of the WHERE clause.
op WhereOperator The operator.
parameter string The name of the parameter for the WHERE clause.
Résultat string

OrWhere() public méthode

Adds another WHERE clause to a query.
public OrWhere ( string query, string column, WhereOperator op, string parameter, bool openBracket, bool closeBracket ) : string
query string The query.
column string The column subject of the WHERE clause.
op WhereOperator The operator.
parameter string The name of the parameter for the WHERE clause.
openBracket bool A value indicating whether to open a bracket after the OR.
closeBracket bool A value indicating whether to close a bracket after the clause.
Résultat string

OrWhere() public méthode

Adds another WHERE clause to a query.
public OrWhere ( string query, string table, string column, WhereOperator op, string parameter ) : string
query string The query.
table string The table the column belongs to.
column string The column subject of the WHERE clause.
op WhereOperator The operator.
parameter string The name of the parameter for the WHERE clause.
Résultat string

OrWhere() public méthode

Adds another WHERE clause to a query.
public OrWhere ( string query, string table, string column, WhereOperator op, string parameter, bool openBracket, bool closeBracket ) : string
query string The query.
table string The table the column belongs to.
column string The column subject of the WHERE clause.
op WhereOperator The operator.
parameter string The name of the parameter for the WHERE clause.
openBracket bool A value indicating whether to open a bracket after the AND.
closeBracket bool A value indicating whether to close a bracket after the clause.
Résultat string

OrderBy() public méthode

Applies an ORDER BY clause to a query.
public OrderBy ( string query, string columns, Ordering orderings ) : string
query string The query.
columns string The columns to order by.
orderings Ordering The ordering directions for each column.
Résultat string

QueryBuilder() public méthode

Initializes a new instance of the T:QueryBuilder class.
public QueryBuilder ( ICommandBuilder builder ) : System
builder ICommandBuilder The command builder.
Résultat System

SelectCountFrom() public méthode

Builds a SELECT COUNT(*) query.
public SelectCountFrom ( string table ) : string
table string The table.
Résultat string

SelectFrom() public méthode

Builds a SELECT query.
public SelectFrom ( string table ) : string
table string The table.
Résultat string

SelectFrom() public méthode

Builds a SELECT query.
public SelectFrom ( string table, string columns ) : string
table string The table.
columns string The columns to select.
Résultat string

SelectFrom() public méthode

Builds a SELECT query with a JOIN clause.
public SelectFrom ( string table, string joinedTable, string tableColumn, string joinedTableColumn, Join join ) : string
table string The main table.
joinedTable string The joined table.
tableColumn string The main table column to join.
joinedTableColumn string The joined table column to join.
join Join The JOIN type.
Résultat string

SelectFrom() public méthode

Builds a SELECT query with a JOIN clause.
public SelectFrom ( string table, string joinedTable, string tableColumn, string joinedTableColumn, Join join, string tableColumns, string joinedTableColumns ) : string
table string The min table.
joinedTable string The joined table.
tableColumn string The main table column to join.
joinedTableColumn string The joined table column to join.
join Join The JOIN type.
tableColumns string The main table columns to select.
joinedTableColumns string The joined table columns to select.
Résultat string

SelectFrom() public méthode

Builds a SELECT query with two JOIN clauses (both on the main table).
public SelectFrom ( string table, string joinedTable, string tableColumn, string joinedTableColumn, Join join, string tableColumns, string joinedTableColumns, string otherJoinedTable, string otherJoinedTableColumn, Join otherJoin, string otherJoinedTableColumns ) : string
table string The main table.
joinedTable string The joined table.
tableColumn string The main table column to join.
joinedTableColumn string The joined table column to join.
join Join The join.
tableColumns string The main table columns to select.
joinedTableColumns string The joined table columns to select.
otherJoinedTable string The other joined table.
otherJoinedTableColumn string The other joined table column to join.
otherJoin Join The join.
otherJoinedTableColumns string The other joined table columns to select.
Résultat string

Update() public méthode

Builds an UPDATE query.
public Update ( string table, string columns, string parameters ) : string
table string The table.
columns string The columns to update.
parameters string The parameters.
Résultat string

UpdateIncrement() public méthode

Builds an UPDATE query that increments the numerical value of a column by one.
public UpdateIncrement ( string table, string column, int increment ) : string
table string The table.
column string The column to update.
increment int The increment or decrement value.
Résultat string

Where() public méthode

Applies a WHERE clause to a query.
public Where ( string query, string column, WhereOperator op, string parameter ) : string
query string The query.
column string The column subject of the WHERE clause.
op WhereOperator The operator.
parameter string The name of the parameter for the WHERE clause.
Résultat string

Where() public méthode

Applies a WHERE clause to a query.
public Where ( string query, string column, WhereOperator op, string parameter, bool openBracket, bool closeBracket ) : string
query string The query.
column string The column subject of the WHERE clause.
op WhereOperator The operator.
parameter string The name of the parameter for the WHERE clause.
openBracket bool A value indicating whether to open a bracket after the WHERE.
closeBracket bool A value indicating whether to close a bracket after the clause.
Résultat string

Where() public méthode

Applies a WHERE clause to a query.
public Where ( string query, string table, string column, WhereOperator op, string parameter ) : string
query string The query.
table string The table the column belongs to.
column string The column subject of the WHERE clause.
op WhereOperator The operator.
parameter string The name of the parameter for the WHERE clause.
Résultat string

Where() public méthode

Applies a WHERE clause to a query.
public Where ( string query, string table, string column, WhereOperator op, string parameter, bool openBracket, bool closeBracket ) : string
query string The query.
table string The table the column belongs to.
column string The column subject of the WHERE clause.
op WhereOperator The operator.
parameter string The name of the parameter for the WHERE clause.
openBracket bool A value indicating whether to open a bracket after the WHERE.
closeBracket bool A value indicating whether to close a bracket after the clause.
Résultat string

WhereIn() public méthode

Applies a WHERE clause with IN operator to a query.
public WhereIn ( string query, string column, string parameters ) : string
query string The query.
column string The column subject of the WHERE clause.
parameters string The names of the parameters in the IN set.
Résultat string

WhereIn() public méthode

Applies a WHERE clause with IN operator to a query.
public WhereIn ( string query, string table, string column, string parameters ) : string
query string The query.
table string The table the column belongs to.
column string The column subject of the WHERE clause.
parameters string The names of the parameters in the IN set.
Résultat string

WhereNotInSubquery() public méthode

Applies a WHERE NOT IN (subQuery) clause to a query.
public WhereNotInSubquery ( string query, string table, string column, string subQuery ) : string
query string The query.
table string The table the column belongs to.
column string The column.
subQuery string The subQuery.
Résultat string