diff options
author | Constantin Michael <constantin@codesynthesis.com> | 2011-05-04 17:17:59 +0200 |
---|---|---|
committer | Constantin Michael <constantin@codesynthesis.com> | 2011-07-06 09:52:33 +0200 |
commit | bc54b4bd56c757ec1279896b8b0639a4a9a7e0cd (patch) | |
tree | 813c462512f83e13e47d4b07c5faccd780f7b108 /build/pgsql | |
parent | b8d88b289aca145edbf031adbe904d877d93f3ba (diff) |
Add test infrastructure for libodb-pgsql
Diffstat (limited to 'build/pgsql')
-rwxr-xr-x | build/pgsql/configure | 62 | ||||
-rwxr-xr-x | build/pgsql/pgsql | 52 |
2 files changed, 114 insertions, 0 deletions
diff --git a/build/pgsql/configure b/build/pgsql/configure new file mode 100755 index 0000000..cd500a2 --- /dev/null +++ b/build/pgsql/configure @@ -0,0 +1,62 @@ +#! /usr/bin/env bash + +# file : build/pgsql/configure +# author : Constantin Michael <constantin@codesynthesis.com> +# copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC +# license : GNU GPL v2; see accompanying LICENSE file + +# +# dcf_root - dynamic configuration root +# + +$echo +$echo "Please enter the PostgreSQL client program path." +$echo + +driver=`read_path --command psql` + +$echo +$echo "Please enter the PostgreSQL database user." +$echo + +user=`read_value "odb_test"` + +$echo +$echo "Please enter the PostgreSQL database password." +$echo + +passwd=`read_value ""` + +$echo +$echo "Please enter the PostgreSQL database name. Note that it WILL BE" +$echo "MODIFIED by the tests." +$echo + +db=`read_value "odb_test"` + +$echo +$echo "Please enter the PostgreSQL database host." +$echo + +host=`read_value ""` + +$echo +$echo "Please enter the PostgreSQL database port or the socket file name" +$echo "extension for Unix-domain connections." +$echo + +port=`read_value "0"` + +opt=$dcf_root/db.options +drv=$dcf_root/db-driver + +echo "--user '$user'" >$opt +echo "--password '$passwd'" >>$opt +echo "--dbname '$db'" >>$opt +echo "--host '$host'" >>$opt +echo "--port $port" >>$opt + +echo "#!/bin/sh" >$drv +echo "opt=\`cat $opt\`" >>$drv +echo "eval $scf_root/pgsql/pgsql --driver $driver \$opt \$*" >>$drv +chmod 755 $drv diff --git a/build/pgsql/pgsql b/build/pgsql/pgsql new file mode 100755 index 0000000..9e576ff --- /dev/null +++ b/build/pgsql/pgsql @@ -0,0 +1,52 @@ +#! /usr/bin/env bash + +# file : build/mysql/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 + ;; + --password) + opt="$opt --password=$2" + shift 2 + ;; + --dbname) + 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 + +if [ -n "$1" ]; then + exec $driver $opt <$1 +else + exec $driver $opt +fi |