Revision 10402
Added by Aaron Marcuse-Kubitza over 11 years ago
lib/sh/db.sh | ||
---|---|---|
48 | 48 |
mk_select() # usage: {query=... | table=... [cols=...] [filter=...]} mk_select |
49 | 49 |
{ |
50 | 50 |
echo_func; kw_params query table cols filter; mk_table_esc |
51 |
if is_array cols; then cols="$(cols2list "${cols[@]}")"; fi |
|
51 | 52 |
echo "$(rtrim "${query:-SELECT ${cols:-*} ${cols:+ |
52 | 53 |
}FROM $table_esc |
53 | 54 |
${filter:+WHERE $filter |
Also available in: Unified diff
lib/sh/db.sh: mk_select(): support passing $cols as array instead of SQL string, which is easier to enter in a shell script (less quotes, \ , etc.)