summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2012-01-17 16:48:14 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2012-01-17 16:48:14 +0200
commitdb7297e33f23fc769b9bfc43616ec087cc068b70 (patch)
tree9df861a3b690e646babb875d4ac68d37e481f267
parent89083807dc047bd86e71481dbbdf7c32d18cb2bc (diff)
Add support for SQL Server in various build scripts
-rwxr-xr-xdist.sh42
-rwxr-xr-xtest/unix/build8
-rw-r--r--test/windows/README1
-rwxr-xr-xtest/windows/odb/all2
-rwxr-xr-xtest/windows/odb/mingw/build4
-rw-r--r--test/windows/odb/mssql-driver.bat63
-rw-r--r--test/windows/odb/mssql.options10
-rwxr-xr-xtest/windows/odb/setenv.bat4
-rwxr-xr-xtest/windows/odb/unpack10
9 files changed, 133 insertions, 11 deletions
diff --git a/dist.sh b/dist.sh
index ef85985..d999581 100755
--- a/dist.sh
+++ b/dist.sh
@@ -58,6 +58,8 @@ pgsql_options=
pgsql_test_option=
oracle_options=
oracle_test_options=
+mssql_options=
+mssql_test_options=
while [ $# -gt 0 ]; do
case $1 in
@@ -134,6 +136,16 @@ while [ $# -gt 0 ]; do
oracle_test_options=$1
shift
;;
+ -mssql-options)
+ shift
+ mssql_options=$1
+ shift
+ ;;
+ -mssql-test-options)
+ shift
+ mssql_test_options=$1
+ shift
+ ;;
*)
error "unknown option: $1"
exit 1
@@ -142,13 +154,14 @@ while [ $# -gt 0 ]; do
done
if [ "$db" = "" ]; then
- db="oracle pgsql sqlite mysql"
+ db="mssql oracle pgsql sqlite mysql"
fi
# Clean everything up if we are rebuilding.
#
if [ $rebuild = y ]; then
rm -rf $out_root/libodb/*
+ rm -rf $out_root/libodb-mssql/*
rm -rf $out_root/libodb-oracle/*
rm -rf $out_root/libodb-pgsql/*
rm -rf $out_root/libodb-sqlite/*
@@ -166,7 +179,8 @@ if [ $rebuild = y ]; then
rm -rf $out_root/pack
fi
-mkdir -p $out_root/libodb\
+mkdir -p $out_root/libodb
+mkdir -p $out_root/libodb-mssql
mkdir -p $out_root/libodb-oracle
mkdir -p $out_root/libodb-pgsql
mkdir -p $out_root/libodb-sqlite
@@ -235,6 +249,30 @@ cp $out_root/libodb/libodb-$ver.*.zip $out_root/pack/
cp $out_root/libodb/libodb-$ver.*.tar.gz $out_root/pack/
cp $out_root/libodb/libodb-$ver.*.tar.bz2 $out_root/pack/
+# Build libodb-mssql
+#
+make -C `find_out_dir $src_root/libodb-mssql` \
+-f $src_root/libodb-mssql/makefile dist dist_prefix=$out_root/libodb-mssql
+
+cd $out_root/libodb-mssql
+
+if [ $rebuild = y ]; then
+ ./bootstrap
+ ./configure --with-libodb=../libodb \
+ CXX=$cxx \
+ CXXFLAGS="$CXXFLAGS" \
+ $mssql_options
+fi
+
+make -j 8
+make dist
+
+cd $wd
+
+cp $out_root/libodb-mssql/libodb-mssql-$ver.*.zip $out_root/pack/
+cp $out_root/libodb-mssql/libodb-mssql-$ver.*.tar.gz $out_root/pack/
+cp $out_root/libodb-mssql/libodb-mssql-$ver.*.tar.bz2 $out_root/pack/
+
# Build libodb-oracle
#
make -C `find_out_dir $src_root/libodb-oracle` \
diff --git a/test/unix/build b/test/unix/build
index 5315be4..ce8d162 100755
--- a/test/unix/build
+++ b/test/unix/build
@@ -88,6 +88,10 @@ done
if [ "$db" = "" ]; then
db="oracle pgsql sqlite mysql"
+
+ if [ "`uname`" = "Linux" ]; then
+ db="mssql $db"
+ fi
fi
src=/tmp/pack
@@ -95,8 +99,8 @@ src=/tmp/pack
v=`echo $src/libodb-?.*.tar.bz2 | sed -e "s%$src/libodb-\(.*\).tar.bz2%\1%"`
cutl_v=`echo $src/../libcutl-?.*.tar.bz2 | sed -e "s%$src/\.\./libcutl-\(.*\).tar.bz2%\1%"`
-install_packs="libodb libodb-oracle libodb-pgsql libodb-sqlite libodb-mysql \
-libodb-boost libodb-qt odb"
+install_packs="libodb libodb-mssql libodb-oracle libodb-pgsql libodb-sqlite \
+libodb-mysql libodb-boost libodb-qt odb"
packs=$install_packs
diff --git a/test/windows/README b/test/windows/README
index 057c6dc..55532d0 100644
--- a/test/windows/README
+++ b/test/windows/README
@@ -26,6 +26,7 @@ Steps:
boost
qtcore
odb/libodb
+ odb/libodb-mssql
odb/libodb-mysql
odb/libodb-oracle
odb/libodb-pgsql
diff --git a/test/windows/odb/all b/test/windows/odb/all
index fe537b1..e4a5532 100755
--- a/test/windows/odb/all
+++ b/test/windows/odb/all
@@ -27,7 +27,7 @@ if [ "$2" = "" ]; then
exit 1
else
if [ "$2" = "all" ]; then
- databases="oracle pgsql sqlite mysql"
+ databases="mssql oracle pgsql sqlite mysql"
else
databases=$2
fi
diff --git a/test/windows/odb/mingw/build b/test/windows/odb/mingw/build
index 950da9c..8592db4 100755
--- a/test/windows/odb/mingw/build
+++ b/test/windows/odb/mingw/build
@@ -36,6 +36,7 @@ mysql_options="--with-mysql-host=192.168.0.5 --with-mysql-client=$MYSQL/bin/mysq
sqlite_options="--with-sqlite-db=c:\\projects\\odb\\odb_test.db"
pgsql_options="--with-pgsql-host=192.168.0.5 --with-pgsql-client=$PGSQL/bin/psql.exe"
oracle_options="--with-oracle-host=192.168.0.5 --with-oracle-service=xe --with-oracle-client=$ORACLE/sqlplus.exe"
+mssql_options="--with-mssql-server=windows2008r2\\ss2008r2,1435"
test=n
rebuild=n
@@ -64,13 +65,14 @@ while [ $# -gt 0 ]; do
done
if [ "$db" = "" ]; then
- db="oracle pgsql sqlite mysql"
+ db="mssql oracle pgsql sqlite mysql"
fi
# Clean everything up if we are rebuilding.
#
if [ $rebuild = y ]; then
clean libodb
+ clean libodb-mssql
clean libodb-oracle
clean libodb-pgsql
clean libodb-sqlite
diff --git a/test/windows/odb/mssql-driver.bat b/test/windows/odb/mssql-driver.bat
new file mode 100644
index 0000000..10685a6
--- /dev/null
+++ b/test/windows/odb/mssql-driver.bat
@@ -0,0 +1,63 @@
+@echo off
+rem file : mssql-driver.bat
+rem author : Boris Kolpackov <boris@codesynthesis.com>
+rem copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC
+rem license : GNU GPL v2; see accompanying LICENSE file
+
+rem
+rem mssql-driver.bat sql-file
+rem
+rem Run the mssql client on the SQL file specified. Adjust the
+rem options below to match your SQL Server setup.
+rem
+
+setlocal
+
+set "options=%MSSQL_OPTIONS%"
+
+rem User.
+rem
+set "options=%options% -U odb_test"
+
+rem Password.
+rem
+set "options=%options% -P odb_test"
+
+rem Database name.
+rem
+set "options=%options% -d odb_test"
+
+rem SQL Server instance address.
+rem
+set "options=%options% -S X\Y"
+rem set "options=%options% -S tcp:host,port"
+
+rem Standard options.
+rem
+set "options=%options% -x -r -b"
+
+set "mssql=%MSSQL_CLIENT%"
+
+if "_%mssql%_" == "__" set "mssql=sqlcmd"
+
+if "_%1_" == "__" (
+ echo no sql file specified
+ goto usage
+)
+
+%mssql% %options% -i %1
+
+if errorlevel 1 goto error
+goto end
+
+:usage
+echo.
+echo usage: mssql-driver.bat sql-file
+echo.
+
+:error
+endlocal
+exit /b 1
+
+:end
+endlocal
diff --git a/test/windows/odb/mssql.options b/test/windows/odb/mssql.options
new file mode 100644
index 0000000..36be670
--- /dev/null
+++ b/test/windows/odb/mssql.options
@@ -0,0 +1,10 @@
+# Sample Microsoft SQL Server options file used to run the tests. Adjust to
+# match your SQL Server setup.
+#
+
+--user odb_test
+--password odb_test
+--database odb_test
+--server X\Y
+# --server tcp:host,port
+# --driver
diff --git a/test/windows/odb/setenv.bat b/test/windows/odb/setenv.bat
index c8b92bd..3d2b6c4 100755
--- a/test/windows/odb/setenv.bat
+++ b/test/windows/odb/setenv.bat
@@ -19,8 +19,8 @@ rem set "NLS_LANG=AMERICA_AMERICA.WE8MSWIN1252"
set "DIFF=c:\cygwin\bin\diff.exe -ubB"
if "_%1_" == "_9_" set "DEVENV=c:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\devenv.com"
if "_%1_" == "_10_" set "DEVENV=c:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.com"
-set PATH=%ODB%\libodb\bin;%ODB%\libodb-sqlite\bin;%ODB%\libodb-mysql\bin;%ODB%\libodb-pgsql\bin;%ODB%\libodb-oracle\bin;%ODB%\libodb-boost\bin;%ODB%\libodb-qt\bin;%MYSQL%\bin;%SQLITE%\bin;%PGSQL%\bin;%ORACLE%;%QTCORE%\bin;%PATH%
-set PATH=%ODB%\libodb\bin64;%ODB%\libodb-sqlite\bin64;%ODB%\libodb-mysql\bin64;%ODB%\libodb-pgsql\bin64;%ODB%\libodb-oracle\bin64;%ODB%\libodb-boost\bin64;%ODB%\libodb-qt\bin64;%MYSQL64%\bin;%SQLITE%\bin64;%PGSQL64%\bin;%ORACLE64%;%QTCORE64%\bin;%PATH%
+set PATH=%ODB%\libodb\bin;%ODB%\libodb-sqlite\bin;%ODB%\libodb-mysql\bin;%ODB%\libodb-pgsql\bin;%ODB%\libodb-oracle\bin;%ODB%\libodb-mssql\bin;%ODB%\libodb-boost\bin;%ODB%\libodb-qt\bin;%MYSQL%\bin;%SQLITE%\bin;%PGSQL%\bin;%ORACLE%;%QTCORE%\bin;%PATH%
+set PATH=%ODB%\libodb\bin64;%ODB%\libodb-sqlite\bin64;%ODB%\libodb-mysql\bin64;%ODB%\libodb-pgsql\bin64;%ODB%\libodb-oracle\bin64;%ODB%\libodb-mssql\bin64;%ODB%\libodb-boost\bin64;%ODB%\libodb-qt\bin64;%MYSQL64%\bin;%SQLITE%\bin64;%PGSQL64%\bin;%ORACLE64%;%QTCORE64%\bin;%PATH%
if "_%2_" == "__" goto end
diff --git a/test/windows/odb/unpack b/test/windows/odb/unpack
index 8f40853..d3a37d6 100755
--- a/test/windows/odb/unpack
+++ b/test/windows/odb/unpack
@@ -12,7 +12,7 @@ function error ()
echo "$*" 1>&2
}
-databases="oracle pgsql sqlite mysql"
+databases="mssql oracle pgsql sqlite mysql"
mingw=n
while [ $# -gt 0 ]; do
@@ -34,8 +34,9 @@ else
base=/cygdrive/t/pack
fi
-rm -rf libodb libodb-oracle libodb-pgsql libodb-sqlite libodb-mysql libodb-boost \
-libodb-qt odb odb-tests odb-examples odb-tests-* odb-examples-*
+rm -rf libodb libodb-mssql libodb-oracle libodb-pgsql libodb-sqlite \
+libodb-mysql libodb-boost libodb-qt odb odb-tests odb-examples \
+odb-tests-* odb-examples-*
v=`echo $base/libodb-?.*.zip | sed -e "s%$base/libodb-\(.*\).zip%\1%"`
@@ -44,6 +45,9 @@ echo unpacking $v from $base
unzip -q $base/libodb-$v.zip
mv libodb-$v libodb
+unzip -q $base/libodb-mssql-$v.zip
+mv libodb-mssql-$v libodb-mssql
+
unzip -q $base/libodb-oracle-$v.zip
mv libodb-oracle-$v libodb-oracle