C# Class Habanero.DB.DatabaseConnectionSqlServer

A database connection customised for the SqlServer database
Inheritance: DatabaseConnection
Show file Open project: Chillisoft/habanero Class Usage Examples

Public Methods

Method Description
CreateParameterNameGenerator ( ) : IParameterNameGenerator

Creates an IParameterNameGenerator for this database connection. This is used to create names for parameters added to an ISqlStatement because each database uses a different naming convention for their parameters.

DatabaseConnectionSqlServer ( string assemblyName, string className ) : System

Constructor to initialise the connection object with an assembly name and class name

DatabaseConnectionSqlServer ( string assemblyName, string className, string connectString ) : System

Constructor to initialise the connection object with an assembly name, class name and connection string

GetLastAutoIncrementingID ( string tableName, IDbTransaction tran, IDbCommand command ) : long

Gets the value of the last auto-incrementing number. This called after doing an insert statement so that the inserted auto-number can be retrieved. The table name, current IDbTransaction and IDbCommand are passed in so that they can be used if necessary.

Protected Methods

Method Description
SetupCommand ( ISqlStatement statement, IDbCommand command, IDbTransaction transaction ) : void

Private Methods

Method Description
CreateIdentityOutputParameter ( IDbCommand command ) : IDbDataParameter
IsAutoIncrementingInsertStatement ( ISqlStatement statement ) : bool
SetupCommandForAutoIncrement ( IDbCommand command ) : void

Method Details

CreateParameterNameGenerator() public method

Creates an IParameterNameGenerator for this database connection. This is used to create names for parameters added to an ISqlStatement because each database uses a different naming convention for their parameters.
public CreateParameterNameGenerator ( ) : IParameterNameGenerator
return IParameterNameGenerator

DatabaseConnectionSqlServer() public method

Constructor to initialise the connection object with an assembly name and class name
public DatabaseConnectionSqlServer ( string assemblyName, string className ) : System
assemblyName string The assembly name
className string The class name
return System

DatabaseConnectionSqlServer() public method

Constructor to initialise the connection object with an assembly name, class name and connection string
public DatabaseConnectionSqlServer ( string assemblyName, string className, string connectString ) : System
assemblyName string The assembly name
className string The class name
connectString string The connection string, which can be /// generated using ConnectionStringSqlServerFactory.CreateConnectionString() ///
return System

GetLastAutoIncrementingID() public method

Gets the value of the last auto-incrementing number. This called after doing an insert statement so that the inserted auto-number can be retrieved. The table name, current IDbTransaction and IDbCommand are passed in so that they can be used if necessary.
public GetLastAutoIncrementingID ( string tableName, IDbTransaction tran, IDbCommand command ) : long
tableName string The name of the table inserted into
tran IDbTransaction The current transaction, the one the insert was done in
command IDbCommand The Command the did the insert statement
return long

SetupCommand() protected method

protected SetupCommand ( ISqlStatement statement, IDbCommand command, IDbTransaction transaction ) : void
statement ISqlStatement
command IDbCommand
transaction IDbTransaction
return void