C# Class Serenity.Data.SqlUpdate

Generates queries of the form UPDATE tablename SET field1 = value1, field2 = value2 ... fieldN = valueN WHERE [filter].

To determine updated field values, Set(field, value) should be called several times.

Where expressions determines the record(s) to update.

Inheritance: QueryWithParams, ISetFieldByStatement, IFilterableQuery
Mostrar archivo Open project: volkanceylan/Serenity Class Usage Examples

Public Methods

Method Description
Clone ( ) : SqlUpdate

Clones this SqlUpdate query.

Dec ( IField field, int value ) : SqlUpdate

Decreases a fields value.

Dec ( string field, int value ) : SqlUpdate

Decreases a fields value.

Format ( string tableName, string where, List nameValuePairs ) : string

Formats an SQL UPDATE statement.

Inc ( IField field, int value ) : SqlUpdate

Increases a fields value.

Inc ( string field, int value ) : SqlUpdate

Increases a fields value.

RemoveT0Reference ( string expression ) : string
SetNull ( string field ) : SqlUpdate

Sets field value to NULL.

SetTo ( IField field, string value ) : SqlUpdate

Sets field value to the expression.

SetTo ( string field, string value ) : SqlUpdate

Sets field value to the expression.

SqlUpdate ( string tableName ) : System

Creates a new SqlUpdate query.

ToString ( ) : string

Gets string representation of SqlUpdate query.

Where ( ) : SqlUpdate

Adds conditions to WHERE clause of the query.

Where ( string condition ) : SqlUpdate

Adds a condition to WHERE clause of the query.

Private Methods

Method Description
IFilterableQuery ( string condition ) : void

Adds a condition to WHERE clause of the query.

ISetFieldByStatement ( string field, string value ) : void

Sets field value to the expression.

Initialize ( string tableName ) : void

Method Details

Clone() public method

Clones this SqlUpdate query.
public Clone ( ) : SqlUpdate
return SqlUpdate

Dec() public method

Decreases a fields value.
public Dec ( IField field, int value ) : SqlUpdate
field IField /// Field (required).
value int /// Decrease amount (can be negative).
return SqlUpdate

Dec() public method

Decreases a fields value.
public Dec ( string field, int value ) : SqlUpdate
field string /// Field name (required).
value int /// Decrease amount (can be negative).
return SqlUpdate

Format() public static method

Formats an SQL UPDATE statement.
public static Format ( string tableName, string where, List nameValuePairs ) : string
tableName string /// Tablename (required).
where string /// WHERE clause (can be null).
nameValuePairs List /// Field name and values. Should have structure of [field1, value1, field2, value2, ...., fieldN, valueN]. /// This array is required and must have even number of elements.
return string

Inc() public method

Increases a fields value.
public Inc ( IField field, int value ) : SqlUpdate
field IField /// Field (required).
value int /// Increase amount (can be negative).
return SqlUpdate

Inc() public method

Increases a fields value.
public Inc ( string field, int value ) : SqlUpdate
field string /// Field name (required).
value int /// Increase amount (can be negative).
return SqlUpdate

RemoveT0Reference() public static method

public static RemoveT0Reference ( string expression ) : string
expression string
return string

SetNull() public method

Sets field value to NULL.
public SetNull ( string field ) : SqlUpdate
field string /// Field (required).
return SqlUpdate

SetTo() public method

Sets field value to the expression.
public SetTo ( IField field, string value ) : SqlUpdate
field IField /// Field name (required).
value string /// Field expression (required).
return SqlUpdate

SetTo() public method

Sets field value to the expression.
public SetTo ( string field, string value ) : SqlUpdate
field string /// Field name (required).
value string /// Field value (expression, required).
return SqlUpdate

SqlUpdate() public method

Creates a new SqlUpdate query.
public SqlUpdate ( string tableName ) : System
tableName string /// Tablename (required).
return System

ToString() public method

Gets string representation of SqlUpdate query.
public ToString ( ) : string
return string

Where() public method

Adds conditions to WHERE clause of the query.
public Where ( ) : SqlUpdate
return SqlUpdate

Where() public method

Adds a condition to WHERE clause of the query.
public Where ( string condition ) : SqlUpdate
condition string /// Condition.
return SqlUpdate