Project

General

Profile

1 8299 aaronmk
#!/bin/bash
2
set -o errexit
3
# Usage: env table=... [filter=...] self >out
4 8772 aaronmk
. "$(dirname "${BASH_SOURCE[0]}")"/../../lib/util.sh
5 8299 aaronmk
6 8992 aaronmk
: "${table:?}"
7 8299 aaronmk
8
(cat <<EOF
9
SELECT * FROM $table
10 8992 aaronmk
${filter:+WHERE $filter}
11
${limit:+LIMIT $limit }${offset:+OFFSET $offset}
12 8299 aaronmk
EOF
13
)|echo_stdin|echo_run "time" ssh vegbiendev mysql --user=bien \
14
--password="$(cat "$top_dir"/../../config/bien_password)" --database=GBIF \
15
--quick