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

COVERAGE SUMMARY FOR SOURCE FILE [DropFunctionAlias.java]

nameclass, %method, %block, %line, %
DropFunctionAlias.java100% (1/1)100% (5/5)100% (50/50)100% (16/16)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class DropFunctionAlias100% (1/1)100% (5/5)100% (50/50)100% (16/16)
DropFunctionAlias (Session, Schema): void 100% (1/1)100% (5/5)100% (2/2)
getType (): int 100% (1/1)100% (2/2)100% (1/1)
setAliasName (String): void 100% (1/1)100% (4/4)100% (2/2)
setIfExists (boolean): void 100% (1/1)100% (4/4)100% (2/2)
update (): int 100% (1/1)100% (35/35)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.FunctionAlias;
12import org.h2.engine.Session;
13import org.h2.message.DbException;
14import org.h2.schema.Schema;
15 
16/**
17 * This class represents the statement
18 * DROP ALIAS
19 */
20public class DropFunctionAlias extends SchemaCommand {
21 
22    private String aliasName;
23    private boolean ifExists;
24 
25    public DropFunctionAlias(Session session, Schema schema) {
26        super(session, schema);
27    }
28 
29    @Override
30    public int update() {
31        session.getUser().checkAdmin();
32        session.commit(true);
33        Database db = session.getDatabase();
34        FunctionAlias functionAlias = getSchema().findFunction(aliasName);
35        if (functionAlias == null) {
36            if (!ifExists) {
37                throw DbException.get(ErrorCode.FUNCTION_ALIAS_NOT_FOUND_1, aliasName);
38            }
39        } else {
40            db.removeSchemaObject(session, functionAlias);
41        }
42        return 0;
43    }
44 
45    public void setAliasName(String name) {
46        this.aliasName = name;
47    }
48 
49    public void setIfExists(boolean ifExists) {
50        this.ifExists = ifExists;
51    }
52 
53    @Override
54    public int getType() {
55        return CommandInterface.DROP_ALIAS;
56    }
57 
58}

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