Search Results for

    Show / Hide Table of Contents

    Class DateHandler

    A type handler for the PostgreSQL date data type.

    Inheritance
    Object
    NpgsqlTypeHandler
    NpgsqlTypeHandler<DateTime>
    NpgsqlSimpleTypeHandler<DateTime>
    NpgsqlSimpleTypeHandlerWithPsv<DateTime, NpgsqlDate>
    DateHandler
    Implements
    INpgsqlTypeHandler<DateTime>
    INpgsqlSimpleTypeHandler<DateTime>
    INpgsqlSimpleTypeHandler<NpgsqlDate>
    Inherited Members
    NpgsqlSimpleTypeHandlerWithPsv<DateTime, NpgsqlDate>.ReadPsv(NpgsqlReadBuffer, Int32, FieldDescription)
    NpgsqlSimpleTypeHandlerWithPsv<DateTime, NpgsqlDate>.INpgsqlSimpleTypeHandler<NpgsqlDate>.Read(NpgsqlReadBuffer, Int32, FieldDescription)
    NpgsqlSimpleTypeHandlerWithPsv<DateTime, NpgsqlDate>.ValidateAndGetLength(NpgsqlDate, NpgsqlParameter)
    NpgsqlSimpleTypeHandlerWithPsv<DateTime, NpgsqlDate>.Write(NpgsqlDate, NpgsqlWriteBuffer, NpgsqlParameter)
    NpgsqlSimpleTypeHandlerWithPsv<DateTime, NpgsqlDate>.CreateArrayHandler(PostgresArrayType)
    NpgsqlSimpleTypeHandler<DateTime>.Read(NpgsqlReadBuffer, Int32, Boolean, FieldDescription)
    NpgsqlSimpleTypeHandler<DateTime>.Read<TAny>(NpgsqlReadBuffer, Int32, Boolean, FieldDescription)
    NpgsqlSimpleTypeHandler<DateTime>.Read<TAny>(NpgsqlReadBuffer, Int32, FieldDescription)
    NpgsqlSimpleTypeHandler<DateTime>.ValidateAndGetLength<TAny>(TAny, NpgsqlLengthCache, NpgsqlParameter)
    NpgsqlSimpleTypeHandler<DateTime>.Write(DateTime, NpgsqlWriteBuffer, NpgsqlLengthCache, NpgsqlParameter, Boolean)
    NpgsqlSimpleTypeHandler<DateTime>.ValidateAndGetLength(DateTime, NpgsqlLengthCache, NpgsqlParameter)
    NpgsqlSimpleTypeHandler<DateTime>.ValidateObjectAndGetLength(Object, NpgsqlLengthCache, NpgsqlParameter)
    NpgsqlSimpleTypeHandler<DateTime>.WriteObjectWithLength(Object, NpgsqlWriteBuffer, NpgsqlLengthCache, NpgsqlParameter, Boolean)
    NpgsqlTypeHandler<DateTime>.WriteWithLength<TAny>(TAny, NpgsqlWriteBuffer, NpgsqlLengthCache, NpgsqlParameter, Boolean)
    NpgsqlTypeHandler<DateTime>.CreateArrayHandler(PostgresArrayType)
    NpgsqlTypeHandler<DateTime>.CreateRangeHandler(PostgresRangeType)
    NpgsqlTypeHandler.CreateConversionButNoParamException(Type)
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Object.ReferenceEquals(Object, Object)
    Object.ToString()
    Namespace: Npgsql.TypeHandlers.DateTimeHandlers
    Assembly: Npgsql.dll
    Syntax
    public class DateHandler : NpgsqlSimpleTypeHandlerWithPsv<DateTime, NpgsqlDate>, INpgsqlTypeHandler<DateTime>, INpgsqlSimpleTypeHandler<DateTime>, INpgsqlSimpleTypeHandler<NpgsqlDate>
    Remarks

    See http://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

    | Improve this Doc

    DateHandler(PostgresType, Boolean)

    Constructs a DateHandler

    Declaration
    public DateHandler(PostgresType postgresType, bool convertInfinityDateTime)
    Parameters
    Type Name Description
    PostgresType postgresType
    Boolean convertInfinityDateTime

    Methods

    | Improve this Doc

    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.TypeHandling.NpgsqlSimpleTypeHandler<System.DateTime>.Read(Npgsql.NpgsqlReadBuffer, System.Int32, Npgsql.BackendMessages.FieldDescription)
    | Improve this Doc

    ReadPsv(NpgsqlReadBuffer, Int32, FieldDescription)

    Declaration
    protected override NpgsqlDate ReadPsv(NpgsqlReadBuffer buf, int len, FieldDescription fieldDescription = null)
    Parameters
    Type Name Description
    NpgsqlReadBuffer buf
    Int32 len
    FieldDescription fieldDescription
    Returns
    Type Description
    NpgsqlDate
    Overrides
    Npgsql.TypeHandling.NpgsqlSimpleTypeHandlerWithPsv<System.DateTime, NpgsqlTypes.NpgsqlDate>.ReadPsv(Npgsql.NpgsqlReadBuffer, System.Int32, Npgsql.BackendMessages.FieldDescription)
    Remarks

    Copied wholesale from Postgresql backend/utils/adt/datetime.c:j2date

    | Improve this Doc

    ValidateAndGetLength(NpgsqlDate, 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(NpgsqlDate value, NpgsqlParameter parameter)
    Parameters
    Type Name Description
    NpgsqlDate 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.TypeHandling.NpgsqlSimpleTypeHandlerWithPsv<System.DateTime, NpgsqlTypes.NpgsqlDate>.ValidateAndGetLength(NpgsqlTypes.NpgsqlDate, Npgsql.NpgsqlParameter)
    | Improve this Doc

    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.TypeHandling.NpgsqlSimpleTypeHandler<System.DateTime>.ValidateAndGetLength(System.DateTime, Npgsql.NpgsqlParameter)
    | Improve this Doc

    Write(NpgsqlDate, 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(NpgsqlDate value, NpgsqlWriteBuffer buf, NpgsqlParameter parameter)
    Parameters
    Type Name Description
    NpgsqlDate 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.TypeHandling.NpgsqlSimpleTypeHandlerWithPsv<System.DateTime, NpgsqlTypes.NpgsqlDate>.Write(NpgsqlTypes.NpgsqlDate, Npgsql.NpgsqlWriteBuffer, Npgsql.NpgsqlParameter)
    | Improve this Doc

    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.TypeHandling.NpgsqlSimpleTypeHandler<System.DateTime>.Write(System.DateTime, Npgsql.NpgsqlWriteBuffer, Npgsql.NpgsqlParameter)

    Implements

    INpgsqlTypeHandler<T>
    INpgsqlSimpleTypeHandler<T>
    INpgsqlSimpleTypeHandler<T>
    • Improve this Doc
    In This Article
    Back to top © Copyright 2021 The Npgsql Development Team