Search Results for

    Show / Hide Table of Contents

    Class Int32Handler

    A type handler for the PostgreSQL integer data type.

    Inheritance
    Object
    NpgsqlTypeHandler
    NpgsqlTypeHandler<Int32>
    NpgsqlSimpleTypeHandler<Int32>
    Int32Handler
    Implements
    INpgsqlTypeHandler<Int32>
    INpgsqlSimpleTypeHandler<Int32>
    INpgsqlSimpleTypeHandler<Byte>
    INpgsqlSimpleTypeHandler<Int16>
    INpgsqlSimpleTypeHandler<Int64>
    INpgsqlSimpleTypeHandler<Single>
    INpgsqlSimpleTypeHandler<Double>
    INpgsqlSimpleTypeHandler<Decimal>
    Inherited Members
    NpgsqlSimpleTypeHandler<Int32>.Read(NpgsqlReadBuffer, Int32, Boolean, FieldDescription)
    NpgsqlSimpleTypeHandler<Int32>.Write(Int32, NpgsqlWriteBuffer, NpgsqlLengthCache, NpgsqlParameter, Boolean, CancellationToken)
    NpgsqlSimpleTypeHandler<Int32>.ValidateAndGetLength(Int32, NpgsqlLengthCache, NpgsqlParameter)
    NpgsqlTypeHandler<Int32>.ReadAsObject(NpgsqlReadBuffer, Int32, Boolean, FieldDescription)
    NpgsqlTypeHandler<Int32>.GetFieldType(FieldDescription)
    NpgsqlTypeHandler<Int32>.GetProviderSpecificFieldType(FieldDescription)
    NpgsqlTypeHandler<Int32>.CreateArrayHandler(PostgresArrayType, ArrayNullabilityMode)
    NpgsqlTypeHandler<Int32>.CreateRangeHandler(PostgresType)
    NpgsqlTypeHandler<Int32>.CreateMultirangeHandler(PostgresMultirangeType)
    NpgsqlTypeHandler.PostgresType
    NpgsqlTypeHandler.Read<TAny>(NpgsqlReadBuffer, Int32, Boolean, FieldDescription)
    NpgsqlTypeHandler.Read<TAny>(NpgsqlReadBuffer, Int32, FieldDescription)
    NpgsqlTypeHandler.ReadCustom<TAny>(NpgsqlReadBuffer, Int32, Boolean, FieldDescription)
    NpgsqlTypeHandler.ValidateAndGetLength<TAny>(TAny, NpgsqlLengthCache, NpgsqlParameter)
    NpgsqlTypeHandler.ValidateAndGetLengthCustom<TAny>(TAny, NpgsqlLengthCache, NpgsqlParameter)
    NpgsqlTypeHandler.WriteWithLength<TAny>(TAny, NpgsqlWriteBuffer, NpgsqlLengthCache, NpgsqlParameter, Boolean, CancellationToken)
    NpgsqlTypeHandler.WriteWithLengthCustom<TAny>(TAny, NpgsqlWriteBuffer, NpgsqlLengthCache, NpgsqlParameter, Boolean, CancellationToken)
    NpgsqlTypeHandler.ValidateObjectAndGetLength(Object, NpgsqlLengthCache, NpgsqlParameter)
    NpgsqlTypeHandler.WriteObjectWithLength(Object, NpgsqlWriteBuffer, NpgsqlLengthCache, NpgsqlParameter, Boolean, CancellationToken)
    NpgsqlTypeHandler.CreateConversionButNoParamException(Type)
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Object.ReferenceEquals(Object, Object)
    Object.ToString()
    Namespace: Npgsql.Internal.TypeHandlers.NumericHandlers
    Assembly: Npgsql.dll
    Syntax
    public class Int32Handler : NpgsqlSimpleTypeHandler<int>, INpgsqlTypeHandler<int>, INpgsqlSimpleTypeHandler<int>, INpgsqlSimpleTypeHandler<byte>, INpgsqlSimpleTypeHandler<short>, INpgsqlSimpleTypeHandler<long>, INpgsqlSimpleTypeHandler<float>, INpgsqlSimpleTypeHandler<double>, INpgsqlSimpleTypeHandler<decimal>
    Remarks

    See https://www.postgresql.org/docs/current/static/datatype-numeric.html.

    The type handler API allows customizing Npgsql's behavior in powerful ways. However, although it is public, it should be considered somewhat unstable, and may change in breaking ways, including in non-major releases. Use it at your own risk.

    Constructors

    Int32Handler(PostgresType)

    Declaration
    public Int32Handler(PostgresType pgType)
    Parameters
    Type Name Description
    PostgresType pgType

    Methods

    Read(NpgsqlReadBuffer, Int32, FieldDescription)

    Declaration
    public override int Read(NpgsqlReadBuffer buf, int len, FieldDescription fieldDescription = null)
    Parameters
    Type Name Description
    NpgsqlReadBuffer buf
    Int32 len
    FieldDescription fieldDescription
    Returns
    Type Description
    Int32
    Overrides
    Npgsql.Internal.TypeHandling.NpgsqlSimpleTypeHandler<System.Int32>.Read(Npgsql.Internal.NpgsqlReadBuffer, System.Int32, Npgsql.BackendMessages.FieldDescription)

    ValidateAndGetLength(Byte, NpgsqlParameter)

    Responsible for validating that a value represents a value of the correct and which can be written for PostgreSQL - if the value cannot be written for any reason, an exception should be thrown. Also returns the byte length needed to write the value.

    Declaration
    public int ValidateAndGetLength(byte value, NpgsqlParameter parameter)
    Parameters
    Type Name Description
    Byte value
    NpgsqlParameter parameter

    The NpgsqlParameter instance where this value resides. Can be used to access additional information relevant to the write process (e.g. Size).

    Returns
    Type Description
    Int32

    The number of bytes required to write the value.

    ValidateAndGetLength(Decimal, NpgsqlParameter)

    Responsible for validating that a value represents a value of the correct and which can be written for PostgreSQL - if the value cannot be written for any reason, an exception should be thrown. Also returns the byte length needed to write the value.

    Declaration
    public int ValidateAndGetLength(decimal value, NpgsqlParameter parameter)
    Parameters
    Type Name Description
    Decimal value
    NpgsqlParameter parameter

    The NpgsqlParameter instance where this value resides. Can be used to access additional information relevant to the write process (e.g. Size).

    Returns
    Type Description
    Int32

    The number of bytes required to write the value.

    ValidateAndGetLength(Double, NpgsqlParameter)

    Responsible for validating that a value represents a value of the correct and which can be written for PostgreSQL - if the value cannot be written for any reason, an exception should be thrown. Also returns the byte length needed to write the value.

    Declaration
    public int ValidateAndGetLength(double value, NpgsqlParameter parameter)
    Parameters
    Type Name Description
    Double value
    NpgsqlParameter parameter

    The NpgsqlParameter instance where this value resides. Can be used to access additional information relevant to the write process (e.g. Size).

    Returns
    Type Description
    Int32

    The number of bytes required to write the value.

    ValidateAndGetLength(Int16, NpgsqlParameter)

    Responsible for validating that a value represents a value of the correct and which can be written for PostgreSQL - if the value cannot be written for any reason, an exception should be thrown. Also returns the byte length needed to write the value.

    Declaration
    public int ValidateAndGetLength(short value, NpgsqlParameter parameter)
    Parameters
    Type Name Description
    Int16 value
    NpgsqlParameter parameter

    The NpgsqlParameter instance where this value resides. Can be used to access additional information relevant to the write process (e.g. Size).

    Returns
    Type Description
    Int32

    The number of bytes required to write the value.

    ValidateAndGetLength(Int32, NpgsqlParameter)

    Responsible for validating that a value represents a value of the correct and which can be written for PostgreSQL - if the value cannot be written for any reason, an exception shold be thrown. Also returns the byte length needed to write the value.

    Declaration
    public override int ValidateAndGetLength(int value, NpgsqlParameter parameter)
    Parameters
    Type Name Description
    Int32 value
    NpgsqlParameter parameter

    The NpgsqlParameter instance where this value resides. Can be used to access additional information relevant to the write process (e.g. Size).

    Returns
    Type Description
    Int32

    The number of bytes required to write the value.

    Overrides
    Npgsql.Internal.TypeHandling.NpgsqlSimpleTypeHandler<System.Int32>.ValidateAndGetLength(System.Int32, Npgsql.NpgsqlParameter)

    ValidateAndGetLength(Int64, NpgsqlParameter)

    Responsible for validating that a value represents a value of the correct and which can be written for PostgreSQL - if the value cannot be written for any reason, an exception should be thrown. Also returns the byte length needed to write the value.

    Declaration
    public int ValidateAndGetLength(long value, NpgsqlParameter parameter)
    Parameters
    Type Name Description
    Int64 value
    NpgsqlParameter parameter

    The NpgsqlParameter instance where this value resides. Can be used to access additional information relevant to the write process (e.g. Size).

    Returns
    Type Description
    Int32

    The number of bytes required to write the value.

    ValidateAndGetLength(Single, NpgsqlParameter)

    Responsible for validating that a value represents a value of the correct and which can be written for PostgreSQL - if the value cannot be written for any reason, an exception should be thrown. Also returns the byte length needed to write the value.

    Declaration
    public int ValidateAndGetLength(float value, NpgsqlParameter parameter)
    Parameters
    Type Name Description
    Single value
    NpgsqlParameter parameter

    The NpgsqlParameter instance where this value resides. Can be used to access additional information relevant to the write process (e.g. Size).

    Returns
    Type Description
    Int32

    The number of bytes required to write the value.

    Write(Byte, NpgsqlWriteBuffer, NpgsqlParameter)

    Writes a value to the provided buffer, with the assumption that there is enough space in the buffer (no I/O will occur). The Npgsql core will have taken care of that.

    Declaration
    public void Write(byte value, NpgsqlWriteBuffer buf, NpgsqlParameter parameter)
    Parameters
    Type Name Description
    Byte value
    NpgsqlWriteBuffer buf

    The buffer to which to write.

    NpgsqlParameter parameter

    The NpgsqlParameter instance where this value resides. Can be used to access additional information relevant to the write process (e.g. Size).

    Write(Decimal, NpgsqlWriteBuffer, NpgsqlParameter)

    Writes a value to the provided buffer, with the assumption that there is enough space in the buffer (no I/O will occur). The Npgsql core will have taken care of that.

    Declaration
    public void Write(decimal value, NpgsqlWriteBuffer buf, NpgsqlParameter parameter)
    Parameters
    Type Name Description
    Decimal value
    NpgsqlWriteBuffer buf

    The buffer to which to write.

    NpgsqlParameter parameter

    The NpgsqlParameter instance where this value resides. Can be used to access additional information relevant to the write process (e.g. Size).

    Write(Double, NpgsqlWriteBuffer, NpgsqlParameter)

    Writes a value to the provided buffer, with the assumption that there is enough space in the buffer (no I/O will occur). The Npgsql core will have taken care of that.

    Declaration
    public void Write(double value, NpgsqlWriteBuffer buf, NpgsqlParameter parameter)
    Parameters
    Type Name Description
    Double value
    NpgsqlWriteBuffer buf

    The buffer to which to write.

    NpgsqlParameter parameter

    The NpgsqlParameter instance where this value resides. Can be used to access additional information relevant to the write process (e.g. Size).

    Write(Int16, NpgsqlWriteBuffer, NpgsqlParameter)

    Writes a value to the provided buffer, with the assumption that there is enough space in the buffer (no I/O will occur). The Npgsql core will have taken care of that.

    Declaration
    public void Write(short value, NpgsqlWriteBuffer buf, NpgsqlParameter parameter)
    Parameters
    Type Name Description
    Int16 value
    NpgsqlWriteBuffer buf

    The buffer to which to write.

    NpgsqlParameter parameter

    The NpgsqlParameter instance where this value resides. Can be used to access additional information relevant to the write process (e.g. Size).

    Write(Int32, NpgsqlWriteBuffer, NpgsqlParameter)

    Writes a value to the provided buffer, with the assumption that there is enough space in the buffer (no I/O will occur). The Npgsql core will have taken care of that.

    Declaration
    public override void Write(int value, NpgsqlWriteBuffer buf, NpgsqlParameter parameter)
    Parameters
    Type Name Description
    Int32 value
    NpgsqlWriteBuffer buf

    The buffer to which to write.

    NpgsqlParameter parameter

    The NpgsqlParameter instance where this value resides. Can be used to access additional information relevant to the write process (e.g. Size).

    Overrides
    Npgsql.Internal.TypeHandling.NpgsqlSimpleTypeHandler<System.Int32>.Write(System.Int32, Npgsql.Internal.NpgsqlWriteBuffer, Npgsql.NpgsqlParameter)

    Write(Int64, NpgsqlWriteBuffer, NpgsqlParameter)

    Writes a value to the provided buffer, with the assumption that there is enough space in the buffer (no I/O will occur). The Npgsql core will have taken care of that.

    Declaration
    public void Write(long value, NpgsqlWriteBuffer buf, NpgsqlParameter parameter)
    Parameters
    Type Name Description
    Int64 value
    NpgsqlWriteBuffer buf

    The buffer to which to write.

    NpgsqlParameter parameter

    The NpgsqlParameter instance where this value resides. Can be used to access additional information relevant to the write process (e.g. Size).

    Write(Single, NpgsqlWriteBuffer, NpgsqlParameter)

    Writes a value to the provided buffer, with the assumption that there is enough space in the buffer (no I/O will occur). The Npgsql core will have taken care of that.

    Declaration
    public void Write(float value, NpgsqlWriteBuffer buf, NpgsqlParameter parameter)
    Parameters
    Type Name Description
    Single value
    NpgsqlWriteBuffer buf

    The buffer to which to write.

    NpgsqlParameter parameter

    The NpgsqlParameter instance where this value resides. Can be used to access additional information relevant to the write process (e.g. Size).

    Explicit Interface Implementations

    INpgsqlSimpleTypeHandler<Byte>.Read(NpgsqlReadBuffer, Int32, FieldDescription)

    Declaration
    byte INpgsqlSimpleTypeHandler<byte>.Read(NpgsqlReadBuffer buf, int len, FieldDescription fieldDescription)
    Parameters
    Type Name Description
    NpgsqlReadBuffer buf
    Int32 len
    FieldDescription fieldDescription
    Returns
    Type Description
    Byte

    INpgsqlSimpleTypeHandler<Decimal>.Read(NpgsqlReadBuffer, Int32, FieldDescription)

    Declaration
    decimal INpgsqlSimpleTypeHandler<decimal>.Read(NpgsqlReadBuffer buf, int len, FieldDescription fieldDescription)
    Parameters
    Type Name Description
    NpgsqlReadBuffer buf
    Int32 len
    FieldDescription fieldDescription
    Returns
    Type Description
    Decimal

    INpgsqlSimpleTypeHandler<Double>.Read(NpgsqlReadBuffer, Int32, FieldDescription)

    Declaration
    double INpgsqlSimpleTypeHandler<double>.Read(NpgsqlReadBuffer buf, int len, FieldDescription fieldDescription)
    Parameters
    Type Name Description
    NpgsqlReadBuffer buf
    Int32 len
    FieldDescription fieldDescription
    Returns
    Type Description
    Double

    INpgsqlSimpleTypeHandler<Int16>.Read(NpgsqlReadBuffer, Int32, FieldDescription)

    Declaration
    short INpgsqlSimpleTypeHandler<short>.Read(NpgsqlReadBuffer buf, int len, FieldDescription fieldDescription)
    Parameters
    Type Name Description
    NpgsqlReadBuffer buf
    Int32 len
    FieldDescription fieldDescription
    Returns
    Type Description
    Int16

    INpgsqlSimpleTypeHandler<Int64>.Read(NpgsqlReadBuffer, Int32, FieldDescription)

    Declaration
    long INpgsqlSimpleTypeHandler<long>.Read(NpgsqlReadBuffer buf, int len, FieldDescription fieldDescription)
    Parameters
    Type Name Description
    NpgsqlReadBuffer buf
    Int32 len
    FieldDescription fieldDescription
    Returns
    Type Description
    Int64

    INpgsqlSimpleTypeHandler<Single>.Read(NpgsqlReadBuffer, Int32, FieldDescription)

    Declaration
    float INpgsqlSimpleTypeHandler<float>.Read(NpgsqlReadBuffer buf, int len, FieldDescription fieldDescription)
    Parameters
    Type Name Description
    NpgsqlReadBuffer buf
    Int32 len
    FieldDescription fieldDescription
    Returns
    Type Description
    Single

    Implements

    INpgsqlTypeHandler<T>
    INpgsqlSimpleTypeHandler<T>
    INpgsqlSimpleTypeHandler<T>
    INpgsqlSimpleTypeHandler<T>
    INpgsqlSimpleTypeHandler<T>
    INpgsqlSimpleTypeHandler<T>
    INpgsqlSimpleTypeHandler<T>
    INpgsqlSimpleTypeHandler<T>
    In This Article
    Back to top © Copyright 2022 The Npgsql Development Team