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

COVERAGE SUMMARY FOR SOURCE FILE [SelectOrderBy.java]

nameclass, %method, %block, %line, %
SelectOrderBy.java100% (1/1)100% (2/2)82%  (41/50)83%  (10/12)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class SelectOrderBy100% (1/1)100% (2/2)82%  (41/50)83%  (10/12)
getSQL (): String 100% (1/1)81%  (38/47)82%  (9/11)
SelectOrderBy (): void 100% (1/1)100% (3/3)100% (1/1)

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.dml;
7 
8import org.h2.expression.Expression;
9 
10/**
11 * Describes one element of the ORDER BY clause of a query.
12 */
13public class SelectOrderBy {
14 
15    /**
16     * The order by expression.
17     */
18    public Expression expression;
19 
20    /**
21     * The column index expression. This can be a column index number (1 meaning
22     * the first column of the select list) or a parameter (the parameter is a
23     * number representing the column index number).
24     */
25    public Expression columnIndexExpr;
26 
27    /**
28     * If the column should be sorted descending.
29     */
30    public boolean descending;
31 
32    /**
33     * If NULL should be appear first.
34     */
35    public boolean nullsFirst;
36 
37    /**
38     * If NULL should be appear at the end.
39     */
40    public boolean nullsLast;
41 
42    public String getSQL() {
43        StringBuilder buff = new StringBuilder();
44        if (expression != null) {
45            buff.append('=').append(expression.getSQL());
46        } else {
47            buff.append(columnIndexExpr.getSQL());
48        }
49        if (descending) {
50            buff.append(" DESC");
51        }
52        if (nullsFirst) {
53            buff.append(" NULLS FIRST");
54        } else if (nullsLast) {
55            buff.append(" NULLS LAST");
56        }
57        return buff.toString();
58    }
59 
60}

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