C# Class NSoft.NFramework.Data.PostgreSql.EnterpriseLibrary.NpgsqlDatabase

Inheritance: Microsoft.Practices.EnterpriseLibrary.Data.Database
Mostra file Open project: debop/NFramework Class Usage Examples

Public Methods

Method Description
AddInParameter ( DbCommand command, string name, NpgsqlDbType dbType ) : void

Adds a new In DbParameter object to the given command.

This version of the method is used when you can have the same parameter object multiple times with different values.

AddInParameter ( DbCommand command, string name, NpgsqlDbType dbType, object value ) : void

Adds a new In DbParameter object to the given command.

AddInParameter ( DbCommand command, string name, NpgsqlDbType dbType, string sourceColumn, DataRowVersion sourceVersion ) : void

Adds a new In DbParameter object to the given command.

AddOutParameter ( DbCommand command, string name, NpgsqlDbType dbType, int size ) : void

Adds a new Out DbParameter object to the given command.

AddParameter ( DbCommand command, string name, NpgsqlDbType dbType, ParameterDirection direction, string sourceColumn, DataRowVersion sourceVersion, object value ) : void

Adds a new instance of a DbParameter object to the command.

AddParameter ( DbCommand command, string name, NpgsqlDbType dbType, int size, ParameterDirection direction, bool nullable, byte precision, byte scale, string sourceColumn, DataRowVersion sourceVersion, object value ) : void

Adds a new instance of a DbParameter object to the command.

BuildParameterName ( string name ) : string

Builds a value parameter name for the current database.

CheckIfNpgsqlCommand ( DbCommand command ) : NpgsqlCommand

Checks if a database command is a Npgsql command and converts.

ExecuteDataSet ( DbTransaction transaction, string storedProcedureName ) : DataSet

Executes the storedProcedureName with parameterValues as part of the transaction and returns the results in a new T:System.Data.DataSet within a transaction.

ExecuteDataSet ( string storedProcedureName ) : DataSet

Executes the storedProcedureName with parameterValues and returns the results in a new T:System.Data.DataSet.

ExecuteNonQuery ( DbTransaction transaction, string storedProcedureName ) : int

Executes the storedProcedureName using the given parameterValues within a transaction and returns the number of rows affected.

ExecuteNonQuery ( string storedProcedureName ) : int

Executes the storedProcedureName using the given parameterValues and returns the number of rows affected.

ExecuteReader ( DbTransaction transaction, string storedProcedureName ) : IDataReader

Executes the storedProcedureName with the given parameterValues within the given transaction and returns an through which the result can be read. It is the responsibility of the caller to close the connection and reader when finished.

ExecuteReader ( string storedProcedureName ) : IDataReader

Executes the storedProcedureName with the given parameterValues and returns an through which the result can be read. It is the responsibility of the caller to close the connection and reader when finished.

ExecuteScalar ( DbTransaction transaction, string storedProcedureName ) : object

Executes the storedProcedureName with the given parameterValues within a transaction and returns the first column of the first row in the result set returned by the query. Extra columns or rows are ignored.

ExecuteScalar ( string storedProcedureName ) : object

Executes the storedProcedureName with the given parameterValues and returns the first column of the first row in the result set returned by the query. Extra columns or rows are ignored.

NpgsqlDatabase ( string connectionString ) : System

생성자

Protected Methods

Method Description
ConfigureParameter ( DbParameter param, string name, DbType dbType, int size, ParameterDirection direction, bool nullable, byte precision, byte scale, string sourceColumn, DataRowVersion sourceVersion, object value ) : void

Configures a given DbParameter.

CreateParameter ( string name, NpgsqlDbType dbType, int size, ParameterDirection direction, bool nullable, byte precision, byte scale, string sourceColumn, DataRowVersion sourceVersion, object value ) : DbParameter

Adds a new instance of a DbParameter object.

SameNumberOfParametersAndValues ( DbCommand command, object values ) : bool

Determines if the number of parameters in the command matches the array of parameter values.

UserParametersStartIndex ( ) : int

Returns the starting index for parameters in a command.

Private Methods

