EMMA Coverage Report (generated Sun Mar 01 22:06:14 CET 2015)
[all classes][org.h2.command.ddl]

COVERAGE SUMMARY FOR SOURCE FILE [DropAggregate.java]

nameclass, %method, %block, %line, %
DropAggregate.java100% (1/1)100% (5/5)100% (48/48)100% (16/16)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class DropAggregate100% (1/1)100% (5/5)100% (48/48)100% (16/16)
DropAggregate (Session): void 100% (1/1)100% (4/4)100% (2/2)
getType (): int 100% (1/1)100% (2/2)100% (1/1)
setIfExists (boolean): void 100% (1/1)100% (4/4)100% (2/2)
setName (String): void 100% (1/1)100% (4/4)100% (2/2)
update (): int 100% (1/1)100% (34/34)100% (9/9)

1/*
2 * Copyright 2004-2014 H2 Group. Multiple-Licensed under the MPL 2.0,
3 * and the EPL 1.0 (http://h2database.com/html/license.html).
4 * Initial Developer: H2 Group
5 */
6package org.h2.command.ddl;
7 
8import org.h2.api.ErrorCode;
9import org.h2.command.CommandInterface;
10import org.h2.engine.Database;
11import org.h2.engine.Session;
12import org.h2.engine.UserAggregate;
13import org.h2.message.DbException;
14 
15/**
16 * This class represents the statement
17 * DROP AGGREGATE
18 */
19public class DropAggregate extends DefineCommand {
20 
21    private String name;
22    private boolean ifExists;
23 
24    public DropAggregate(Session session) {
25        super(session);
26    }
27 
28    @Override
29    public int update() {
30        session.getUser().checkAdmin();
31        session.commit(true);
32        Database db = session.getDatabase();
33        UserAggregate aggregate = db.findAggregate(name);
34        if (aggregate == null) {
35            if (!ifExists) {
36                throw DbException.get(ErrorCode.AGGREGATE_NOT_FOUND_1, name);
37            }
38        } else {
39            db.removeDatabaseObject(session, aggregate);
40        }
41        return 0;
42    }
43 
44    public void setName(String name) {
45        this.name = name;
46    }
47 
48    public void setIfExists(boolean ifExists) {
49        this.ifExists = ifExists;
50    }
51 
52    @Override
53    public int getType() {
54        return CommandInterface.DROP_AGGREGATE;
55    }
56 
57}

[all classes][org.h2.command.ddl]
EMMA 2.0.5312 (C) Vladimir Roubtsov