aboutsummaryrefslogtreecommitdiff
path: root/libcommon
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2011-11-17 16:49:03 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2012-01-20 15:45:45 +0200
commit04201d013c2a43d27987122e0118236d74154d77 (patch)
treef806841bec2378ca955a7bea2ca45a978ed39edb /libcommon
parent16a4099d36ca1cdc33cf6e2b99edce796595341f (diff)
Add initial support for SQL Server test infrastructure
Diffstat (limited to 'libcommon')
-rw-r--r--libcommon/common/common.cxx13
-rw-r--r--libcommon/common/concrete.hxx7
-rw-r--r--libcommon/common/makefile3
3 files changed, 23 insertions, 0 deletions
diff --git a/libcommon/common/common.cxx b/libcommon/common/common.cxx
index 285ef68..28fd24a 100644
--- a/libcommon/common/common.cxx
+++ b/libcommon/common/common.cxx
@@ -25,6 +25,9 @@
#elif defined(DATABASE_ORACLE)
# include <odb/oracle/database.hxx>
# include <odb/oracle/connection-factory.hxx>
+#elif defined(DATABASE_MSSQL)
+# include <odb/mssql/database.hxx>
+# include <odb/mssql/connection-factory.hxx>
#else
# error unknown database
#endif
@@ -42,6 +45,8 @@ namespace sqlite = odb::sqlite;
namespace pgsql = odb::pgsql;
#elif defined(DATABASE_ORACLE)
namespace oracle = odb::oracle;
+#elif defined(DATABASE_MSSQL)
+namespace mssql = odb::mssql;
#endif
auto_ptr<database>
@@ -124,6 +129,14 @@ create_database (int& argc,
// to UTF-8.
//
db.reset (new oracle::database (argc, argv, false, 873, 873, 0, f));
+
+#elif defined(DATABASE_MSSQL)
+ auto_ptr<mssql::connection_factory> f;
+
+ if (max_connections != 0)
+ f.reset (new mssql::connection_pool_factory (max_connections));
+
+ db.reset (new mssql::database (argc, argv, false, 0, f));
#endif
return db;
diff --git a/libcommon/common/concrete.hxx b/libcommon/common/concrete.hxx
index d3c8cc4..b7fde1f 100644
--- a/libcommon/common/concrete.hxx
+++ b/libcommon/common/concrete.hxx
@@ -38,6 +38,13 @@ namespace odb_db = odb::pgsql;
namespace odb_db = odb::oracle;
+#elif defined(DATABASE_MSSQL)
+
+#include <odb/mssql/database.hxx>
+#include <odb/mssql/transaction.hxx>
+
+namespace odb_db = odb::mssql;
+
#endif
#endif // LIBCOMMON_COMMON_CONCRETE_HXX
diff --git a/libcommon/common/makefile b/libcommon/common/makefile
index 6bc7a88..accf285 100644
--- a/libcommon/common/makefile
+++ b/libcommon/common/makefile
@@ -61,6 +61,9 @@ endif
ifeq ($(db_id),oracle)
@echo '#define DATABASE_ORACLE 1' >>$@
endif
+ifeq ($(db_id),mssql)
+ @echo '#define DATABASE_MSSQL 1' >>$@
+endif
@echo '#define HAVE_TR1_MEMORY 1' >>$@
@echo '' >>$@
@echo '#endif /* LIBCOMMON_COMMON_CONFIG_H */' >>$@