C# 클래스 NpgsqlTypes.Fastpath

This class implements the Fastpath api.
파일 보기 프로젝트 열기: undeadlabs/Npgsql 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
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