Revision 9777
Added by Aaron Marcuse-Kubitza over 11 years ago
inputs/GBIF/raw_occurrence_record_plants/run | ||
---|---|---|
19 | 19 |
echo_func; set_make_vars; mk_table_esc |
20 | 20 |
|
21 | 21 |
use_local_remote |
22 |
if remaking; then table=plant_fraction table_esc= mk_drop|mysql_ANSI; fi
|
|
22 |
if remaking; then table=plant_fraction table_esc= mk_drop|mysql; fi |
|
23 | 23 |
(benign_error=1 mysql <<'EOF' |
24 | 24 |
CREATE TABLE `plant_fraction` ( |
25 | 25 |
`institution_code` varchar(255) NOT NULL PRIMARY KEY, |
... | ... | |
28 | 28 |
) ENGINE=MyISAM DEFAULT CHARSET=utf8 |
29 | 29 |
EOF |
30 | 30 |
) || table=plant_fraction skip_table || return 0 |
31 |
mysql_ANSI <<EOF
|
|
31 |
mysql <<EOF |
|
32 | 32 |
INSERT INTO "plant_fraction" |
33 | 33 |
SELECT |
34 | 34 |
institution_code |
... | ... | |
57 | 57 |
plant_fraction/make |
58 | 58 |
use_local_remote |
59 | 59 |
if remaking; then |
60 |
table=plant_fraction_for_herbaria_filter table_esc= mk_drop|mysql_ANSI
|
|
60 |
table=plant_fraction_for_herbaria_filter table_esc= mk_drop|mysql |
|
61 | 61 |
fi |
62 | 62 |
(benign_error=1 mysql <<'EOF' |
63 | 63 |
CREATE VIEW `plant_fraction_for_herbaria_filter` AS |
... | ... | |
73 | 73 |
|
74 | 74 |
use_local_remote |
75 | 75 |
local table="$target_stem" |
76 |
if remaking; then mk_drop|mysql_ANSI; fi
|
|
76 |
if remaking; then mk_drop|mysql; fi |
|
77 | 77 |
|
78 | 78 |
herbaria_filter.ih.csv_/make |
79 | 79 |
plant_fraction_for_herbaria_filter/make |
... | ... | |
86 | 86 |
) || skip_table || return 0 |
87 | 87 |
|
88 | 88 |
time ( |
89 |
mysql_ANSI <<EOF
|
|
89 |
mysql <<EOF |
|
90 | 90 |
INSERT INTO "herbaria_filter" |
91 | 91 |
SELECT institution_code FROM plant_fraction_for_herbaria_filter |
92 | 92 |
EOF |
... | ... | |
108 | 108 |
|
109 | 109 |
herbaria_filter/make |
110 | 110 |
use_local_remote |
111 |
if remaking; then mk_drop|mysql_ANSI; fi
|
|
111 |
if remaking; then mk_drop|mysql; fi |
|
112 | 112 |
(benign_error=1 mysql <<EOF |
113 | 113 |
CREATE VIEW $table AS |
114 | 114 |
SELECT * FROM $full_table |
lib/sh/resume_import.sh | ||
---|---|---|
15 | 15 |
|
16 | 16 |
mk_table_esc |
17 | 17 |
use_local_remote |
18 |
data_only=1 mysql_ANSI \
|
|
18 |
data_only=1 mysql \ |
|
19 | 19 |
<<<"SELECT COUNT(*) FROM $table_esc WHERE $pkey_name = $pkey"|echo_stdout |
20 | 20 |
} |
21 | 21 |
|
lib/sh/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)