Search Results for

    Show / Hide Table of Contents

    Class HstoreHandler

    A type handler for the PostgreSQL hstore extension data type, which stores sets of key/value pairs within a single PostgreSQL value.

    Inheritance
    Object
    NpgsqlTypeHandler
    NpgsqlTypeHandler<Dictionary<String, String>>
    HstoreHandler
    Implements
    INpgsqlTypeHandler<Dictionary<String, String>>
    INpgsqlTypeHandler<IDictionary<String, String>>
    Inherited Members
    NpgsqlTypeHandler<Dictionary<String, String>>.Read(NpgsqlReadBuffer, Int32, Boolean, FieldDescription)
    NpgsqlTypeHandler<Dictionary<String, String>>.Read<TAny>(NpgsqlReadBuffer, Int32, Boolean, FieldDescription)
    NpgsqlTypeHandler<Dictionary<String, String>>.Read<TAny>(NpgsqlReadBuffer, Int32, FieldDescription)
    NpgsqlTypeHandler<Dictionary<String, String>>.ValidateAndGetLength(Dictionary<String, String>, NpgsqlLengthCache, NpgsqlParameter)
    NpgsqlTypeHandler<Dictionary<String, String>>.Write(Dictionary<String, String>, NpgsqlWriteBuffer, NpgsqlLengthCache, NpgsqlParameter, Boolean)
    NpgsqlTypeHandler<Dictionary<String, String>>.ValidateAndGetLength<TAny>(TAny, NpgsqlLengthCache, NpgsqlParameter)
    NpgsqlTypeHandler<Dictionary<String, String>>.WriteWithLength<TAny>(TAny, NpgsqlWriteBuffer, NpgsqlLengthCache, NpgsqlParameter, Boolean)
    NpgsqlTypeHandler<Dictionary<String, String>>.ValidateObjectAndGetLength(Object, NpgsqlLengthCache, NpgsqlParameter)
    NpgsqlTypeHandler<Dictionary<String, String>>.WriteObjectWithLength(Object, NpgsqlWriteBuffer, NpgsqlLengthCache, NpgsqlParameter, Boolean)
    NpgsqlTypeHandler<Dictionary<String, String>>.CreateArrayHandler(PostgresArrayType)
    NpgsqlTypeHandler<Dictionary<String, String>>.CreateRangeHandler(PostgresRangeType)
    NpgsqlTypeHandler.Read<TAny>(NpgsqlReadBuffer, Int32, Boolean, FieldDescription)
    NpgsqlTypeHandler.Read<TAny>(NpgsqlReadBuffer, Int32, FieldDescription)
    NpgsqlTypeHandler.ValidateAndGetLength<TAny>(TAny, NpgsqlLengthCache, NpgsqlParameter)
    NpgsqlTypeHandler.ValidateObjectAndGetLength(Object, NpgsqlLengthCache, NpgsqlParameter)
    NpgsqlTypeHandler.WriteObjectWithLength(Object, NpgsqlWriteBuffer, NpgsqlLengthCache, NpgsqlParameter, Boolean)
    NpgsqlTypeHandler.CreateArrayHandler(PostgresArrayType)
    NpgsqlTypeHandler.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
    Assembly: Npgsql.dll
    Syntax
    public class HstoreHandler : NpgsqlTypeHandler<Dictionary<string, string>>, INpgsqlTypeHandler<Dictionary<string, string>>, INpgsqlTypeHandler<IDictionary<string, string>>
    Remarks

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

    Methods

    | Improve this Doc

    Read(NpgsqlReadBuffer, Int32, Boolean, FieldDescription)

    Reads a value of type TDefault with the given length from the provided buffer, using either sync or async I/O.

    Declaration
    public override async ValueTask<Dictionary<string, string>> Read(NpgsqlReadBuffer buf, int len, bool async, 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.

    Boolean async

    If I/O is required to read the full length of the value, whether it should be performed synchronously or asynchronously.

    FieldDescription fieldDescription

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

    Returns
    Type Description
    ValueTask<Dictionary<String, String>>

    The fully-read value.

    Overrides
    Npgsql.TypeHandling.NpgsqlTypeHandler<System.Collections.Generic.Dictionary<System.String, System.String>>.Read(Npgsql.NpgsqlReadBuffer, System.Int32, System.Boolean, Npgsql.BackendMessages.FieldDescription)
    | Improve this Doc

    ValidateAndGetLength(Dictionary<String, String>, ref NpgsqlLengthCache, NpgsqlParameter)

    Called to validate and get the length of a value of a generic NpgsqlParameter<T>.

    Declaration
    public override int ValidateAndGetLength(Dictionary<string, string> value, ref NpgsqlLengthCache lengthCache, NpgsqlParameter parameter)
    Parameters
    Type Name Description
    Dictionary<String, String> value
    NpgsqlLengthCache lengthCache
    NpgsqlParameter parameter
    Returns
    Type Description
    Int32
    Overrides
    Npgsql.TypeHandling.NpgsqlTypeHandler<System.Collections.Generic.Dictionary<System.String, System.String>>.ValidateAndGetLength(System.Collections.Generic.Dictionary<System.String, System.String>, Npgsql.NpgsqlLengthCache, Npgsql.NpgsqlParameter)
    | Improve this Doc

    ValidateAndGetLength(IDictionary<String, String>, ref NpgsqlLengthCache, 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(IDictionary<string, string> value, ref NpgsqlLengthCache lengthCache, NpgsqlParameter parameter)
    Parameters
    Type Name Description
    IDictionary<String, String> value
    NpgsqlLengthCache lengthCache

    A cache where the length calculated during the validation phase can be stored for use at the writing phase.

    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.

    | Improve this Doc

    Write(Dictionary<String, String>, NpgsqlWriteBuffer, NpgsqlLengthCache, NpgsqlParameter, Boolean)

    Called to write the value of a generic NpgsqlParameter<T>.

    Declaration
    public override Task Write(Dictionary<string, string> value, NpgsqlWriteBuffer buf, NpgsqlLengthCache lengthCache, NpgsqlParameter parameter, bool async)
    Parameters
    Type Name Description
    Dictionary<String, String> value
    NpgsqlWriteBuffer buf
    NpgsqlLengthCache lengthCache
    NpgsqlParameter parameter
    Boolean async
    Returns
    Type Description
    Task
    Overrides
    Npgsql.TypeHandling.NpgsqlTypeHandler<System.Collections.Generic.Dictionary<System.String, System.String>>.Write(System.Collections.Generic.Dictionary<System.String, System.String>, Npgsql.NpgsqlWriteBuffer, Npgsql.NpgsqlLengthCache, Npgsql.NpgsqlParameter, System.Boolean)
    | Improve this Doc

    Write(IDictionary<String, String>, NpgsqlWriteBuffer, NpgsqlLengthCache, NpgsqlParameter, Boolean)

    Writes a value to the provided buffer.

    Declaration
    public async Task Write(IDictionary<string, string> value, NpgsqlWriteBuffer buf, NpgsqlLengthCache lengthCache, NpgsqlParameter parameter, bool async)
    Parameters
    Type Name Description
    IDictionary<String, String> value
    NpgsqlWriteBuffer buf

    The buffer to which to write.

    NpgsqlLengthCache lengthCache

    A cache where the length calculated during the validation phase can be stored for use at the writing phase.

    NpgsqlParameter parameter

    The NpgsqlParameter instance where this value resides. Can be used to access additional information relevant to the write process (e.g. Size).

    Boolean async

    If I/O will be necessary (i.e. the buffer is full), determines whether it will be done synchronously or asynchronously.

    Returns
    Type Description
    Task

    Explicit Interface Implementations

    | Improve this Doc

    INpgsqlTypeHandler<IDictionary<String, String>>.Read(NpgsqlReadBuffer, Int32, Boolean, FieldDescription)

    Declaration
    ValueTask<IDictionary<string, string>> INpgsqlTypeHandler<IDictionary<string, string>>.Read(NpgsqlReadBuffer buf, int len, bool async, FieldDescription fieldDescription)
    Parameters
    Type Name Description
    NpgsqlReadBuffer buf
    Int32 len
    Boolean async
    FieldDescription fieldDescription
    Returns
    Type Description
    ValueTask<IDictionary<String, String>>

    Implements

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