Project

General

Profile

« Previous | Next » 

Revision 8992

inputs/GBIF/MySQL_export: only include WHERE clause if $filter is set. support configuring LIMIT/OFFSET.

View differences:

inputs/GBIF/MySQL_export
3 3
# Usage: env table=... [filter=...] self >out
4 4
. "$(dirname "${BASH_SOURCE[0]}")"/../../lib/util.sh
5 5

  
6
: "${table:?}" "${filter:=1}"
6
: "${table:?}"
7 7

  
8 8
(cat <<EOF
9 9
SELECT * FROM $table
10
WHERE $filter
10
${filter:+WHERE $filter}
11
${limit:+LIMIT $limit }${offset:+OFFSET $offset}
11 12
EOF
12 13
)|echo_stdin|echo_run "time" ssh vegbiendev mysql --user=bien \
13 14
--password="$(cat "$top_dir"/../../config/bien_password)" --database=GBIF \

Also available in: Unified diff