diff options
author | Constantin Michael <constantin@codesynthesis.com> | 2011-07-13 11:03:13 +0200 |
---|---|---|
committer | Constantin Michael <constantin@codesynthesis.com> | 2011-07-13 11:03:13 +0200 |
commit | e440e73a889c8929730632d62ebc84e32475b549 (patch) | |
tree | cefbcd5cac5e14e54c5a482af58e19d5973ea2e0 /build/pgsql/pgsql | |
parent | 292f71768c16e14369c7aea4ef0590b0a741c3bc (diff) |
Add PostgreSQL
Diffstat (limited to 'build/pgsql/pgsql')
-rwxr-xr-x | build/pgsql/pgsql | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/build/pgsql/pgsql b/build/pgsql/pgsql new file mode 100755 index 0000000..c1c2482 --- /dev/null +++ b/build/pgsql/pgsql @@ -0,0 +1,52 @@ +#! /usr/bin/env bash + +# file : build/pgsql/pgsql +# author : Constantin Michael <constantin@codesynthesis.com> +# copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC +# license : GNU GPL v2; see accompanying LICENSE file + +# +# PostgreSQL driver wrapper. +# + +while [ $# -gt 0 ]; do + case $1 in + --driver) + driver=$2 + shift 2 + ;; + --user) + opt="$opt --user=$2" + shift 2 + ;; + --database) + opt="$opt --dbname=$2" + shift 2 + ;; + --host) + opt="$opt --host=$2" + shift 2 + ;; + --port) + opt="$opt --port=$2" + shift 2 + ;; + *) + break + ;; + esac +done + +if [ -z "$driver" ]; then + driver=psql +fi + +opt="--quiet $opt" + +export PGOPTIONS=--client-min-messages=warning + +if [ -n "$1" ]; then + exec $driver $opt <$1 +else + exec $driver $opt +fi |