Package org.h2.schema
Class UserAggregate.AggregateWrapper
java.lang.Object
org.h2.schema.UserAggregate.AggregateWrapper
- All Implemented Interfaces:
Aggregate
- Enclosing class:
UserAggregate
Wrap
AggregateFunction
in order to behave as
Aggregate
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
This method is called once for each row.int
getInternalType
(int[] inputTypes) This method must return the H2 data type,Value
, of the aggregate function, given the H2 data type of the input data.This method returns the computed aggregate value.void
init
(Connection conn) This method is called when the aggregate function is used.
-
Field Details
-
aggregateFunction
-
-
Constructor Details
-
AggregateWrapper
AggregateWrapper(AggregateFunction aggregateFunction)
-
-
Method Details
-
init
Description copied from interface:Aggregate
This method is called when the aggregate function is used. A new object is created for each invocation.- Specified by:
init
in interfaceAggregate
- Parameters:
conn
- a connection to the database- Throws:
SQLException
- on SQL exception
-
getInternalType
Description copied from interface:Aggregate
This method must return the H2 data type,Value
, of the aggregate function, given the H2 data type of the input data. The method should check here if the number of parameters passed is correct, and if not it should throw an exception.- Specified by:
getInternalType
in interfaceAggregate
- Parameters:
inputTypes
- the H2 data type of the parameters,- Returns:
- the H2 data type of the result
- Throws:
SQLException
- if the number/type of parameters passed is incorrect
-
add
Description copied from interface:Aggregate
This method is called once for each row. If the aggregate function is called with multiple parameters, those are passed as array.- Specified by:
add
in interfaceAggregate
- Parameters:
value
- the value(s) for this row- Throws:
SQLException
- on failure
-
getResult
Description copied from interface:Aggregate
This method returns the computed aggregate value. This method must preserve previously added values and must be able to reevaluate result if more values were added since its previous invocation.- Specified by:
getResult
in interfaceAggregate
- Returns:
- the aggregated value
- Throws:
SQLException
- on failure
-