C# Class BF2Statistics.Database.QueryBuilder.InsertQueryBuilder

Provides an object interface that can properly put together an Insert Query string.
All parameters in the WHERE and HAVING statements will be escaped by the underlaying DbCommand object, making the Execute*() methods SQL injection safe.
Afficher le fichier Open project: BF2Statistics/ControlCenter Class Usage Examples

Méthodes publiques

Свойство Type Description
Table string

Protected Properties

Свойство Type Description
Driver DatabaseDriver
Fields object>.Dictionary

Méthodes publiques

Méthode Description
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 built SQL statement on the Database connection that was passed in the contructor. All WHERE paramenters are propery escaped, making this command SQL Injection safe.

InsertQueryBuilder ( DatabaseDriver Driver ) : System

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

InsertQueryBuilder ( string Table, DatabaseDriver Driver ) : System

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

SetDbDriver ( DatabaseDriver Driver ) : void

Sets the database driver

SetField ( string Field, object Value ) : void

Sets a value for the specified field

SetTable ( string Table ) : void

Sets the table name to inesrt into

Méthodes protégées

Méthode Description
BuildQuery ( bool BuildCommand ) : object

Builds the query string or DbCommand

Method Details

BuildCommand() public méthode

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
Résultat System.Data.Common.DbCommand

BuildQuery() protected méthode

Builds the query string or DbCommand
protected BuildQuery ( bool BuildCommand ) : object
BuildCommand bool
Résultat object

BuildQuery() public méthode

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

Execute() public méthode

Executes the built SQL statement on the Database connection that was passed in the contructor. All WHERE paramenters are propery escaped, making this command SQL Injection safe.
public Execute ( ) : int
Résultat int

InsertQueryBuilder() public méthode

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

InsertQueryBuilder() public méthode

Creates a new instance of InsertQueryBuilder with the provided Database Driver.
public InsertQueryBuilder ( string Table, DatabaseDriver Driver ) : System
Table string The table we are inserting into
Driver DatabaseDriver The DatabaseDriver that will be used to query this SQL statement
Résultat System

SetDbDriver() public méthode

Sets the database driver
public SetDbDriver ( DatabaseDriver Driver ) : void
Driver DatabaseDriver
Résultat void

SetField() public méthode

Sets a value for the specified field
public SetField ( string Field, object Value ) : void
Field string The column or field name
Value object The value to insert
Résultat void

SetTable() public méthode

Sets the table name to inesrt into
public SetTable ( string Table ) : void
Table string The name of the table to insert into
Résultat void

Property Details

Driver protected_oe property

The database driver, if using the "BuildCommand" method
protected DatabaseDriver Driver
Résultat DatabaseDriver

Fields protected_oe property

A list of FieldValuePairs
protected Dictionary Fields
Résultat object>.Dictionary

Table public_oe property

The table name to query
public string Table
Résultat string