Search Results for

    Show / Hide Table of Contents

    Class NpgsqlBinaryExporter

    Provides an API for a binary COPY TO operation, a high-performance data export mechanism from a PostgreSQL table. Initiated by BeginBinaryExport(string)

    Inheritance
    object
    NpgsqlBinaryExporter
    Implements
    IDisposable
    IAsyncDisposable
    Namespace: Npgsql
    Assembly: Npgsql.dll
    Syntax
    public sealed class NpgsqlBinaryExporter : IDisposable, IAsyncDisposable

    Properties

    | Improve this Doc View Source

    IsNull

    Returns whether the current column is null.

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

    Timeout

    Current timeout

    Declaration
    public TimeSpan Timeout { set; }
    Property Value
    Type Description
    TimeSpan

    Methods

    | Improve this Doc View Source

    Cancel()

    Cancels an ongoing export.

    Declaration
    public void Cancel()
    | Improve this Doc View Source

    CancelAsync()

    Async cancels an ongoing export.

    Declaration
    public Task CancelAsync()
    Returns
    Type Description
    Task
    | Improve this Doc View Source

    Dispose()

    Completes that binary export and sets the connection back to idle state

    Declaration
    public void Dispose()
    | Improve this Doc View Source

    DisposeAsync()

    Async completes that binary export and sets the connection back to idle state

    Declaration
    public ValueTask DisposeAsync()
    Returns
    Type Description
    ValueTask
    | Improve this Doc View Source

    Read<T>()

    Reads the current column, returns its value and moves ahead to the next column. If the column is null an exception is thrown.

    Declaration
    public T Read<T>()
    Returns
    Type Description
    T

    The value of the column

    Type Parameters
    Name Description
    T

    The type of the column to be read. This must correspond to the actual type or data corruption will occur. If in doubt, use Read<T>(NpgsqlDbType) to manually specify the type.

    | Improve this Doc View Source

    Read<T>(NpgsqlDbType)

    Reads the current column, returns its value according to type and moves ahead to the next column. If the column is null an exception is thrown.

    Declaration
    public T Read<T>(NpgsqlDbType type)
    Parameters
    Type Name Description
    NpgsqlDbType type

    In some cases T isn't enough to infer the data type coming in from the database. This parameter can be used to unambiguously specify the type. An example is the JSONB type, for which T will be a simple string but for which type must be specified as Jsonb.

    Returns
    Type Description
    T

    The value of the column

    Type Parameters
    Name Description
    T

    The .NET type of the column to be read.

    | Improve this Doc View Source

    ReadAsync<T>(CancellationToken)

    Reads the current column, returns its value and moves ahead to the next column. If the column is null an exception is thrown.

    Declaration
    public ValueTask<T> ReadAsync<T>(CancellationToken cancellationToken = null)
    Parameters
    Type Name Description
    CancellationToken cancellationToken
    Returns
    Type Description
    ValueTask<><T>

    The value of the column

    Type Parameters
    Name Description
    T

    The type of the column to be read. This must correspond to the actual type or data corruption will occur. If in doubt, use Read<T>(NpgsqlDbType) to manually specify the type.

    | Improve this Doc View Source

    ReadAsync<T>(NpgsqlDbType, CancellationToken)

    Reads the current column, returns its value according to type and moves ahead to the next column. If the column is null an exception is thrown.

    Declaration
    public ValueTask<T> ReadAsync<T>(NpgsqlDbType type, CancellationToken cancellationToken = null)
    Parameters
    Type Name Description
    NpgsqlDbType type

    In some cases T isn't enough to infer the data type coming in from the database. This parameter can be used to unambiguously specify the type. An example is the JSONB type, for which T will be a simple string but for which type must be specified as Jsonb.

    CancellationToken cancellationToken

    An optional token to cancel the asynchronous operation. The default value is .

    Returns
    Type Description
    ValueTask<><T>

    The value of the column

    Type Parameters
    Name Description
    T

    The .NET type of the column to be read.

    | Improve this Doc View Source

    Skip()

    Skips the current column without interpreting its value.

    Declaration
    public void Skip()
    | Improve this Doc View Source

    SkipAsync(CancellationToken)

    Skips the current column without interpreting its value.

    Declaration
    public Task SkipAsync(CancellationToken cancellationToken = null)
    Parameters
    Type Name Description
    CancellationToken cancellationToken
    Returns
    Type Description
    Task
    | Improve this Doc View Source

    StartRow()

    Starts reading a single row, must be invoked before reading any columns.

    Declaration
    public int StartRow()
    Returns
    Type Description
    int

    The number of columns in the row. -1 if there are no further rows. Note: This will currently be the same value for all rows, but this may change in the future.

    | Improve this Doc View Source

    StartRowAsync(CancellationToken)

    Starts reading a single row, must be invoked before reading any columns.

    Declaration
    public ValueTask<int> StartRowAsync(CancellationToken cancellationToken = null)
    Parameters
    Type Name Description
    CancellationToken cancellationToken
    Returns
    Type Description
    ValueTask<><int>

    The number of columns in the row. -1 if there are no further rows. Note: This will currently be the same value for all rows, but this may change in the future.

    Implements

    IDisposable
    IAsyncDisposable
    • Improve this Doc
    • View Source
    In This Article
    Back to top © Copyright 2023 The Npgsql Development Team