C# Class Npgsql.NpgsqlCommand

Represents a SQL statement or function (stored procedure) to execute against a PostgreSQL database. This class cannot be inherited.
Inheritance: System.Data.Common.DbCommand, ICloneable
Afficher le fichier Open project: undeadlabs/Npgsql Class Usage Examples

Private Properties

Свойство Type Description
AddFunctionColumnListSupport void
AppendCommandReplacingParameterValues void
AppendParameterPlaceHolder void
AppendParameterPlaceHolders void
AppendParameterValue void
AppendParameterValues void
BindParameters void
BuildParameterNameCharacterTable System.Array
CheckConnectionState void
CheckFunctionNeedsColumnDefinitionList System.Boolean
ClearPoolAndCreateException NpgsqlException
ExecuteBlind void
ExecuteBlind void
ExecuteBlind void
ExecuteSetStatementTimeoutBlind void
GetCommandText byte[]
GetCommandText byte[]
GetDistinctTrimmedCommands StringChunk[]
GetExecuteCommandText byte[]
GetReader ForwardsOnlyDataReader
ICloneable Object
IsParamNameChar bool
NpgsqlCommand System
NpgsqlCommand System
PrepareInternal void
SetCommandTimeout void
UnPrepare void

Méthodes publiques

Méthode Description
Cancel ( ) : void

Attempts to cancel the execution of a NpgsqlCommand.

This Method isn't implemented yet.

Clone ( ) : NpgsqlCommand

Create a new command based on this one.

CreateParameter ( ) : Npgsql.NpgsqlParameter

Creates a new instance of a NpgsqlParameter object.

ExecuteNonQuery ( ) : Int32

Executes a SQL statement against the connection and returns the number of rows affected.

ExecuteReader ( ) : Npgsql.NpgsqlDataReader

Sends the CommandText to the Connection and builds a NpgsqlDataReader.

ExecuteReader ( CommandBehavior cb ) : Npgsql.NpgsqlDataReader

Sends the CommandText to the Connection and builds a NpgsqlDataReader using one of the CommandBehavior values.

Currently the CommandBehavior parameter is ignored.

ExecuteScalar ( ) : Object

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

NpgsqlCommand ( String cmdText ) : System

Initializes a new instance of the NpgsqlCommand class with the text of the query.

NpgsqlCommand ( String cmdText, NpgsqlConnection connection ) : System

Initializes a new instance of the NpgsqlCommand class with the text of the query and a NpgsqlConnection.

NpgsqlCommand ( String cmdText, NpgsqlConnection connection, NpgsqlTransaction transaction ) : System

Initializes a new instance of the NpgsqlCommand class with the text of the query, a NpgsqlConnection, and the NpgsqlTransaction.

Prepare ( ) : void

Creates a prepared version of the command on a PostgreSQL server.

Méthodes protégées

Méthode Description
CreateDbParameter ( ) : DbParameter

Creates a new instance of an DbParameter object.

ExecuteDbDataReader ( CommandBehavior behavior ) : System.Data.Common.DbDataReader

Sends the CommandText to the Connection and builds a NpgsqlDataReader using one of the CommandBehavior values.

Private Methods

Méthode Description
AddFunctionColumnListSupport ( Stream st ) : void
AppendCommandReplacingParameterValues ( Stream dest, string src, int begin, int length, bool prepare, bool forExtendedQuery ) : void

Append a region of a source command text to an output command, performing parameter token substitutions.

AppendParameterPlaceHolder ( Stream dest, Npgsql.NpgsqlParameter parameter, int paramNumber ) : void
AppendParameterPlaceHolders ( Stream dest ) : void
AppendParameterValue ( Stream dest, Npgsql.NpgsqlParameter parameter ) : void
AppendParameterValues ( Stream dest ) : void
BindParameters ( ) : void

This method binds the parameters from parameters collection to the bind message.

BuildParameterNameCharacterTable ( ) : Array
CheckConnectionState ( ) : void

This method checks the connection state to see if the connection is set or it is open. If one of this conditions is not met, throws an InvalidOperationException

CheckFunctionNeedsColumnDefinitionList ( ) : System.Boolean
ClearPoolAndCreateException ( Exception e ) : NpgsqlException
ExecuteBlind ( NpgsqlConnector connector, NpgsqlQuery query, int timeout ) : void
ExecuteBlind ( NpgsqlConnector connector, byte command, int timeout = 20 ) : void

Internal query shortcut for use in cases where the number of affected rows is of no interest.

ExecuteBlind ( NpgsqlConnector connector, string command, int timeout = 20 ) : void

Internal query shortcut for use in cases where the number of affected rows is of no interest.

