C# Класс NpgsqlTypes.Fastpath

This class implements the Fastpath api.
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
conn Npgsql.NpgsqlConnection
func int>.Dictionary
stream Stream

Открытые методы

Метод Описание
AddFunction ( String name, Int32 fnid ) : void

This adds a function to our lookup table. User code should use the addFunctions method, which is based upon a query, rather than hard coding the oid. The oid for a function is not guaranteed to remain static, even on different servers of the same version.

AddFunctions ( IDataReader rs ) : void

This takes a ResultSet containing two columns. Column 1 contains the function name, Column 2 the oid. It reads the entire ResultSet, loading the values into the function table. REMEMBER to close() the resultset after calling this!! Implementation note about function name lookups: PostgreSQL stores the function id's and their corresponding names in the pg_proc table. To speed things up locally, instead of querying each function from that table when required, a Dictionary is used. Also, only the function's required are entered into this table, keeping connection times as fast as possible. The org.postgresql.largeobject.LargeObject class performs a query upon it's startup, and passes the returned ResultSet to the addFunctions() method here. Once this has been done, the LargeObject api refers to the functions by name. Dont think that manually converting them to the oid's will work. Ok, they will for now, but they can change during development (there was some discussion about this for V7.0), so this is implemented to prevent any unwarranted headaches in the future.

Fastpath ( NpgsqlConnection conn ) : System

Initialises the fastpath system.

Fastpath ( NpgsqlConnection conn, Stream stream ) : System

Initialises the fastpath system.

FastpathCall ( Int32 fnid, System.Boolean resulttype, NpgsqlTypes.FastpathArg args ) : Object

Send a function call to the PostgreSQL backend.

FastpathCall ( String name, System.Boolean resulttype, NpgsqlTypes.FastpathArg args ) : Object

Send a function call to the PostgreSQL backend by name. Note: the mapping for the procedure name to function id needs to exist, usually to an earlier call to addfunction(). This is the prefered method to call, as function id's can/may change between versions of the backend. For an example of how this works, refer to NpgsqlTypes.LargeObject

GetData ( String name, NpgsqlTypes.FastpathArg args ) : Byte[]

This convenience method assumes that the return value is an Integer.

GetID ( String name ) : Int32

This returns the function id associated by its name If addFunction() or addFunctions() have not been called for this name, then an NpgsqlException is thrown.

GetInteger ( String name, NpgsqlTypes.FastpathArg args ) : Int32

This convenience method assumes that the return value is an Integer.

Приватные методы

Метод Описание
FastpathV2 ( Int32 fnid, System.Boolean resulttype, NpgsqlTypes.FastpathArg args ) : Object
FastpathV3 ( Int32 fnid, System.Boolean resulttype, NpgsqlTypes.FastpathArg args ) : Object

Описание методов

AddFunction() публичный Метод

This adds a function to our lookup table. User code should use the addFunctions method, which is based upon a query, rather than hard coding the oid. The oid for a function is not guaranteed to remain static, even on different servers of the same version.
public AddFunction ( String name, Int32 fnid ) : void
name String Function name.
fnid System.Int32 Function id.
Результат void

AddFunctions() публичный Метод

This takes a ResultSet containing two columns. Column 1 contains the function name, Column 2 the oid. It reads the entire ResultSet, loading the values into the function table. REMEMBER to close() the resultset after calling this!! Implementation note about function name lookups: PostgreSQL stores the function id's and their corresponding names in the pg_proc table. To speed things up locally, instead of querying each function from that table when required, a Dictionary is used. Also, only the function's required are entered into this table, keeping connection times as fast as possible. The org.postgresql.largeobject.LargeObject class performs a query upon it's startup, and passes the returned ResultSet to the addFunctions() method here. Once this has been done, the LargeObject api refers to the functions by name. Dont think that manually converting them to the oid's will work. Ok, they will for now, but they can change during development (there was some discussion about this for V7.0), so this is implemented to prevent any unwarranted headaches in the future.
public AddFunctions ( IDataReader rs ) : void
rs IDataReader ResultSet
Результат void

Fastpath() публичный Метод

Initialises the fastpath system.
public Fastpath ( NpgsqlConnection conn ) : System
conn Npgsql.NpgsqlConnection BaseConnection to attach to.
Результат System

Fastpath() публичный Метод

Initialises the fastpath system.
public Fastpath ( NpgsqlConnection conn, Stream stream ) : System
conn Npgsql.NpgsqlConnection BaseConnection to attach to.
stream Stream The network stream to the backend.
Результат System

FastpathCall() публичный Метод

Send a function call to the PostgreSQL backend.
public FastpathCall ( Int32 fnid, System.Boolean resulttype, NpgsqlTypes.FastpathArg args ) : Object
fnid System.Int32 Function id.
resulttype System.Boolean True if the result is an integer, false for other results.
args NpgsqlTypes.FastpathArg FastpathArguments to pass to fastpath.
Результат Object

FastpathCall() публичный Метод

Send a function call to the PostgreSQL backend by name. Note: the mapping for the procedure name to function id needs to exist, usually to an earlier call to addfunction(). This is the prefered method to call, as function id's can/may change between versions of the backend. For an example of how this works, refer to NpgsqlTypes.LargeObject
public FastpathCall ( String name, System.Boolean resulttype, NpgsqlTypes.FastpathArg args ) : Object
name String Function name.
resulttype System.Boolean True if the result is an integer, false for other results.
args NpgsqlTypes.FastpathArg FastpathArguments to pass to fastpath.
Результат Object

GetData() публичный Метод

This convenience method assumes that the return value is an Integer.
public GetData ( String name, NpgsqlTypes.FastpathArg args ) : Byte[]
name String Function name.
args NpgsqlTypes.FastpathArg Function arguments.
Результат Byte[]

GetID() публичный Метод

This returns the function id associated by its name If addFunction() or addFunctions() have not been called for this name, then an NpgsqlException is thrown.
public GetID ( String name ) : Int32
name String Function name to lookup.
Результат System.Int32

GetInteger() публичный Метод

This convenience method assumes that the return value is an Integer.
public GetInteger ( String name, NpgsqlTypes.FastpathArg args ) : Int32
name String Function name.
args NpgsqlTypes.FastpathArg Function arguments.
Результат System.Int32

Описание свойств

conn защищенное свойство

Our connection.
protected NpgsqlConnection,Npgsql conn
Результат Npgsql.NpgsqlConnection

func защищенное свойство

This maps the functions names to their id's (possible unique just to a connection).
protected Dictionary func
Результат int>.Dictionary

stream защищенное свойство

The network stream.
protected Stream stream
Результат Stream