Search in sources :

Example 6 with UserAggregate

use of org.h2.engine.UserAggregate in project h2database by h2database.

the class CreateAggregate method update.

@Override
public int update() {
    session.commit(true);
    session.getUser().checkAdmin();
    Database db = session.getDatabase();
    if (db.findAggregate(name) != null || schema.findFunction(name) != null) {
        if (!ifNotExists) {
            throw DbException.get(ErrorCode.FUNCTION_ALIAS_ALREADY_EXISTS_1, name);
        }
    } else {
        int id = getObjectId();
        UserAggregate aggregate = new UserAggregate(db, id, name, javaClassMethod, force);
        db.addDatabaseObject(session, aggregate);
    }
    return 0;
}
Also used : UserAggregate(org.h2.engine.UserAggregate) Database(org.h2.engine.Database)

Aggregations

UserAggregate (org.h2.engine.UserAggregate)5 Database (org.h2.engine.Database)3 ValueExpression (org.h2.expression.ValueExpression)3 ValueString (org.h2.value.ValueString)3 IOException (java.io.IOException)2 ArrayList (java.util.ArrayList)2 Constraint (org.h2.constraint.Constraint)2 DbObject (org.h2.engine.DbObject)2 Right (org.h2.engine.Right)2 Role (org.h2.engine.Role)2 Setting (org.h2.engine.Setting)2 User (org.h2.engine.User)2 UserDataType (org.h2.engine.UserDataType)2 Expression (org.h2.expression.Expression)2 Index (org.h2.index.Index)2 Constant (org.h2.schema.Constant)2 Schema (org.h2.schema.Schema)2 SchemaObject (org.h2.schema.SchemaObject)2 Sequence (org.h2.schema.Sequence)2 TriggerObject (org.h2.schema.TriggerObject)2