Project

General

Profile

« Previous | Next » 

Revision 10396

lib/sh/db_make.sh: added pg_export_table_to_dir(), pg_export_tables_to_dir(). unlike db.sh pg_export_table_to_dir_no_header(), these functions are make-aware and will not clobber an existing file.

View differences:

lib/sh/db_make.sh
1 1
#!/bin/bash -e
2 2
. "$(dirname "${BASH_SOURCE[0]}")"/db.sh
3 3
.rel make.sh
4

  
5
if self_not_included; then
6

  
7
pg_export_table_to_dir()
8
{
9
	echo_func; set_make_vars; check_fake_target_exists
10
	local table="$1"; shift; mk_table_esc
11
	stdout="$exports_dir/$table.csv" to_file pg_export "$@"
12
}
13

  
14
pg_export_tables_to_dir()
15
# usage: exports_dir=... schema=... pg_export_tables_to_dir table...
16
{
17
	echo_func; kw_params exports_dir schema; : "${exports_dir:?}" "${schema:?}"
18
	for table in "$@"; do pg_export_table_to_dir "$table"; done
19
}
20

  
21
fi

Also available in: Unified diff