Top Description Inners Fields Constructors Methods
org.h2.schema

public final Class UserAggregate

extends UserDefinedFunction
Class Inheritance
Imports
java.sql.Connection, .SQLException, org.h2.api.Aggregate, .AggregateFunction, org.h2.engine.DbObject, .SessionLocal, org.h2.message.DbException, .Trace, org.h2.util.JdbcUtils, .StringUtils, org.h2.value.DataType, .TypeInfo

Represents a user-defined aggregate function.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private Class<?>
Inherited from org.h2.schema.UserDefinedFunction:
className

Constructor Summary

AccessConstructor and Description
public
UserAggregate(Schema schema, int id, String name, String className, boolean force)

Method Summary

Modifier and TypeMethod and Description
public String
getCreateSQL()

Implements abstract org.h2.engine.DbObject.getCreateSQL.

Construct the CREATE ...

public String
getDropSQL()

Overrides org.h2.engine.DbObject.getDropSQL.

Construct a DROP ...

public Aggregate
public int
getType()

Implements abstract org.h2.engine.DbObject.getType.

Get the object type.

public synchronized void
removeChildrenAndResources(SessionLocal
the session
session
)

Implements abstract org.h2.engine.DbObject.removeChildrenAndResources.

Delete all dependent children objects and resources of this object.

Inherited from org.h2.schema.UserDefinedFunction:
checkRenamegetJavaClassName

Field Detail

javaClassback to summary
private Class<?> javaClass

Constructor Detail

UserAggregateback to summary
public UserAggregate(Schema schema, int id, String name, String className, boolean force)

Method Detail

getCreateSQLback to summary
public String getCreateSQL()

Implements abstract org.h2.engine.DbObject.getCreateSQL.

Doc from org.h2.engine.DbObject.getCreateSQL.

Construct the CREATE ... SQL statement for this object.

Returns:String

the SQL statement

Annotations
@Override
getDropSQLback to summary
public String getDropSQL()

Overrides org.h2.engine.DbObject.getDropSQL.

Doc from org.h2.engine.DbObject.getDropSQL.

Construct a DROP ... SQL statement for this object.

Returns:String

the SQL statement

Annotations
@Override
getInstanceback to summary
public Aggregate getInstance()
getTypeback to summary
public int getType()

Implements abstract org.h2.engine.DbObject.getType.

Doc from org.h2.engine.DbObject.getType.

Get the object type.

Returns:int

the object type

Annotations
@Override
removeChildrenAndResourcesback to summary
public synchronized void removeChildrenAndResources(SessionLocal session)

Implements abstract org.h2.engine.DbObject.removeChildrenAndResources.

Doc from org.h2.engine.DbObject.removeChildrenAndResources.

Delete all dependent children objects and resources of this object.

Parameters
session:SessionLocal

the session

Annotations
@Override
org.h2.schema back to summary

private Class UserAggregate.AggregateWrapper

extends Object
implements Aggregate
Class Inheritance
All Implemented Interfaces
org.h2.api.Aggregate

Wrap AggregateFunction in order to behave as org.h2.api.Aggregate

Field Summary

Modifier and TypeField and Description
private final AggregateFunction

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public void
add(Object
the value(s) for this row
value
)

Implements org.h2.api.Aggregate.add.

This method is called once for each row.

public int
getInternalType(int[]
the H2 data type of the parameters,
inputTypes
)

Implements org.h2.api.Aggregate.getInternalType.

This method must return the H2 data type, org.h2.value.Value, of the aggregate function, given the H2 data type of the input data.

public Object
getResult()

Implements org.h2.api.Aggregate.getResult.

This method returns the computed aggregate value.

public void
init(Connection
a connection to the database
conn
)

Overrides default org.h2.api.Aggregate.init.

This method is called when the aggregate function is used.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

aggregateFunctionback to summary
private final AggregateFunction aggregateFunction

Constructor Detail

AggregateWrapperback to summary
pack-priv AggregateWrapper(AggregateFunction aggregateFunction)

Method Detail

addback to summary
public void add(Object value) throws SQLException

Implements org.h2.api.Aggregate.add.

Doc from org.h2.api.Aggregate.add.

This method is called once for each row. If the aggregate function is called with multiple parameters, those are passed as array.

Parameters
value:Object

the value(s) for this row

Annotations
@Override
Exceptions
SQLException:
on failure
getInternalTypeback to summary
public int getInternalType(int[] inputTypes) throws SQLException

Implements org.h2.api.Aggregate.getInternalType.

Doc from org.h2.api.Aggregate.getInternalType.

This method must return the H2 data type, org.h2.value.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.

Parameters
inputTypes:int[]

the H2 data type of the parameters,

Returns:int

the H2 data type of the result

Annotations
@Override
Exceptions
SQLException:
if the number/type of parameters passed is incorrect
getResultback to summary
public Object getResult() throws SQLException

Implements org.h2.api.Aggregate.getResult.

Doc from org.h2.api.Aggregate.getResult.

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.

Returns:Object

the aggregated value

Annotations
@Override
Exceptions
SQLException:
on failure
initback to summary
public void init(Connection conn) throws SQLException

Overrides default org.h2.api.Aggregate.init.

Doc from org.h2.api.Aggregate.init.

This method is called when the aggregate function is used. A new object is created for each invocation.

Parameters
conn:Connection

a connection to the database

Annotations
@Override
Exceptions
SQLException:
on SQL exception