C# Class Npgsql.NpgsqlCommandBuilder

Inheritance: System.ComponentModel.Component
Afficher le fichier Open project: npgsql/npgsql Class Usage Examples

Méthodes publiques

Méthode Description
DeriveParameters ( NpgsqlCommand command ) : void

This method is reponsible to derive the command parameter list with values obtained from function definition. It clears the Parameters collection of command. Also, if there is any parameter type which is not supported by Npgsql, an InvalidOperationException will be thrown. Parameters name will be parameter1, parameter2, ...

GetDeleteCommand ( ) : NpgsqlCommand

Gets the automatically generated System.Data.Common.DbCommand object required to perform deletions at the data source.

GetDeleteCommand ( bool useColumnsForParameterNames ) : NpgsqlCommand

Gets the automatically generated NpgsqlCommand object required to perform deletions at the data source, optionally using columns for parameter names.

GetInsertCommand ( ) : NpgsqlCommand

Gets the automatically generated NpgsqlCommand object required to perform insertions at the data source.

GetInsertCommand ( bool useColumnsForParameterNames ) : NpgsqlCommand

Gets the automatically generated NpgsqlCommand object required to perform insertions at the data source, optionally using columns for parameter names.

GetUpdateCommand ( ) : NpgsqlCommand

Gets the automatically generated System.Data.Common.DbCommand object required to perform updates at the data source.

GetUpdateCommand ( bool useColumnsForParameterNames ) : NpgsqlCommand

Gets the automatically generated NpgsqlCommand object required to perform updates at the data source, optionally using columns for parameter names.

NpgsqlCommandBuilder ( ) : System

Initializes a new instance of the NpgsqlCommandBuilder class.

NpgsqlCommandBuilder ( Npgsql.NpgsqlDataAdapter adapter ) : System

Initializes a new instance of the NpgsqlCommandBuilder class.

QuoteIdentifier ( string unquotedIdentifier ) : string

Given an unquoted identifier in the correct catalog case, returns the correct quoted form of that identifier, including properly escaping any embedded quotes in the identifier.

UnquoteIdentifier ( string quotedIdentifier ) : string

Given a quoted identifier, returns the correct unquoted form of that identifier, including properly un-escaping any embedded quotes in the identifier.

Méthodes protégées

Méthode Description
ApplyParameterInfo ( DbParameter p, DataRow row, System statementType, bool whereClause ) : void

Applies the parameter information.

GetParameterName ( int parameterOrdinal ) : string

Returns the name of the specified parameter in the format of @p#.

GetParameterName ( string parameterName ) : string

Returns the full parameter name, given the partial parameter name.

GetParameterPlaceholder ( int parameterOrdinal ) : string

Returns the placeholder for the parameter in the associated SQL statement.

SetRowUpdatingHandler ( DbDataAdapter adapter ) : void

Registers the T:NpgsqlCommandBuilder to handle the E:NpgsqlDataAdapter.RowUpdating event for a T:NpgsqlDataAdapter.

Private Methods

Méthode Description
DoDeriveParameters ( NpgsqlCommand command ) : void
RowUpdatingHandler ( object sender, Npgsql.NpgsqlRowUpdatingEventArgs e ) : void

Adds an event handler for the NpgsqlDataAdapter.RowUpdating event.

Method Details

ApplyParameterInfo() protected méthode

Applies the parameter information.
protected ApplyParameterInfo ( DbParameter p, DataRow row, System statementType, bool whereClause ) : void
p System.Data.Common.DbParameter The parameter.
row System.Data.DataRow The row.
statementType System Type of the statement.
whereClause bool if set to true [where clause].
Résultat void

DeriveParameters() public static méthode

This method is reponsible to derive the command parameter list with values obtained from function definition. It clears the Parameters collection of command. Also, if there is any parameter type which is not supported by Npgsql, an InvalidOperationException will be thrown. Parameters name will be parameter1, parameter2, ...
public static DeriveParameters ( NpgsqlCommand command ) : void
command NpgsqlCommand NpgsqlCommand whose function parameters will be obtained.
Résultat void

GetDeleteCommand() public méthode

