Depending on SQL-statement nesting, some scripts already correctly sorted resulttypes alphabetically, but some sorted along the numeric ENUM value behind the resulttype name. This change explicitly converts the resulttype to a string before sorting. Change-Id: Ia18aa4e75b94a6a9f7bb125953bc85b86b3cbd6e
38 lines
821 B
Bash
38 lines
821 B
Bash
set -e
|
|
|
|
if [ "$1" = -t ]; then
|
|
FORMAT=-t
|
|
shift
|
|
else
|
|
FORMAT=-B
|
|
fi
|
|
|
|
if [ \( ! -z "${MUST_FILTER+x}" -a $# -ne 3 \) -o \( -z "${MUST_FILTER+x}" -a \( $# -lt 1 -o $# -gt 3 \) \) ]; then
|
|
if [ "$(type -t show_description)" = function ]; then
|
|
show_description
|
|
echo '' >&2
|
|
fi
|
|
if [ ! -z "${MUST_FILTER+x}" ]; then
|
|
echo "usage: $0 [ -t ] DATABASE BENCHMARK VARIANT" >&2
|
|
else
|
|
echo "usage: $0 [ -t ] DATABASE [ BENCHMARK [ VARIANT ] ]" >&2
|
|
fi
|
|
echo " -t Display output in table format (tab-separated CSV otherwise)" >&2
|
|
exit 1
|
|
fi
|
|
|
|
DATABASE=$1
|
|
BENCHMARK=$2
|
|
VARIANT=$3
|
|
MYSQL="mysql $FORMAT $DATABASE"
|
|
|
|
# don't filter anything by default
|
|
FILTER=1
|
|
if [ -n "$BENCHMARK" ]; then
|
|
FILTER="v.benchmark = '$BENCHMARK'"
|
|
if [ -n "$VARIANT" ]; then
|
|
FILTER="$FILTER AND v.variant = '$VARIANT'"
|
|
fi
|
|
fi
|
|
FILTER="($FILTER)"
|