Revision 9777
Added by Aaron Marcuse-Kubitza over 11 years ago
db.sh | ||
---|---|---|
131 | 131 |
|
132 | 132 |
mysql_root() { echo_func; use_root; mysql "$@"; } |
133 | 133 |
|
134 |
mysql_truncate() { echo_func; mk_truncate|mysql_ANSI; }
|
|
134 |
mysql_truncate() { echo_func; mk_truncate|mysql; } |
|
135 | 135 |
|
136 | 136 |
mysql_import() # usage: table=... [cols=...] [append=1] mysql_import <file |
137 | 137 |
# without append=1, first ensures the table is empty |
... | ... | |
147 | 147 |
mysql_load_data_format="${mysql_load_data_format% |
148 | 148 |
}" |
149 | 149 |
ssh2local # ssh does not tunnel nonstandard fds |
150 |
mysql_ANSI "$@" 40<&0 <<EOF
|
|
150 |
mysql "$@" 40<&0 <<EOF |
|
151 | 151 |
LOAD DATA LOCAL INFILE '/dev/fd/40' |
152 | 152 |
${append:+IGNORE }INTO TABLE $table_esc |
153 | 153 |
$mysql_load_data_format |
... | ... | |
162 | 162 |
echo_func |
163 | 163 |
mk_select_var |
164 | 164 |
|
165 |
output_data=1 mysql_ANSI "$@" <<<"$query"
|
|
165 |
output_data=1 mysql "$@" <<<"$query" |
|
166 | 166 |
} |
167 | 167 |
|
168 | 168 |
mysql_export_outfile() # supports CSV, but requires the FILE privilege |
... | ... | |
181 | 181 |
local tail="${query#$head}" |
182 | 182 |
mysql_load_data_format="${mysql_load_data_format% |
183 | 183 |
}" |
184 |
mysql_ANSI "$@" <<EOF
|
|
184 |
mysql "$@" <<EOF |
|
185 | 185 |
$head |
186 | 186 |
INTO OUTFILE '$file' |
187 | 187 |
$mysql_load_data_format |
Also available in: Unified diff
*{.sh,run}: use mysql instead of mysql_ANSI because mysql is now an alias to mysql_ANSI (since ANSI mode still supports key MySQL features, like `` quotes)