Project

General

Profile

1
#!/bin/bash -e
2
# links to locally-available resources
3
. "$(dirname "${BASH_SOURCE[0]}")"/util.run
4

    
5
if self_not_included; then
6

    
7
root_dir="$(dirname "${BASH_SOURCE[0]}")"/../..
8
bin_dir="$root_dir"/bin
9

    
10
export PATH="$bin_dir:$PATH"
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

    
39
fi
(2-2/4)