Method Description
ConfigureParameter ( Npgsql.NpgsqlParameter parameter, string name, NpgsqlDbType dbType, int size, ParameterDirection direction, bool nullable, byte precision, byte scale, string sourceColumn, DataRowVersion sourceVersion, object value ) : void
DeriveParameters ( DbCommand discoveryCommand ) : void
OnNpgsqlRowUpdated ( object sender, Npgsql.NpgsqlRowUpdatedEventArgs rowThatCouldNotBeWritten ) : void

Called when [NPGSQL row updated].

SetUpRowUpdatedEvent ( DbDataAdapter adapter ) : void

Method Details

AddInParameter() public method

Adds a new In DbParameter object to the given command.
This version of the method is used when you can have the same parameter object multiple times with different values.
public AddInParameter ( DbCommand command, string name, NpgsqlDbType dbType ) : void
command System.Data.Common.DbCommand The command to add the in parameter.
name string The name of the parameter.
dbType NpgsqlDbType One of the values.
return void

AddInParameter() public method

Adds a new In DbParameter object to the given command.
public AddInParameter ( DbCommand command, string name, NpgsqlDbType dbType, object value ) : void
command System.Data.Common.DbCommand The commmand to add the parameter.
name string The name of the parameter.
dbType NpgsqlDbType One of the values.
value object The value of the parameter.
return void

AddInParameter() public method

Adds a new In DbParameter object to the given command.
public AddInParameter ( DbCommand command, string name, NpgsqlDbType dbType, string sourceColumn, DataRowVersion sourceVersion ) : void
command System.Data.Common.DbCommand The command to add the parameter.
name string The name of the parameter.
dbType NpgsqlDbType One of the values.
sourceColumn string The name of the source column mapped to the DataSet and used for loading or returning the value.
sourceVersion DataRowVersion One of the values.
return void

AddOutParameter() public method

Adds a new Out DbParameter object to the given command.
public AddOutParameter ( DbCommand command, string name, NpgsqlDbType dbType, int size ) : void
command System.Data.Common.DbCommand The command to add the out parameter.
name string The name of the parameter.
dbType NpgsqlDbType One of the values.
size int The maximum size of the data within the column.
return void

AddParameter() public method

Adds a new instance of a DbParameter object to the command.
public AddParameter ( DbCommand command, string name, NpgsqlDbType dbType, ParameterDirection direction, string sourceColumn, DataRowVersion sourceVersion, object value ) : void
command System.Data.Common.DbCommand The command to add the parameter.
name string The name of the parameter.
dbType NpgsqlDbType One of the values.
direction ParameterDirection One of the values.
sourceColumn string The name of the source column mapped to the DataSet and used for loading or returning the .
sourceVersion DataRowVersion One of the values.
value object The value of the parameter.
return void

AddParameter() public method

Adds a new instance of a DbParameter object to the command.
public AddParameter ( DbCommand command, string name, NpgsqlDbType dbType, int size, ParameterDirection direction, bool nullable, byte precision, byte scale, string sourceColumn, DataRowVersion sourceVersion, object value ) : void
command System.Data.Common.DbCommand The command to add the parameter.
name string The name of the parameter.
dbType NpgsqlDbType One of the values.
size int The maximum size of the data within the column.
direction ParameterDirection One of the values.
nullable bool A value indicating whether the parameter accepts (Nothing in Visual Basic) values.
precision byte The maximum number of digits used to represent the .
scale byte The number of decimal places to which is resolved.
sourceColumn string The name of the source column mapped to the DataSet and used for loading or returning the .
sourceVersion DataRowVersion One of the values.
value object The value of the parameter.
return void

BuildParameterName() public method

Builds a value parameter name for the current database.
public BuildParameterName ( string name ) : string
name string The name of the parameter.
return string

CheckIfNpgsqlCommand() public static method

Checks if a database command is a Npgsql command and converts.
public static CheckIfNpgsqlCommand ( DbCommand command ) : NpgsqlCommand
command System.Data.Common.DbCommand The command.
return Npgsql.NpgsqlCommand

ConfigureParameter() protected method

Configures a given DbParameter.
protected ConfigureParameter ( DbParameter param, string name, DbType dbType, int size, ParameterDirection direction, bool nullable, byte precision, byte scale, string sourceColumn, DataRowVersion sourceVersion, object value ) : void
param System.Data.Common.DbParameter The to configure.
name string The name of the parameter.
dbType DbType One of the values.
size int The maximum size of the data within the column.
direction ParameterDirection One of the values.
nullable bool A value indicating whether the parameter accepts (Nothing in Visual Basic) values.
precision byte The maximum number of digits used to represent the .
scale byte The number of decimal places to which is resolved.
sourceColumn string The name of the source column mapped to the DataSet and used for loading or returning the .
sourceVersion DataRowVersion One of the values.
value object The value of the parameter.
return void

