Class NpgsqlBatchCommand
Namespace: Npgsql
Assembly: Npgsql.dll
Syntax
public sealed class NpgsqlBatchCommand : DbBatchCommand
Constructors
| Improve this Doc View SourceNpgsqlBatchCommand()
Initializes a new NpgsqlBatchCommand.
Declaration
public NpgsqlBatchCommand()
NpgsqlBatchCommand(string)
Initializes a new NpgsqlBatchCommand.
Declaration
public NpgsqlBatchCommand(string commandText)
Parameters
Type | Name | Description |
---|---|---|
string | commandText | The text of the NpgsqlBatchCommand. |
Properties
| Improve this Doc View SourceAppendErrorBarrier
Appends an error barrier after this batch command. Defaults to the value of EnableErrorBarriers on the batch.
Declaration
public bool? AppendErrorBarrier { get; set; }
Property Value
Type | Description |
---|---|
bool? |
Remarks
By default, any exception in a command causes later commands in the batch to be skipped, and earlier commands to be rolled back. Appending an error barrier ensures that errors from this command (or previous ones) won't cause later commands to be skipped, and that errors from later commands won't cause this command (or previous ones) to be rolled back).
Note that if the batch is executed within an explicit transaction, the first error places the transaction in a failed state, causing all later commands to fail in any case. As a result, this option is useful mainly when there is no explicit transaction.
At the PostgreSQL wire protocol level, this corresponds to inserting a Sync message after this command, rather than grouping all the batch's commands behind a single terminating Sync.
Controlling error barriers on a command-by-command basis is an advanced feature, consider enabling error barriers for the entire batch via EnableErrorBarriers.
CanCreateParameter
Returns whether the CreateParameter() method is implemented.
Declaration
public bool CanCreateParameter { get; }
Property Value
Type | Description |
---|---|
bool |
CommandText
Declaration
public override string CommandText { get; set; }
Property Value
Type | Description |
---|---|
string |
Overrides
| Improve this Doc View SourceCommandType
Declaration
public override CommandType CommandType { get; set; }
Property Value
Type | Description |
---|---|
CommandType |
Overrides
| Improve this Doc View SourceDbParameterCollection
Declaration
protected override DbParameterCollection DbParameterCollection { get; }
Property Value
Type | Description |
---|---|
DbParameterCollection |
Overrides
| Improve this Doc View SourceOID
For an INSERT, the object ID of the inserted row if RecordsAffected is 1 and the target table has OIDs; otherwise 0.
Declaration
public uint OID { get; }
Property Value
Type | Description |
---|---|
uint |
Parameters
Declaration
public NpgsqlParameterCollection Parameters { get; }
Property Value
Type | Description |
---|---|
NpgsqlParameterCollection |
RecordsAffected
Declaration
public override int RecordsAffected { get; }
Property Value
Type | Description |
---|---|
int |
Overrides
| Improve this Doc View SourceRows
The number of rows affected or retrieved.
Declaration
public ulong Rows { get; }
Property Value
Type | Description |
---|---|
ulong |
Remarks
See the command tag in the CommandComplete message for the meaning of this value for each StatementType, https://www.postgresql.org/docs/current/static/protocol-message-formats.html
StatementType
Specifies the type of query, e.g. SELECT.
Declaration
public StatementType StatementType { get; }
Property Value
Type | Description |
---|---|
StatementType |
Methods
| Improve this Doc View SourceCreateParameter()
Creates a new instance of a NpgsqlParameter object.
Declaration
public NpgsqlParameter CreateParameter()
Returns
Type | Description |
---|---|
NpgsqlParameter | An NpgsqlParameter object. |
ToString()
Returns the CommandText.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
string |