ExecuteSetStatementTimeoutBlind ( NpgsqlConnector connector, int timeout ) : void

Special adaptation of ExecuteBlind() that sets statement_timeout. This exists to prevent Connector.SetBackendCommandTimeout() from calling Command.ExecuteBlind(), which will cause an endless recursive loop.

GetCommandText ( ) : byte[]

This method substitutes the Parameters, if exist, in the command to their actual values. The parameter name format is :ParameterName.

GetCommandText ( bool prepare, bool forExtendQuery ) : byte[]

Process this.commandText, trimming each distinct command and substituting paramater tokens.

GetDistinctTrimmedCommands ( string src ) : StringChunk[]

Find the beginning and end of each distinct SQL command and produce a list of descriptors, one for each command. Commands described are trimmed of leading and trailing white space and their terminating semi-colons.

GetExecuteCommandText ( ) : byte[]
GetReader ( CommandBehavior cb ) : ForwardsOnlyDataReader
ICloneable ( ) : Object

Create a new command based on this one.

IsParamNameChar ( char ch ) : bool
NpgsqlCommand ( ) : System
NpgsqlCommand ( String cmdText, NpgsqlConnector connector, int CommandTimeout = 20 ) : System

Used to execute internal commands.

PrepareInternal ( ) : void
SetCommandTimeout ( ) : void

Releases the resources used by the NpgsqlCommand.

UnPrepare ( ) : void

Method Details

Cancel() public méthode

Attempts to cancel the execution of a NpgsqlCommand.
This Method isn't implemented yet.
public Cancel ( ) : void
Résultat void

Clone() public méthode

Create a new command based on this one.
public Clone ( ) : NpgsqlCommand
Résultat NpgsqlCommand

CreateDbParameter() protected méthode

Creates a new instance of an DbParameter object.
protected CreateDbParameter ( ) : DbParameter
Résultat System.Data.Common.DbParameter

CreateParameter() public méthode

Creates a new instance of a NpgsqlParameter object.
public CreateParameter ( ) : Npgsql.NpgsqlParameter
Résultat Npgsql.NpgsqlParameter

ExecuteDbDataReader() protected méthode

Sends the CommandText to the Connection and builds a NpgsqlDataReader using one of the CommandBehavior values.
protected ExecuteDbDataReader ( CommandBehavior behavior ) : System.Data.Common.DbDataReader
behavior CommandBehavior One of the CommandBehavior values.
Résultat System.Data.Common.DbDataReader

ExecuteNonQuery() public méthode

Executes a SQL statement against the connection and returns the number of rows affected.
public ExecuteNonQuery ( ) : Int32
Résultat System.Int32

ExecuteReader() public méthode

Sends the CommandText to the Connection and builds a NpgsqlDataReader.
public ExecuteReader ( ) : Npgsql.NpgsqlDataReader
Résultat Npgsql.NpgsqlDataReader

ExecuteReader() public méthode

Sends the CommandText to the Connection and builds a NpgsqlDataReader using one of the CommandBehavior values.
Currently the CommandBehavior parameter is ignored.
public ExecuteReader ( CommandBehavior cb ) : Npgsql.NpgsqlDataReader
cb CommandBehavior One of the CommandBehavior values.
Résultat Npgsql.NpgsqlDataReader

ExecuteScalar() public méthode

Executes the query, 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 ( ) : Object
Résultat Object

NpgsqlCommand() public méthode

Initializes a new instance of the NpgsqlCommand class with the text of the query.
public NpgsqlCommand ( String cmdText ) : System
cmdText String The text of the query.
Résultat System

NpgsqlCommand() public méthode

Initializes a new instance of the NpgsqlCommand class with the text of the query and a NpgsqlConnection.
public NpgsqlCommand ( String cmdText, NpgsqlConnection connection ) : System
cmdText String The text of the query.
connection NpgsqlConnection A NpgsqlConnection that represents the connection to a PostgreSQL server.
Résultat System

NpgsqlCommand() public méthode

Initializes a new instance of the NpgsqlCommand class with the text of the query, a NpgsqlConnection, and the NpgsqlTransaction.
public NpgsqlCommand ( String cmdText, NpgsqlConnection connection, NpgsqlTransaction transaction ) : System
cmdText String The text of the query.
connection NpgsqlConnection A NpgsqlConnection that represents the connection to a PostgreSQL server.
transaction NpgsqlTransaction The NpgsqlTransaction in which the NpgsqlCommand executes.
Résultat System

Prepare() public méthode

Creates a prepared version of the command on a PostgreSQL server.
public Prepare ( ) : void
Résultat void