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

COVERAGE SUMMARY FOR SOURCE FILE [CommandList.java]

nameclass, %method, %block, %line, %
CommandList.java100% (1/1)80%  (8/10)73%  (48/66)76%  (16/21)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class CommandList100% (1/1)80%  (8/10)73%  (48/66)76%  (16/21)
query (int): ResultInterface 0%   (0/1)0%   (0/9)0%   (0/3)
queryMeta (): ResultInterface 0%   (0/1)0%   (0/4)0%   (0/1)
executeRemaining (): void 100% (1/1)72%  (13/18)80%  (4/5)
CommandList (Parser, String, Command, String): void 100% (1/1)100% (11/11)100% (4/4)
getCommandType (): int 100% (1/1)100% (4/4)100% (1/1)
getParameters (): ArrayList 100% (1/1)100% (4/4)100% (1/1)
isQuery (): boolean 100% (1/1)100% (4/4)100% (1/1)
isReadOnly (): boolean 100% (1/1)100% (2/2)100% (1/1)
isTransactional (): boolean 100% (1/1)100% (2/2)100% (1/1)
update (): int 100% (1/1)100% (8/8)100% (3/3)

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;
7 
8import java.util.ArrayList;
9import org.h2.expression.ParameterInterface;
10import org.h2.result.ResultInterface;
11 
12/**
13 * Represents a list of SQL statements.
14 */
15class CommandList extends Command {
16 
17    private final Command command;
18    private final String remaining;
19 
20    CommandList(Parser parser, String sql, Command c, String remaining) {
21        super(parser, sql);
22        this.command = c;
23        this.remaining = remaining;
24    }
25 
26    @Override
27    public ArrayList<? extends ParameterInterface> getParameters() {
28        return command.getParameters();
29    }
30 
31    private void executeRemaining() {
32        Command remainingCommand = session.prepareLocal(remaining);
33        if (remainingCommand.isQuery()) {
34            remainingCommand.query(0);
35        } else {
36            remainingCommand.update();
37        }
38    }
39 
40    @Override
41    public int update() {
42        int updateCount = command.executeUpdate();
43        executeRemaining();
44        return updateCount;
45    }
46 
47    @Override
48    public ResultInterface query(int maxrows) {
49        ResultInterface result = command.query(maxrows);
50        executeRemaining();
51        return result;
52    }
53 
54    @Override
55    public boolean isQuery() {
56        return command.isQuery();
57    }
58 
59    @Override
60    public boolean isTransactional() {
61        return true;
62    }
63 
64    @Override
65    public boolean isReadOnly() {
66        return false;
67    }
68 
69    @Override
70    public ResultInterface queryMeta() {
71        return command.queryMeta();
72    }
73 
74    @Override
75    public int getCommandType() {
76        return command.getCommandType();
77    }
78 
79}

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