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 TypeMethodDescriptionbooleanassignRowValues(ResultSet out, long currentRow) static booleanboolOneOut(ResultSet in) Has a boolean result described by oneoutparameter.voidclose()static StringReturns a result described by oneoutparameter.Returns a table result described by oneoutparameter.static booleanhelloOutParams(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 bareRECORDreturn type.static ResultSetProviderReturns 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 bareRECORDreturn type.static booleanA 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, waitMethods 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 bareRECORDreturn 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 explicitSQLTypeannotation on the trailingResultSetparameter 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 bareRECORDreturn type.- Throws:
SQLException
-
assignRowValues
- Specified by:
assignRowValuesin interfaceResultSetProvider- Specified by:
assignRowValuesin interfaceResultSetProvider.Large- Throws:
SQLException
-
close
- Specified by:
closein interfaceResultSetProvider
-
helloOneOut
@Function(schema="javatest", out="greeting text") public static String helloOneOut() throws SQLExceptionReturns a result described by oneoutparameter.Such a method is written in the style of any method that returns a scalar value, rather than receiving a writable
ResultSetas 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 oneoutparameter.Because this method returns boolean and has a trailing row-typed input parameter, that parameter must have an
SQLTypeannotation 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 oneoutparameter.Such a method is written in the style of any method that returns a set of some scalar value, using an
Iteratorrather than aResultSetProviderorResultSetHandle.- Throws:
SQLException
-