Search Results for

    Show / Hide Table of Contents

    Class IntervalHandler

    A type handler for the PostgreSQL date interval type.

    Inheritance
    Object
    NpgsqlTypeHandler
    NpgsqlTypeHandler<TimeSpan>
    NpgsqlSimpleTypeHandler<TimeSpan>
    NpgsqlSimpleTypeHandlerWithPsv<TimeSpan, NpgsqlTimeSpan>
    IntervalHandler
    Implements
    INpgsqlTypeHandler<TimeSpan>
    INpgsqlSimpleTypeHandler<TimeSpan>
    INpgsqlSimpleTypeHandler<NpgsqlTimeSpan>
    INpgsqlSimpleTypeHandler<NpgsqlInterval>
    Inherited Members
    NpgsqlSimpleTypeHandlerWithPsv<TimeSpan, NpgsqlTimeSpan>.ReadPsv(NpgsqlReadBuffer, Int32, FieldDescription)
    NpgsqlSimpleTypeHandlerWithPsv<TimeSpan, NpgsqlTimeSpan>.INpgsqlSimpleTypeHandler<NpgsqlTimeSpan>.Read(NpgsqlReadBuffer, Int32, FieldDescription)
    NpgsqlSimpleTypeHandlerWithPsv<TimeSpan, NpgsqlTimeSpan>.ValidateAndGetLength(NpgsqlTimeSpan, NpgsqlParameter)
    NpgsqlSimpleTypeHandlerWithPsv<TimeSpan, NpgsqlTimeSpan>.Write(NpgsqlTimeSpan, NpgsqlWriteBuffer, NpgsqlParameter)
    NpgsqlSimpleTypeHandlerWithPsv<TimeSpan, NpgsqlTimeSpan>.GetProviderSpecificFieldType(FieldDescription)
    NpgsqlSimpleTypeHandlerWithPsv<TimeSpan, NpgsqlTimeSpan>.CreateArrayHandler(PostgresArrayType, ArrayNullabilityMode)
    NpgsqlSimpleTypeHandler<TimeSpan>.Read(NpgsqlReadBuffer, Int32, Boolean, FieldDescription)
    NpgsqlSimpleTypeHandler<TimeSpan>.Write(TimeSpan, NpgsqlWriteBuffer, NpgsqlLengthCache, NpgsqlParameter, Boolean, CancellationToken)
    NpgsqlSimpleTypeHandler<TimeSpan>.ValidateAndGetLength(TimeSpan, NpgsqlLengthCache, NpgsqlParameter)
    NpgsqlTypeHandler<TimeSpan>.ReadAsObject(NpgsqlReadBuffer, Int32, Boolean, FieldDescription)
    NpgsqlTypeHandler<TimeSpan>.GetFieldType(FieldDescription)
    NpgsqlTypeHandler<TimeSpan>.GetProviderSpecificFieldType(FieldDescription)
    NpgsqlTypeHandler<TimeSpan>.CreateArrayHandler(PostgresArrayType, ArrayNullabilityMode)
    NpgsqlTypeHandler<TimeSpan>.CreateRangeHandler(PostgresType)
    NpgsqlTypeHandler<TimeSpan>.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.DateTimeHandlers
    Assembly: Npgsql.dll
    Syntax
    public class IntervalHandler : NpgsqlSimpleTypeHandlerWithPsv<TimeSpan, NpgsqlTimeSpan>, INpgsqlTypeHandler<TimeSpan>, INpgsqlSimpleTypeHandler<TimeSpan>, INpgsqlSimpleTypeHandler<NpgsqlTimeSpan>, INpgsqlSimpleTypeHandler<NpgsqlInterval>
    Remarks

    See https://www.postgresql.org/docs/current/static/datatype-datetime.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

    IntervalHandler(PostgresType)

    Constructs an IntervalHandler

    Declaration
    public IntervalHandler(PostgresType postgresType)
    Parameters
    Type Name Description
    PostgresType postgresType

    Methods

    Read(NpgsqlReadBuffer, Int32, FieldDescription)

    Reads a value of type TDefault with the given length from the provided buffer, with the assumption that it is entirely present in the provided memory buffer and no I/O will be required.

    Declaration
    public override TimeSpan Read(NpgsqlReadBuffer buf, int len, FieldDescription fieldDescription = null)
    Parameters
    Type Name Description
    NpgsqlReadBuffer buf

    The buffer from which to read.

    Int32 len

    The byte length of the value. The buffer might not contain the full length, requiring I/O to be performed.

    FieldDescription fieldDescription

    Additional PostgreSQL information about the type, such as the length in varchar(30).

    Returns
    Type Description
    TimeSpan

    The fully-read value.

    Overrides
    Npgsql.Internal.TypeHandling.NpgsqlSimpleTypeHandler<System.TimeSpan>.Read(Npgsql.Internal.NpgsqlReadBuffer, System.Int32, Npgsql.BackendMessages.FieldDescription)

    ReadPsv(NpgsqlReadBuffer, Int32, FieldDescription)

    Reads a value of type TPsv with the given length from the provided buffer, with the assumption that it is entirely present in the provided memory buffer and no I/O will be required.

    Declaration
    protected override NpgsqlTimeSpan ReadPsv(NpgsqlReadBuffer buf, int len, FieldDescription fieldDescription = null)
    Parameters
    Type Name Description
    NpgsqlReadBuffer buf

    The buffer from which to read.

    Int32 len

    The byte length of the value. The buffer might not contain the full length, requiring I/O to be performed.

    FieldDescription fieldDescription

    Additional PostgreSQL information about the type, such as the length in varchar(30).

    Returns
    Type Description
    NpgsqlTimeSpan

    The fully-read value.

    Overrides
    Npgsql.Internal.TypeHandling.NpgsqlSimpleTypeHandlerWithPsv<System.TimeSpan, NpgsqlTypes.NpgsqlTimeSpan>.ReadPsv(Npgsql.Internal.NpgsqlReadBuffer, System.Int32, Npgsql.BackendMessages.FieldDescription)

    ValidateAndGetLength(NpgsqlInterval, 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(NpgsqlInterval value, NpgsqlParameter parameter)
    Parameters
    Type Name Description
    NpgsqlInterval 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(NpgsqlTimeSpan, 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(NpgsqlTimeSpan value, NpgsqlParameter parameter)
    Parameters
    Type Name Description
    NpgsqlTimeSpan 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.NpgsqlSimpleTypeHandlerWithPsv<System.TimeSpan, NpgsqlTypes.NpgsqlTimeSpan>.ValidateAndGetLength(NpgsqlTypes.NpgsqlTimeSpan, Npgsql.NpgsqlParameter)

    ValidateAndGetLength(TimeSpan, 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(TimeSpan value, NpgsqlParameter parameter)
    Parameters
    Type Name Description
    TimeSpan 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.TimeSpan>.ValidateAndGetLength(System.TimeSpan, Npgsql.NpgsqlParameter)

    Write(NpgsqlInterval, NpgsqlWriteBuffer, NpgsqlParameter)

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

    Write(NpgsqlTimeSpan, 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(NpgsqlTimeSpan value, NpgsqlWriteBuffer buf, NpgsqlParameter parameter)
    Parameters
    Type Name Description
    NpgsqlTimeSpan 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.NpgsqlSimpleTypeHandlerWithPsv<System.TimeSpan, NpgsqlTypes.NpgsqlTimeSpan>.Write(NpgsqlTypes.NpgsqlTimeSpan, Npgsql.Internal.NpgsqlWriteBuffer, Npgsql.NpgsqlParameter)

    Write(TimeSpan, 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(TimeSpan value, NpgsqlWriteBuffer buf, NpgsqlParameter parameter)
    Parameters
    Type Name Description
    TimeSpan 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.TimeSpan>.Write(System.TimeSpan, Npgsql.Internal.NpgsqlWriteBuffer, Npgsql.NpgsqlParameter)

    Explicit Interface Implementations

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

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

    Implements

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