Search Results for

    Show / Hide Table of Contents

    Class NpgsqlBatchCommand

    Inheritance
    object
    DbBatchCommand
    NpgsqlBatchCommand
    Namespace: Npgsql
    Assembly: Npgsql.dll
    Syntax
    public sealed class NpgsqlBatchCommand : DbBatchCommand

    Constructors

    | Improve this Doc View Source

    NpgsqlBatchCommand()

    Initializes a new NpgsqlBatchCommand.

    Declaration
    public NpgsqlBatchCommand()
    | Improve this Doc View Source

    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 Source

    AppendErrorBarrier

    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.

    | Improve this Doc View Source

    CanCreateParameter

    Returns whether the CreateParameter() method is implemented.

    Declaration
    public bool CanCreateParameter { get; }
    Property Value
    Type Description
    bool
    | Improve this Doc View Source

    CommandText

    Declaration
    public override string CommandText { get; set; }
    Property Value
    Type Description
    string
    Overrides
    DbBatchCommand.CommandText
    | Improve this Doc View Source

    CommandType

    Declaration
    public override CommandType CommandType { get; set; }
    Property Value
    Type Description
    CommandType
    Overrides
    DbBatchCommand.CommandType
    | Improve this Doc View Source

    DbParameterCollection

    Declaration
    protected override DbParameterCollection DbParameterCollection { get; }
    Property Value
    Type Description
    DbParameterCollection
    Overrides
    DbBatchCommand.DbParameterCollection
    | Improve this Doc View Source

    OID

    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
    | Improve this Doc View Source

    Parameters

    Declaration
    public NpgsqlParameterCollection Parameters { get; }
    Property Value
    Type Description
    NpgsqlParameterCollection
    | Improve this Doc View Source

    RecordsAffected

    Declaration
    public override int RecordsAffected { get; }
    Property Value
    Type Description
    int
    Overrides
    DbBatchCommand.RecordsAffected
    | Improve this Doc View Source

    Rows

    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

    | Improve this Doc View Source

    StatementType

    Specifies the type of query, e.g. SELECT.

    Declaration
    public StatementType StatementType { get; }
    Property Value
    Type Description
    StatementType

    Methods

    | Improve this Doc View Source

    CreateParameter()

    Creates a new instance of a NpgsqlParameter object.

    Declaration
    public NpgsqlParameter CreateParameter()
    Returns
    Type Description
    NpgsqlParameter

    An NpgsqlParameter object.

    | Improve this Doc View Source

    ToString()

    Returns the CommandText.

    Declaration
    public override string ToString()
    Returns
    Type Description
    string
    • Improve this Doc
    • View Source
    In This Article
    Back to top © Copyright 2023 The Npgsql Development Team