C# Class BF2Statistics.Database.QueryBuilder.UpdateQueryBuilder

Datei anzeigen Open project: BF2Statistics/ControlCenter Class Usage Examples

Public Properties

Property Type Description
Table string

Protected Properties

Property Type Description
Driver DatabaseDriver
Fields FieldValuePair>.Dictionary
WhereStatement WhereStatement

Public Methods

Method Description
AddWhere ( string field, Comparison @operator, object compareValue ) : WhereClause
AddWhere ( WhereClause Clause ) : void
BuildCommand ( ) : DbCommand

Builds the query string with the current SQL Statement, and returns the DbCommand to be executed. All WHERE paramenters are propery escaped, making this command SQL Injection safe.

BuildQuery ( ) : string

Builds the query string with the current SQL Statement, and returns the querystring. This method is NOT Sql Injection safe!

Execute ( ) : int

Executes the command against the database. The database driver must be set!

SetDbDriver ( DatabaseDriver Driver ) : void

Sets the database driver

SetField ( string Field, object Value ) : void

Sets a value for the specified field

SetField ( string Field, object Value, ValueMode Mode ) : void

Sets a value for the specified field

SetTable ( string Table ) : void

Sets the table name to update

SetWhereOperator ( LogicOperator @Operator ) : void

Sets the Logic Operator for the WHERE statement

UpdateQueryBuilder ( DatabaseDriver Driver ) : System

Creates a new instance of UpdateQueryBuilder with the provided Database Driver.

UpdateQueryBuilder ( string Table, DatabaseDriver Driver ) : System

Creates a new instance of UpdateQueryBuilder with the provided Database Driver.

Protected Methods

Method Description
BuildQuery ( bool BuildCommand ) : object

Builds the query string or DbCommand

GetSign ( ValueMode Mode ) : string

Returns the sign for the given value mode

Method Details

AddWhere() public method

public AddWhere ( string field, Comparison @operator, object compareValue ) : WhereClause
field string
@operator Comparison
compareValue object
return WhereClause

AddWhere() public method

public AddWhere ( WhereClause Clause ) : void
Clause WhereClause
return void

BuildCommand() public method

Builds the query string with the current SQL Statement, and returns the DbCommand to be executed. All WHERE paramenters are propery escaped, making this command SQL Injection safe.
public BuildCommand ( ) : DbCommand
return System.Data.Common.DbCommand

BuildQuery() protected method

Builds the query string or DbCommand
protected BuildQuery ( bool BuildCommand ) : object
BuildCommand bool
return object

BuildQuery() public method

Builds the query string with the current SQL Statement, and returns the querystring. This method is NOT Sql Injection safe!
public BuildQuery ( ) : string
return string

Execute() public method

Executes the command against the database. The database driver must be set!
public Execute ( ) : int
return int

GetSign() protected method

Returns the sign for the given value mode
protected GetSign ( ValueMode Mode ) : string
Mode ValueMode
return string

SetDbDriver() public method

Sets the database driver
public SetDbDriver ( DatabaseDriver Driver ) : void
Driver DatabaseDriver
return void

SetField() public method

Sets a value for the specified field
public SetField ( string Field, object Value ) : void
Field string The column or field name
Value object The new value to update
return void

SetField() public method

Sets a value for the specified field
public SetField ( string Field, object Value, ValueMode Mode ) : void
Field string The column or field name
Value object The new value to update
Mode ValueMode Sets how the update value will be applied to the existing field value
return void

SetTable() public method

Sets the table name to update
public SetTable ( string Table ) : void
Table string The name of the table to update
return void

SetWhereOperator() public method

Sets the Logic Operator for the WHERE statement
public SetWhereOperator ( LogicOperator @Operator ) : void
@Operator LogicOperator
return void

UpdateQueryBuilder() public method

Creates a new instance of UpdateQueryBuilder with the provided Database Driver.
public UpdateQueryBuilder ( DatabaseDriver Driver ) : System
Driver DatabaseDriver The DatabaseDriver that will be used to query this SQL statement
return System

UpdateQueryBuilder() public method

Creates a new instance of UpdateQueryBuilder with the provided Database Driver.
public UpdateQueryBuilder ( string Table, DatabaseDriver Driver ) : System
Table string The table we are updating
Driver DatabaseDriver The DatabaseDriver that will be used to query this SQL statement
return System

Property Details

Driver protected_oe property

The database driver, if using the "BuildCommand" method
protected DatabaseDriver Driver
return DatabaseDriver

Fields protected_oe property

A list of FieldValuePairs
protected Dictionary Fields
return FieldValuePair>.Dictionary

Table public_oe property

The table name to query
public string Table
return string

WhereStatement protected_oe property

Query's where statement
protected WhereStatement WhereStatement
return WhereStatement