Class ReturnComposite
- All Implemented Interfaces:
ResultSetProvider
,ResultSetProvider.Large
@Function(out={...})
for a function that returns a
non-predeclared composite type.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.postgresql.pljava.ResultSetProvider
ResultSetProvider.Large
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
assignRowValues
(ResultSet out, long currentRow) static boolean
boolOneOut
(ResultSet in) Has a boolean result described by oneout
parameter.void
close()
static String
Returns a result described by oneout
parameter.Returns a table result described by oneout
parameter.static boolean
helloOutParams
(ResultSet out) Returns a two-column composite result that does not have to be a predeclared composite type, or require the calling SQL query to follow the function call with a result column definition list, as is needed for a bareRECORD
return type.static ResultSetProvider
Returns a two-column table result that does not have to be a predeclared composite type, or require the calling SQL query to follow the function call with a result column definition list, as is needed for a bareRECORD
return type.static boolean
A function that does not return a composite type, despite having a similar Java form.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.postgresql.pljava.ResultSetProvider.Large
assignRowValues
-
Constructor Details
-
ReturnComposite
public ReturnComposite()
-
-
Method Details
-
helloOutParams
@Function(schema="javatest", out={"greeting text","addressee text"}, provides="helloOutParams") public static boolean helloOutParams(ResultSet out) throws SQLException Returns a two-column composite result that does not have to be a predeclared composite type, or require the calling SQL query to follow the function call with a result column definition list, as is needed for a bareRECORD
return type.- Throws:
SQLException
-
notOutParams
@Function(schema="javatest", type="text") public static boolean notOutParams(@SQLType("pg_catalog.record") ResultSet in) throws SQLException A function that does not return a composite type, despite having a similar Java form.Without the
type=
element, this would not be mistaken for composite. With thetype=
element (a contrived example, will cast the method's boolean result to text), PL/Java would normally match the method to the composite pattern (other thanpg_catalog.RECORD
, PL/Java does not pretend to know at compile time which types might be composite). The explicitSQLType
annotation on the trailingResultSet
parameter forces it to be seen as an input, and the method to be seen as an ordinary method that happens to return boolean.- Throws:
SQLException
-
helloTable
@Function(schema="javatest", out={"greeting text","addressee text"}, provides="helloTable") public static ResultSetProvider helloTable() throws SQLExceptionReturns a two-column table result that does not have to be a predeclared composite type, or require the calling SQL query to follow the function call with a result column definition list, as is needed for a bareRECORD
return type.- Throws:
SQLException
-
assignRowValues
- Specified by:
assignRowValues
in interfaceResultSetProvider
- Specified by:
assignRowValues
in interfaceResultSetProvider.Large
- Throws:
SQLException
-
close
- Specified by:
close
in interfaceResultSetProvider
-
helloOneOut
@Function(schema="javatest", out="greeting text") public static String helloOneOut() throws SQLExceptionReturns a result described by oneout
parameter.Such a method is written in the style of any method that returns a scalar value, rather than receiving a writable
ResultSet
as a parameter.- Throws:
SQLException
-
boolOneOut
@Function(schema="javatest", out="exquisite boolean") public static boolean boolOneOut(@SQLType("pg_catalog.record") ResultSet in) throws SQLException Has a boolean result described by oneout
parameter.Because this method returns boolean and has a trailing row-typed input parameter, that parameter must have an
SQLType
annotation so that the method will not look like the more-than-one-OUT composite form, which would be rejected as a likely mistake.- Throws:
SQLException
-
helloOneOutTable
@Function(schema="javatest", out="addressee text") public static Iterator<String> helloOneOutTable() throws SQLExceptionReturns a table result described by oneout
parameter.Such a method is written in the style of any method that returns a set of some scalar value, using an
Iterator
rather than aResultSetProvider
orResultSetHandle
.- Throws:
SQLException
-