Class Int64Handler
A type handler for the PostgreSQL bigint data type.
Inheritance
Implements
Inherited Members
Namespace: Npgsql.TypeHandlers.NumericHandlers
Assembly: Npgsql.dll
Syntax
public class Int64Handler : NpgsqlSimpleTypeHandler<long>, INpgsqlTypeHandler<long>, INpgsqlSimpleTypeHandler<long>, INpgsqlSimpleTypeHandler<byte>, INpgsqlSimpleTypeHandler<short>, INpgsqlSimpleTypeHandler<int>, INpgsqlSimpleTypeHandler<float>, INpgsqlSimpleTypeHandler<double>, INpgsqlSimpleTypeHandler<decimal>
Remarks
See http://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
Int64Handler(PostgresType)
Declaration
public Int64Handler(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 long 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.Int64 | The fully-read value. |
Overrides
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 shold be thrown. Also returns the byte length needed to write the value.
Declaration
public int ValidateAndGetLength(byte value, NpgsqlParameter parameter)
Parameters
Type | Name | Description |
---|---|---|
System.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 |
---|---|
System.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 shold be thrown. Also returns the byte length needed to write the value.
Declaration
public int ValidateAndGetLength(decimal value, NpgsqlParameter parameter)
Parameters
Type | Name | Description |
---|---|---|
System.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 |
---|---|
System.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 shold be thrown. Also returns the byte length needed to write the value.
Declaration
public int ValidateAndGetLength(double value, NpgsqlParameter parameter)
Parameters
Type | Name | Description |
---|---|---|
System.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 |
---|---|
System.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 shold be thrown. Also returns the byte length needed to write the value.
Declaration
public int ValidateAndGetLength(short value, NpgsqlParameter parameter)
Parameters
Type | Name | Description |
---|---|---|
System.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 |
---|---|
System.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 int ValidateAndGetLength(int value, NpgsqlParameter parameter)
Parameters
Type | Name | Description |
---|---|---|
System.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 |
---|---|
System.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 shold be thrown. Also returns the byte length needed to write the value.
Declaration
public override int ValidateAndGetLength(long value, NpgsqlParameter parameter)
Parameters
Type | Name | Description |
---|---|---|
System.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 |
---|---|
System.Int32 | The number of bytes required to write the value. |
Overrides
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 shold be thrown. Also returns the byte length needed to write the value.
Declaration
public int ValidateAndGetLength(float value, NpgsqlParameter parameter)
Parameters
Type | Name | Description |
---|---|---|
System.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 |
---|---|
System.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 |
---|---|---|
System.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 |
---|---|---|
System.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 |
---|---|---|
System.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 |
---|---|---|
System.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 void Write(int value, NpgsqlWriteBuffer buf, NpgsqlParameter parameter)
Parameters
Type | Name | Description |
---|---|---|
System.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). |
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 override void Write(long value, NpgsqlWriteBuffer buf, NpgsqlParameter parameter)
Parameters
Type | Name | Description |
---|---|---|
System.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). |
Overrides
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 |
---|---|---|
System.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 | |
System.Int32 | len | |
FieldDescription | fieldDescription |
Returns
Type | Description |
---|---|
System.Byte |
INpgsqlSimpleTypeHandler<Decimal>.Read(NpgsqlReadBuffer, Int32, FieldDescription)
Declaration
decimal INpgsqlSimpleTypeHandler<decimal>.Read(NpgsqlReadBuffer buf, int len, FieldDescription fieldDescription)
Parameters
Type | Name | Description |
---|---|---|
NpgsqlReadBuffer | buf | |
System.Int32 | len | |
FieldDescription | fieldDescription |
Returns
Type | Description |
---|---|
System.Decimal |
INpgsqlSimpleTypeHandler<Double>.Read(NpgsqlReadBuffer, Int32, FieldDescription)
Declaration
double INpgsqlSimpleTypeHandler<double>.Read(NpgsqlReadBuffer buf, int len, FieldDescription fieldDescription)
Parameters
Type | Name | Description |
---|---|---|
NpgsqlReadBuffer | buf | |
System.Int32 | len | |
FieldDescription | fieldDescription |
Returns
Type | Description |
---|---|
System.Double |
INpgsqlSimpleTypeHandler<Int16>.Read(NpgsqlReadBuffer, Int32, FieldDescription)
Declaration
short INpgsqlSimpleTypeHandler<short>.Read(NpgsqlReadBuffer buf, int len, FieldDescription fieldDescription)
Parameters
Type | Name | Description |
---|---|---|
NpgsqlReadBuffer | buf | |
System.Int32 | len | |
FieldDescription | fieldDescription |
Returns
Type | Description |
---|---|
System.Int16 |
INpgsqlSimpleTypeHandler<Int32>.Read(NpgsqlReadBuffer, Int32, FieldDescription)
Declaration
int INpgsqlSimpleTypeHandler<int>.Read(NpgsqlReadBuffer buf, int len, FieldDescription fieldDescription)
Parameters
Type | Name | Description |
---|---|---|
NpgsqlReadBuffer | buf | |
System.Int32 | len | |
FieldDescription | fieldDescription |
Returns
Type | Description |
---|---|
System.Int32 |
INpgsqlSimpleTypeHandler<Single>.Read(NpgsqlReadBuffer, Int32, FieldDescription)
Declaration
float INpgsqlSimpleTypeHandler<float>.Read(NpgsqlReadBuffer buf, int len, FieldDescription fieldDescription)
Parameters
Type | Name | Description |
---|---|---|
NpgsqlReadBuffer | buf | |
System.Int32 | len | |
FieldDescription | fieldDescription |
Returns
Type | Description |
---|---|
System.Single |