From db7297e33f23fc769b9bfc43616ec087cc068b70 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 17 Jan 2012 16:48:14 +0200 Subject: Add support for SQL Server in various build scripts --- test/unix/build | 8 +++-- test/windows/README | 1 + test/windows/odb/all | 2 +- test/windows/odb/mingw/build | 4 ++- test/windows/odb/mssql-driver.bat | 63 +++++++++++++++++++++++++++++++++++++++ test/windows/odb/mssql.options | 10 +++++++ test/windows/odb/setenv.bat | 4 +-- test/windows/odb/unpack | 10 +++++-- 8 files changed, 93 insertions(+), 9 deletions(-) create mode 100644 test/windows/odb/mssql-driver.bat create mode 100644 test/windows/odb/mssql.options (limited to 'test') 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 +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 -- cgit v1.1