Gets the automatically generated System.Data.Common.DbCommand object required to perform deletions at the data source.
public GetDeleteCommand ( ) : NpgsqlCommand
Résultat NpgsqlCommand

GetDeleteCommand() public méthode

Gets the automatically generated NpgsqlCommand object required to perform deletions at the data source, optionally using columns for parameter names.
public GetDeleteCommand ( bool useColumnsForParameterNames ) : NpgsqlCommand
useColumnsForParameterNames bool /// If true, generate parameter names matching column names, if possible. /// If false, generate @p1, @p2, and so on. ///
Résultat NpgsqlCommand

GetInsertCommand() public méthode

Gets the automatically generated NpgsqlCommand object required to perform insertions at the data source.
public GetInsertCommand ( ) : NpgsqlCommand
Résultat NpgsqlCommand

GetInsertCommand() public méthode

Gets the automatically generated NpgsqlCommand object required to perform insertions at the data source, optionally using columns for parameter names.
public GetInsertCommand ( bool useColumnsForParameterNames ) : NpgsqlCommand
useColumnsForParameterNames bool /// If true, generate parameter names matching column names, if possible. /// If false, generate @p1, @p2, and so on. ///
Résultat NpgsqlCommand

GetParameterName() protected méthode

Returns the name of the specified parameter in the format of @p#.
protected GetParameterName ( int parameterOrdinal ) : string
parameterOrdinal int The number to be included as part of the parameter's name..
Résultat string

GetParameterName() protected méthode

Returns the full parameter name, given the partial parameter name.
protected GetParameterName ( string parameterName ) : string
parameterName string The partial name of the parameter.
Résultat string

GetParameterPlaceholder() protected méthode

Returns the placeholder for the parameter in the associated SQL statement.
protected GetParameterPlaceholder ( int parameterOrdinal ) : string
parameterOrdinal int The number to be included as part of the parameter's name.
Résultat string

GetUpdateCommand() public méthode

Gets the automatically generated System.Data.Common.DbCommand object required to perform updates at the data source.
public GetUpdateCommand ( ) : NpgsqlCommand
Résultat NpgsqlCommand

GetUpdateCommand() public méthode

Gets the automatically generated NpgsqlCommand object required to perform updates at the data source, optionally using columns for parameter names.
public GetUpdateCommand ( bool useColumnsForParameterNames ) : NpgsqlCommand
useColumnsForParameterNames bool /// If true, generate parameter names matching column names, if possible. /// If false, generate @p1, @p2, and so on. ///
Résultat NpgsqlCommand

NpgsqlCommandBuilder() public méthode

Initializes a new instance of the NpgsqlCommandBuilder class.
public NpgsqlCommandBuilder ( ) : System
Résultat System

NpgsqlCommandBuilder() public méthode

Initializes a new instance of the NpgsqlCommandBuilder class.
public NpgsqlCommandBuilder ( Npgsql.NpgsqlDataAdapter adapter ) : System
adapter Npgsql.NpgsqlDataAdapter The adapter.
Résultat System

QuoteIdentifier() public méthode

Given an unquoted identifier in the correct catalog case, returns the correct quoted form of that identifier, including properly escaping any embedded quotes in the identifier.
Unquoted identifier parameter cannot be null
public QuoteIdentifier ( string unquotedIdentifier ) : string
unquotedIdentifier string The original unquoted identifier.
Résultat string

SetRowUpdatingHandler() protected méthode

Registers the T:NpgsqlCommandBuilder to handle the E:NpgsqlDataAdapter.RowUpdating event for a T:NpgsqlDataAdapter.
protected SetRowUpdatingHandler ( DbDataAdapter adapter ) : void
adapter System.Data.Common.DbDataAdapter The to be used for the update.
Résultat void

UnquoteIdentifier() public méthode

Given a quoted identifier, returns the correct unquoted form of that identifier, including properly un-escaping any embedded quotes in the identifier.
Quoted identifier parameter cannot be null
public UnquoteIdentifier ( string quotedIdentifier ) : string
quotedIdentifier string The identifier that will have its embedded quotes removed.
Résultat string