Show / Hide Table of Contents

Class TimestampTzHandler

A type handler for the PostgreSQL timestamptz data type.

Inheritance
System.Object
NpgsqlTypeHandler
NpgsqlTypeHandler<System.DateTime>
NpgsqlSimpleTypeHandler<System.DateTime>
NpgsqlSimpleTypeHandlerWithPsv<System.DateTime, NpgsqlDateTime>
TimestampHandler
TimestampTzHandler
Implements
INpgsqlTypeHandler<System.DateTime>
INpgsqlSimpleTypeHandler<System.DateTime>
INpgsqlSimpleTypeHandler<NpgsqlDateTime>
INpgsqlSimpleTypeHandler<System.DateTimeOffset>
Inherited Members
TimestampHandler.ConvertInfinityDateTime
TimestampHandler.ReadTimeStamp(NpgsqlReadBuffer, Int32, FieldDescription)
TimestampHandler.ValidateAndGetLength(DateTime, NpgsqlParameter)
TimestampHandler.ValidateAndGetLength(NpgsqlDateTime, NpgsqlParameter)
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>.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)
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: Npgsql.TypeHandlers.DateTimeHandlers
Assembly: Npgsql.dll
Syntax
public class TimestampTzHandler : TimestampHandler, INpgsqlTypeHandler<DateTime>, INpgsqlSimpleTypeHandler<DateTime>, INpgsqlSimpleTypeHandler<NpgsqlDateTime>, INpgsqlSimpleTypeHandler<DateTimeOffset>
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

TimestampTzHandler(PostgresType, Boolean)

Constructs an TimestampTzHandler.

Declaration
public TimestampTzHandler(PostgresType postgresType, bool convertInfinityDateTime)
Parameters
Type Name Description
PostgresType postgresType
System.Boolean convertInfinityDateTime

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 DateTime Read(NpgsqlReadBuffer buf, int len, FieldDescription fieldDescription = null)
Parameters
Type Name Description
NpgsqlReadBuffer buf

The buffer from which to read.

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

The fully-read value.

Overrides
TimestampHandler.Read(NpgsqlReadBuffer, Int32, 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.

System.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
TimestampHandler.ReadPsv(NpgsqlReadBuffer, Int32, FieldDescription)

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 shold be thrown. Also returns the byte length needed to write the value.

Declaration
public int ValidateAndGetLength(DateTimeOffset value, NpgsqlParameter parameter)
Parameters
Type Name Description
System.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
System.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
TimestampHandler.Write(NpgsqlDateTime, NpgsqlWriteBuffer, 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
System.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
TimestampHandler.Write(DateTime, NpgsqlWriteBuffer, 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
System.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).

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
System.Int32 len
FieldDescription fieldDescription
Returns
Type Description
System.DateTimeOffset

Implements

INpgsqlTypeHandler<T>
INpgsqlSimpleTypeHandler<T>
INpgsqlSimpleTypeHandler<T>
INpgsqlSimpleTypeHandler<T>
In This Article
Back to top Generated by DocFX