QUERY=$1
shift
if [ $# -gt 1 ]; then
- mysql -N -B $* -e "${QUERY}"
+ mysql -N -B "$@" -e "${QUERY}"
retcode=$?
else
- mysql -N -B --user=$db_user --password=$db_password -e "${QUERY}" $db_name
+ mysql -N -B --database=${db_name} --user=${db_user} --password=${db_password} -e "${QUERY}"
retcode="$?"
fi
QUERY=$1
shift
if [ $# -gt 0 ]; then
- echo $QUERY | psql --set ON_ERROR_STOP=1 -A -t -h localhost -q $*
+ echo "${QUERY}" | psql --set ON_ERROR_STOP=1 -A -t -h localhost -q "#@"
retcode=$?
else
export PGPASSWORD=$db_password
- echo $QUERY | psql --set ON_ERROR_STOP=1 -A -t -h localhost -q -U $db_user -d $db_name
+ echo "${QUERY}" | psql --set ON_ERROR_STOP=1 -A -t -h localhost -q -U "${db_user}" -d "${db_name}"
retcode=$?
fi
return $retcode
file=$1
shift
if [ $# -gt 0 ]; then
- psql --set ON_ERROR_STOP=1 -A -t -h localhost -q -f $file $*
+ psql --set ON_ERROR_STOP=1 -A -t -h localhost -q -f "${file}" "$@"
retcode=$?
else
export PGPASSWORD=$db_password
- psql --set ON_ERROR_STOP=1 -A -t -h localhost -q -U $db_user -d $db_name -f $file
+ psql --set ON_ERROR_STOP=1 -A -t -h localhost -q -U "${db_user}" -d "${db_name}" -f "${file}"
retcode=$?
fi
return $retcode
query=$1
shift
if [ $# -gt 1 ]; then
- cqlsh $* -e "$query"
+ cqlsh "$@" -e "$query"
retcode=$?
else
- cqlsh -u $db_user -p $db_password -k $db_name -e "$query"
+ cqlsh -u "${db_user}" -p "${db_password}" -k "${db_name}" -e "${query}"
retcode=$?
fi
if [ $retcode -ne 0 ]; then
- printf "cqlsh returned with exit status $retcode\n"
+ printf "cqlsh returned with exit status %s\n" "${retcode}"
exit $retcode
fi
file=$1
shift
if [ $# -gt 1 ]; then
- cqlsh $* -e "$file"
+ cqlsh "$@" -e "$file"
retcode=$?
else
- cqlsh -u $db_user -p $db_password -k $db_name -f "$file"
+ cqlsh -u "${db_user}" -p "${db_password}" -k "${db_name}" -f "${file}"
retcode=$?
fi
if [ $retcode -ne 0 ]; then
- printf "cqlsh returned with exit status $retcode\n"
+ printf "cqlsh returned with exit status %s\n" "${retcode}"
exit $retcode
fi
}
cql_version() {
- version=`cql_execute "SELECT version, minor FROM schema_version" "$@"`
- version=`echo "$version" | grep -A 1 "+" | grep -v "+" | tr -d ' ' | cut -d "|" -f 1-2 --output-delimiter="."`
- echo $version
+ version=$(cql_execute "SELECT version, minor FROM schema_version" "$@")
+ version=$(echo "$version" | grep -A 1 "+" | grep -v "+" | tr -d ' ' | cut -d "|" -f 1-2 --output-delimiter=".")
+ echo "${version}"
return $?
}