SqlBuilder Class
Represents a mutable SQL string.
Inheritance Hierarchy
System.Object
DbExtensions.SqlBuilder
Namespace: DbExtensions
Assembly: DbExtensions.dll
Syntax
public sealed class SqlBuilder
The SqlBuilder type exposes the following members.
Properties
| Name | Description |
|---|---|
| Buffer | The underlying StringBuilder. |
| CurrentClause | Gets or sets the current SQL clause, used to identify consecutive appends to the same clause. |
| IsEmpty | Returns true if the buffer is empty. |
| NextClause | Gets or sets the next SQL clause. Used by clause continuation methods, such as _(String) and _If(Boolean, ConditionalStringHandler). |
| ParameterValues | The parameter objects to be included in the database command. |
Methods
| Name | Description |
|---|---|
| _(SqlBuilder.ClauseStringHandler<Current>) | Appends the interpolated string handler to the current clause. |
| _(String) | Appends the text to the current clause. |
| _Else | Appends handler to the current clause if an antecedent call to _If(Boolean, ConditionalStringHandler) or _ElseIf(Boolean, ConditionalElseStringHandler) used a false condition |
| _ElseIf | Appends handler to the current clause if condition is true and an antecedent call to _If(Boolean, ConditionalStringHandler) or _ElseIf(Boolean, ConditionalElseStringHandler) used a false condition. |
| _If | Appends the interpolated string handler to the current clause if condition is true. |
| Append(AppendStringHandler) | Appends the interpolated string handler to this instance. |
| Append(String) | Appends text to this instance. |
| AppendClause(SqlClause) | Appends the SQL clause. |
| AppendClause<TClause>() | Appends the SQL clause identified by TClause. |
| AppendElse | Appends the interpolated string handler if an antecedent call to AppendIf(Boolean, AppendStringHandler) or AppendElseIf(Boolean, AppendElseStringHandler) used a false condition |
| AppendElseIf | Appends the interpolated string handler if condition is true and an antecedent call to AppendIf(Boolean, AppendStringHandler) or AppendElseIf(Boolean, AppendElseStringHandler) used a false condition. |
| AppendIf | Appends the interpolated string handler if condition is true. |
| AppendLine | Appends the default line terminator to this instance. |
| AppendSql | Appends sql to this instance. |
| Clone | Creates and returns a copy of this instance. |
| CROSS_JOIN() | Sets CROSS JOIN as the next clause, to be used by subsequent calls to clause continuation methods, such as _If(Boolean, ConditionalStringHandler). |
| CROSS_JOIN(SqlBuilder.ClauseStringHandler<CROSS_JOIN>) | Appends the CROSS JOIN clause using the provided interpolated string handler. |
| CROSS_JOIN(String) | Appends the CROSS JOIN clause using the provided text. |
| DELETE_FROM(SqlBuilder.ClauseStringHandler<DELETE_FROM>) | Appends the DELETE FROM clause using the provided interpolated string handler. |
| DELETE_FROM(String) | Appends the DELETE FROM clause using the provided text. |
| FROM() | Sets FROM as the next clause, to be used by subsequent calls to clause continuation methods, such as _If(Boolean, ConditionalStringHandler). |
| FROM(SqlBuilder.ClauseStringHandler<FROM>) | Appends the FROM clause using the provided interpolated string handler. |
| FROM(String) | Appends the FROM clause using the provided text. |
| FROM(SqlBuilder, String) | Appends the FROM clause using the provided subQuery as body named after alias. |
| FROM(SqlSet, String) | Appends the FROM clause using the provided subQuery as body named after alias. |
| GROUP_BY() | Sets GROUP BY as the next clause, to be used by subsequent calls to clause continuation methods, such as _If(Boolean, ConditionalStringHandler). |
| GROUP_BY(SqlBuilder.ClauseStringHandler<GROUP_BY>) | Appends the GROUP BY clause using the provided interpolated string handler. |
| GROUP_BY(String) | Appends the GROUP BY clause using the provided text. |
| HAVING() | Sets HAVING as the next clause, to be used by subsequent calls to clause continuation methods, such as _If(Boolean, ConditionalStringHandler). |
| HAVING(SqlBuilder.ClauseStringHandler<HAVING>) | Appends the HAVING clause using the provided interpolated string handler. |
| HAVING(String) | Appends the HAVING clause using the provided text. |
| INNER_JOIN() | Sets INNER JOIN as the next clause, to be used by subsequent calls to clause continuation methods, such as _If(Boolean, ConditionalStringHandler). |
| INNER_JOIN(SqlBuilder.ClauseStringHandler<INNER_JOIN>) | Appends the INNER JOIN clause using the provided interpolated string handler. |
| INNER_JOIN(String) | Appends the INNER JOIN clause using the provided text. |
| INSERT_INTO(SqlBuilder.ClauseStringHandler<INSERT_INTO>) | Appends the INSERT INTO clause using the provided interpolated string handler. |
| INSERT_INTO(String) | Appends the INSERT INTO clause using the provided text. |
| InsertText | Inserts a string into this instance at the specified character position. |
| JOIN() | Sets JOIN as the next clause, to be used by subsequent calls to clause continuation methods, such as _If(Boolean, ConditionalStringHandler). |
| JOIN(SqlBuilder.ClauseStringHandler<JOIN>) | Appends the JOIN clause using the provided interpolated string handler. |
| JOIN(String) | Appends the JOIN clause using the provided text. |
| JoinSql(String, SqlBuilder[]) | Concatenates a specified separator String between each element of a specified SqlBuilder array, yielding a single concatenated SqlBuilder. |
| JoinSql(String, IEnumerable<SqlBuilder>) | Concatenates the members of a constructed IEnumerable<T> collection of type SqlBuilder, using the specified separator between each member. |
| LEFT_JOIN() | Sets LEFT JOIN as the next clause, to be used by subsequent calls to clause continuation methods, such as _If(Boolean, ConditionalStringHandler). |
| LEFT_JOIN(SqlBuilder.ClauseStringHandler<LEFT_JOIN>) | Appends the LEFT JOIN clause using the provided interpolated string handler. |
| LEFT_JOIN(String) | Appends the LEFT JOIN clause using the provided text. |
| LIMIT() | Sets LIMIT as the next clause, to be used by subsequent calls to clause continuation methods, such as _If(Boolean, ConditionalStringHandler). |
| LIMIT(SqlBuilder.ClauseStringHandler<LIMIT>) | Appends the LIMIT clause using the provided interpolated string handler. |
| LIMIT(Int32) | Appends the LIMIT clause using the provided maxRecords parameter. |
| LIMIT(String) | Appends the LIMIT clause using the provided text. |
| OFFSET() | Sets OFFSET as the next clause, to be used by subsequent calls to clause continuation methods, such as _If(Boolean, ConditionalStringHandler). |
| OFFSET(SqlBuilder.ClauseStringHandler<OFFSET>) | Appends the OFFSET clause using the provided interpolated string handler. |
| OFFSET(Int32) | Appends the OFFSET clause using the provided startIndex parameter. |
| OFFSET(String) | Appends the OFFSET clause using the provided text. |
| ORDER_BY() | Sets ORDER BY as the next clause, to be used by subsequent calls to clause continuation methods, such as _If(Boolean, ConditionalStringHandler). |
| ORDER_BY(SqlBuilder.ClauseStringHandler<ORDER_BY>) | Appends the ORDER BY clause using the provided interpolated string handler. |
| ORDER_BY(String) | Appends the ORDER BY clause using the provided text. |
| RIGHT_JOIN() | Sets RIGHT JOIN as the next clause, to be used by subsequent calls to clause continuation methods, such as _If(Boolean, ConditionalStringHandler). |
| RIGHT_JOIN(SqlBuilder.ClauseStringHandler<RIGHT_JOIN>) | Appends the RIGHT JOIN clause using the provided interpolated string handler. |
| RIGHT_JOIN(String) | Appends the RIGHT JOIN clause using the provided text. |
| SELECT() | Sets SELECT as the next clause, to be used by subsequent calls to clause continuation methods, such as _If(Boolean, ConditionalStringHandler). |
| SELECT(SqlBuilder.ClauseStringHandler<SELECT>) | Appends the SELECT clause using the provided interpolated string handler. |
| SELECT(String) | Appends the SELECT clause using the provided text. |
| SET(SqlBuilder.ClauseStringHandler<SET>) | Appends the SET clause using the provided interpolated string handler. |
| SET(String) | Appends the SET clause using the provided text. |
| SetCurrentClause(SqlClause) | Sets clause as the current SQL clause. |
| SetCurrentClause<TClause>() | Sets the clause identified by TClause as the current SQL clause. |
| SetNextClause(SqlClause) | Sets clause as the next SQL clause. |
| SetNextClause<TClause>() | Sets the clause identified by TClause as the next SQL clause. |
| ToString | Converts the value of this instance to a String. (Overrides Object.ToString()) |
| UNION | Appends the UNION clause. |
| UPDATE(SqlBuilder.ClauseStringHandler<UPDATE>) | Appends the UPDATE clause using the provided interpolated string handler. |
| UPDATE(String) | Appends the UPDATE clause using the provided text. |
| VALUES(SqlBuilder.ClauseStringHandler<VALUES>) | Appends the VALUES clause using the provided interpolated string handler. |
| VALUES(Object[]) | Appends the VALUES clause using the provided parameters. |
| WHERE() | Sets WHERE as the next clause, to be used by subsequent calls to clause continuation methods, such as _If(Boolean, ConditionalStringHandler). |
| WHERE(SqlBuilder.ClauseStringHandler<WHERE>) | Appends the WHERE clause using the provided interpolated string handler. |
| WHERE(String) | Appends the WHERE clause using the provided text. |
| WITH(SqlBuilder.ClauseStringHandler<WITH>) | Appends the WITH clause using the provided interpolated string handler. |
| WITH(String) | Appends the WITH clause using the provided text. |
| WITH(String, SqlBuilder) | Appends the WITH clause using the provided subQuery as body named after alias. |
| WITH(String, SqlSet) | Appends the WITH clause using the provided subQuery as body named after alias. |
Remarks
For information on how to use SqlBuilder see SqlBuilder Tutorial.