CreateParameter() protected method

Adds a new instance of a DbParameter object.
protected CreateParameter ( string name, NpgsqlDbType dbType, int size, ParameterDirection direction, bool nullable, byte precision, byte scale, string sourceColumn, DataRowVersion sourceVersion, object value ) : DbParameter
name string The name of the parameter.
dbType NpgsqlDbType One of the values.
size int The maximum size of the data within the column.
direction ParameterDirection One of the values.
nullable bool A value indicating whether the parameter accepts (Nothing in Visual Basic) values.
precision byte The maximum number of digits used to represent the .
scale byte The number of decimal places to which is resolved.
sourceColumn string The name of the source column mapped to the DataSet and used for loading or returning the .
sourceVersion DataRowVersion One of the values.
value object The value of the parameter.
return System.Data.Common.DbParameter

ExecuteDataSet() public method

Executes the storedProcedureName with parameterValues as part of the transaction and returns the results in a new T:System.Data.DataSet within a transaction.
public ExecuteDataSet ( DbTransaction transaction, string storedProcedureName ) : DataSet
transaction System.Data.Common.DbTransaction The to execute the command within.
storedProcedureName string The stored procedure to execute.
return System.Data.DataSet

ExecuteDataSet() public method

Executes the storedProcedureName with parameterValues and returns the results in a new T:System.Data.DataSet.
public ExecuteDataSet ( string storedProcedureName ) : DataSet
storedProcedureName string The stored procedure to execute.
return System.Data.DataSet

ExecuteNonQuery() public method

Executes the storedProcedureName using the given parameterValues within a transaction and returns the number of rows affected.
public ExecuteNonQuery ( DbTransaction transaction, string storedProcedureName ) : int
transaction System.Data.Common.DbTransaction The to execute the command within.
storedProcedureName string The name of the stored procedure to execute.
return int

ExecuteNonQuery() public method

Executes the storedProcedureName using the given parameterValues and returns the number of rows affected.
public ExecuteNonQuery ( string storedProcedureName ) : int
storedProcedureName string The name of the stored procedure to execute.
return int

ExecuteReader() public method

Executes the storedProcedureName with the given parameterValues within the given transaction and returns an through which the result can be read. It is the responsibility of the caller to close the connection and reader when finished.
public ExecuteReader ( DbTransaction transaction, string storedProcedureName ) : IDataReader
transaction System.Data.Common.DbTransaction The to execute the command within.
storedProcedureName string The command that contains the query to execute.
return IDataReader

ExecuteReader() public method

Executes the storedProcedureName with the given parameterValues and returns an through which the result can be read. It is the responsibility of the caller to close the connection and reader when finished.
public ExecuteReader ( string storedProcedureName ) : IDataReader
storedProcedureName string The command that contains the query to execute.
return IDataReader

ExecuteScalar() public method

Executes the storedProcedureName with the given parameterValues within a transaction and returns the first column of the first row in the result set returned by the query. Extra columns or rows are ignored.
public ExecuteScalar ( DbTransaction transaction, string storedProcedureName ) : object
transaction System.Data.Common.DbTransaction The to execute the command within.
storedProcedureName string The stored procedure to execute.
return object

ExecuteScalar() public method

Executes the storedProcedureName with the given parameterValues and returns the first column of the first row in the result set returned by the query. Extra columns or rows are ignored.
public ExecuteScalar ( string storedProcedureName ) : object
storedProcedureName string The stored procedure to execute.
return object

NpgsqlDatabase() public method

생성자
public NpgsqlDatabase ( string connectionString ) : System
connectionString string
return System

SameNumberOfParametersAndValues() protected method

Determines if the number of parameters in the command matches the array of parameter values.
protected SameNumberOfParametersAndValues ( DbCommand command, object values ) : bool
command System.Data.Common.DbCommand The containing the parameters.
values object The array of parameter values.
return bool

UserParametersStartIndex() protected method

Returns the starting index for parameters in a command.
protected UserParametersStartIndex ( ) : int
return int