クラス Fastpath
This class implements the Fastpath api.
This is a means of executing functions embedded in the backend from within a java application.
It is based around the file src/interfaces/libpq/fe-exec.c
-
コンストラクタの概要
コンストラクタ -
メソッドの概要
修飾子とタイプメソッド説明void
addFunction
(String name, int fnid) 推奨されていません。This adds a function to our lookup table.void
推奨されていません。This takes a ResultSet containing two columns.static FastpathArg
createOIDArg
(long oid) 推奨されていません。Creates a FastpathArg with an oid parameter.@Nullable Object
fastpath
(int fnId, boolean resultType, FastpathArg[] args) 推奨されていません。please usefastpath(int, FastpathArg[])
byte @Nullable []
fastpath
(int fnId, FastpathArg[] args) 推奨されていません。Send a function call to the PostgreSQL backend.@Nullable Object
fastpath
(String name, boolean resulttype, FastpathArg[] args) 推奨されていません。UsegetData(String, FastpathArg[])
if you expect a binary result, or one ofgetInteger(String, FastpathArg[])
orgetLong(String, FastpathArg[])
if you expect a numeric onebyte @Nullable []
fastpath
(String name, FastpathArg[] args) 推奨されていません。Send a function call to the PostgreSQL backend by name.byte @Nullable []
getData
(String name, FastpathArg[] args) 推奨されていません。This convenience method assumes that the return value is not an Integer.int
推奨されていません。This returns the function id associated by its name.int
getInteger
(String name, FastpathArg[] args) 推奨されていません。This convenience method assumes that the return value is an integer.long
getLong
(String name, FastpathArg[] args) 推奨されていません。This convenience method assumes that the return value is a long (bigint).long
getOID
(String name, FastpathArg[] args) 推奨されていません。This convenience method assumes that the return value is an oid.
-
コンストラクタの詳細
-
Fastpath
推奨されていません。Initialises the fastpath system.- パラメータ:
conn
- BaseConnection to attach to
-
-
メソッドの詳細
-
fastpath
@Deprecated public @Nullable Object fastpath(int fnId, boolean resultType, FastpathArg[] args) throws SQLException 推奨されていません。please usefastpath(int, FastpathArg[])
Send a function call to the PostgreSQL backend.- パラメータ:
fnId
- Function idresultType
- True if the result is a numeric (Integer or Long)args
- FastpathArguments to pass to fastpath- 戻り値:
- null if no data, Integer if an integer result, Long if a long result, or byte[] otherwise
- 例外:
SQLException
- if a database-access error occurs.
-
fastpath
推奨されていません。Send a function call to the PostgreSQL backend.- パラメータ:
fnId
- Function idargs
- FastpathArguments to pass to fastpath- 戻り値:
- null if no data, byte[] otherwise
- 例外:
SQLException
- if a database-access error occurs.
-
fastpath
@Deprecated public @Nullable Object fastpath(String name, boolean resulttype, FastpathArg[] args) throws SQLException 推奨されていません。UsegetData(String, FastpathArg[])
if you expect a binary result, or one ofgetInteger(String, FastpathArg[])
orgetLong(String, FastpathArg[])
if you expect a numeric one- パラメータ:
name
- Function nameresulttype
- True if the result is a numeric (Integer or Long)args
- FastpathArguments to pass to fastpath- 戻り値:
- null if no data, Integer if an integer result, Long if a long result, or byte[] otherwise
- 例外:
SQLException
- if something goes wrong- 関連項目:
-
fastpath
推奨されていません。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 preferred method to call, as function id's can/may change between versions of the backend.
For an example of how this works, refer to org.postgresql.largeobject.LargeObject
- パラメータ:
name
- Function nameargs
- FastpathArguments to pass to fastpath- 戻り値:
- null if no data, byte[] otherwise
- 例外:
SQLException
- if name is unknown or if a database-access error occurs.- 関連項目:
-
getInteger
推奨されていません。This convenience method assumes that the return value is an integer.- パラメータ:
name
- Function nameargs
- Function arguments- 戻り値:
- integer result
- 例外:
SQLException
- if a database-access error occurs or no result
-
getLong
推奨されていません。This convenience method assumes that the return value is a long (bigint).- パラメータ:
name
- Function nameargs
- Function arguments- 戻り値:
- long result
- 例外:
SQLException
- if a database-access error occurs or no result
-
getOID
推奨されていません。This convenience method assumes that the return value is an oid.- パラメータ:
name
- Function nameargs
- Function arguments- 戻り値:
- oid of the given call
- 例外:
SQLException
- if a database-access error occurs or no result
-
getData
推奨されていません。This convenience method assumes that the return value is not an Integer.- パラメータ:
name
- Function nameargs
- Function arguments- 戻り値:
- byte[] array containing result
- 例外:
SQLException
- if a database-access error occurs or no result
-
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.
- パラメータ:
name
- Function namefnid
- Function id
-
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 HashMap 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.
Don't 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.
- パラメータ:
rs
- ResultSet- 例外:
SQLException
- if a database-access error occurs.- 関連項目:
-
getID
推奨されていません。This returns the function id associated by its name.
If addFunction() or addFunctions() have not been called for this name, then an SQLException is thrown.
- パラメータ:
name
- Function name to lookup- 戻り値:
- Function ID for fastpath call
- 例外:
SQLException
- is function is unknown.
-
createOIDArg
推奨されていません。Creates a FastpathArg with an oid parameter. This is here instead of a constructor of FastpathArg because the constructor can't tell the difference between an long that's really int8 and a long thats an oid.- パラメータ:
oid
- input oid- 戻り値:
- FastpathArg with an oid parameter
-