Search Results for

    Show / Hide Table of Contents

    Class TimestampTzHandler

    A type handler for the PostgreSQL timestamptz data type.

    Inheritance
    Object
    NpgsqlTypeHandler
    NpgsqlTypeHandler<DateTime>
    NpgsqlSimpleTypeHandler<DateTime>
    NpgsqlSimpleTypeHandlerWithPsv<DateTime, NpgsqlDateTime>
    TimestampTzHandler
    Implements
    INpgsqlTypeHandler<DateTime>
    INpgsqlSimpleTypeHandler<DateTime>
    INpgsqlSimpleTypeHandler<NpgsqlDateTime>
    INpgsqlSimpleTypeHandler<DateTimeOffset>
    INpgsqlSimpleTypeHandler<Int64>
    Inherited Members
    NpgsqlSimpleTypeHandlerWithPsv<DateTime, NpgsqlDateTime>.ReadPsv(NpgsqlReadBuffer, Int32, FieldDescription)
    NpgsqlSimpleTypeHandlerWithPsv<DateTime, NpgsqlDateTime>.INpgsqlSimpleTypeHandler<NpgsqlDateTime>.Read(NpgsqlReadBuffer, Int32, FieldDescription)
    NpgsqlSimpleTypeHandlerWithPsv<DateTime, NpgsqlDateTime>.ValidateAndGetLength(NpgsqlDateTime, NpgsqlParameter)
    NpgsqlSimpleTypeHandlerWithPsv<DateTime, NpgsqlDateTime>.Write(NpgsqlDateTime, NpgsqlWriteBuffer, NpgsqlParameter)
    NpgsqlSimpleTypeHandlerWithPsv<DateTime, NpgsqlDateTime>.GetProviderSpecificFieldType(FieldDescription)
    NpgsqlSimpleTypeHandlerWithPsv<DateTime, NpgsqlDateTime>.CreateArrayHandler(PostgresArrayType, ArrayNullabilityMode)
    NpgsqlSimpleTypeHandler<DateTime>.Read(NpgsqlReadBuffer, Int32, Boolean, FieldDescription)
    NpgsqlSimpleTypeHandler<DateTime>.Write(DateTime, NpgsqlWriteBuffer, NpgsqlLengthCache, NpgsqlParameter, Boolean, CancellationToken)
    NpgsqlSimpleTypeHandler<DateTime>.ValidateAndGetLength(DateTime, NpgsqlLengthCache, NpgsqlParameter)
    NpgsqlTypeHandler<DateTime>.ReadAsObject(NpgsqlReadBuffer, Int32, Boolean, FieldDescription)
    NpgsqlTypeHandler<DateTime>.GetFieldType(FieldDescription)
    NpgsqlTypeHandler<DateTime>.GetProviderSpecificFieldType(FieldDescription)
    NpgsqlTypeHandler<DateTime>.CreateArrayHandler(PostgresArrayType, ArrayNullabilityMode)
    NpgsqlTypeHandler<DateTime>.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 TimestampTzHandler : NpgsqlSimpleTypeHandlerWithPsv<DateTime, NpgsqlDateTime>, INpgsqlTypeHandler<DateTime>, INpgsqlSimpleTypeHandler<DateTime>, INpgsqlSimpleTypeHandler<NpgsqlDateTime>, INpgsqlSimpleTypeHandler<DateTimeOffset>, INpgsqlSimpleTypeHandler<long>
    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

    TimestampTzHandler(PostgresType)

    Constructs an TimestampTzHandler.

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

    Methods

    CreateRangeHandler(PostgresType)

    Creates a type handler for ranges of this handler's type.

    Declaration
    public override NpgsqlTypeHandler CreateRangeHandler(PostgresType pgRangeType)
    Parameters
    Type Name Description
    PostgresType pgRangeType
    Returns
    Type Description
    NpgsqlTypeHandler
    Overrides
    Npgsql.Internal.TypeHandling.NpgsqlTypeHandler<System.DateTime>.CreateRangeHandler(Npgsql.PostgresTypes.PostgresType)

    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 DateTime 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
    DateTime

    The fully-read value.

    Overrides
    Npgsql.Internal.TypeHandling.NpgsqlSimpleTypeHandler<System.DateTime>.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 NpgsqlDateTime 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
    NpgsqlDateTime

    The fully-read value.

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

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

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

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

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

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

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

    Explicit Interface Implementations

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

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

    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

    Implements

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