aboutsummaryrefslogtreecommitdiff
path: root/build
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2011-11-28 15:51:56 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2012-01-20 15:45:46 +0200
commitee207bcbca247538de9ebbd64484708732a891e1 (patch)
tree287b31a714ffa019042b0257e22099ed519d3871 /build
parentcbefe1f332b590f8d239d3d97de61d500cdd40e9 (diff)
Add driver wrapper and options file generation for SQL Server
Diffstat (limited to 'build')
-rwxr-xr-xbuild/mssql/configure44
-rwxr-xr-xbuild/mssql/mssql52
2 files changed, 95 insertions, 1 deletions
diff --git a/build/mssql/configure b/build/mssql/configure
index c7d1b1b..5013609 100755
--- a/build/mssql/configure
+++ b/build/mssql/configure
@@ -9,4 +9,46 @@
# dcf_root - dynamic configuration root
#
-#@@ TODO
+$echo
+$echo "Please enter the SQL Server client program path."
+$echo
+
+driver=`read_path --command sqlcmd`
+
+$echo
+$echo "Please enter the SQL Server database user."
+$echo
+
+user=`read_value "odb_test"`
+
+$echo
+$echo "Please enter the SQL Server database password."
+$echo
+
+passwd=`read_value "odb_test"`
+
+$echo
+$echo "Please enter the SQL Server database name. Note that it WILL BE"
+$echo "MODIFIED by the tests."
+$echo
+
+db=`read_value "odb_test"`
+
+$echo
+$echo "Please enter the SQL Server instance address."
+$echo
+
+server=`read_value ""`
+
+opt=$dcf_root/db.options
+drv=$dcf_root/db-driver
+
+echo "--user '$user'" >$opt
+echo "--password '$passwd'" >>$opt
+echo "--database '$db'" >>$opt
+echo "--server '$server'" >>$opt
+
+echo "#!/bin/sh" >$drv
+echo "opt=\`cat $opt\`" >>$drv
+echo "eval $scf_root/mssql/mssql --driver $driver \$opt \$*" >>$drv
+chmod 755 $drv
diff --git a/build/mssql/mssql b/build/mssql/mssql
new file mode 100755
index 0000000..44c52b3
--- /dev/null
+++ b/build/mssql/mssql
@@ -0,0 +1,52 @@
+#! /usr/bin/env bash
+
+# file : build/mssql/mssql
+# author : Boris Kolpackov <boris@codesynthesis.com>
+# copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC
+# license : GNU GPL v2; see accompanying LICENSE file
+
+#
+# SQL Server driver wrapper.
+#
+
+opt=
+
+while [ $# -gt 0 ]; do
+ case $1 in
+ --driver)
+ driver=$2
+ shift 2
+ ;;
+ --user)
+ opt="$opt -U $2"
+ shift 2
+ ;;
+ --password)
+ opt="$opt -P $2"
+ shift 2
+ ;;
+ --database)
+ opt="$opt -d $2"
+ shift 2
+ ;;
+ --server)
+ opt="$opt -S $2"
+ shift 2
+ ;;
+ *)
+ break
+ ;;
+ esac
+done
+
+if [ -z "$driver" ]; then
+ driver=sqlcmd
+fi
+
+opt="-x -r -b $opt"
+
+if [ -n "$1" ]; then
+ exec $driver $opt -i $1
+else
+ exec $driver $opt
+fi