Revision 8777
Added by Aaron Marcuse-Kubitza over 11 years ago
lib/runscripts/local.run | ||
---|---|---|
9 | 9 |
|
10 | 10 |
export PATH="$bin_dir:$PATH" |
11 | 11 |
|
12 |
mysql () |
|
13 |
{ |
|
14 |
echo_func "$@" |
|
15 |
echo_run mysql_bien --database="$schema" --verbose "$@" |
|
16 |
} |
|
17 |
|
|
18 |
psql () # usage: ([file=...] [dir=...]; self) |
|
19 |
{ |
|
20 |
echo_func "$@" |
|
21 |
local dir="$dir" |
|
22 |
if test -n "$file"; then |
|
23 |
set -- --file "$file" "$@" |
|
24 |
: "${dir:=$(dirname "$file")}" |
|
25 |
fi |
|
26 |
: "${dir:=$top_dir}" |
|
27 |
|
|
28 |
(cat <<EOF |
|
29 |
\cd $dir |
|
30 |
\set schema "$schema" |
|
31 |
\set table "$table" |
|
32 |
\set table_str '''"$table"''' |
|
33 |
SET search_path TO "$schema", util; |
|
34 |
EOF |
|
35 |
cat)| |
|
36 |
echo_run env no_search_path=1 psql_verbose_vegbien "$@" |
|
37 |
} |
|
38 |
|
|
12 | 39 |
fi |
lib/util.sh | ||
---|---|---|
130 | 130 |
mysql () |
131 | 131 |
{ |
132 | 132 |
echo_func "$@" |
133 |
echo_run mysql_bien --database="$schema" --verbose "$@"
|
|
133 |
echo_run env mysql --verbose "$@"
|
|
134 | 134 |
} |
135 | 135 |
|
136 | 136 |
mysql_ANSI () |
... | ... | |
139 | 139 |
(echo "SET sql_mode = 'ANSI';"; cat)|mysql "$@" |
140 | 140 |
} |
141 | 141 |
|
142 |
psql () # usage: ([file=...] [dir=...]; self) |
|
143 |
{ |
|
144 |
echo_func "$@" |
|
145 |
local dir="$dir" |
|
146 |
if test -n "$file"; then |
|
147 |
set -- --file "$file" "$@" |
|
148 |
: "${dir:=$(dirname "$file")}" |
|
149 |
fi |
|
150 |
: "${dir:=$top_dir}" |
|
151 |
|
|
152 |
(cat <<EOF |
|
153 |
\cd $dir |
|
154 |
\set schema "$schema" |
|
155 |
\set table "$table" |
|
156 |
\set table_str '''"$table"''' |
|
157 |
SET search_path TO "$schema", util; |
|
158 |
EOF |
|
159 |
cat)| |
|
160 |
echo_run env no_search_path=1 psql_verbose_vegbien "$@" |
|
161 |
} |
|
162 |
|
|
163 | 142 |
fi |
Also available in: Unified diff
bugfix: lib/util.sh: moved mysql (), psql () to local.run because they use local commands that are only available after local.run sets the PATH. retain a mysql () function in util.sh that adds the --verbose option to mysql.