summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2017-01-01 15:51:09 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2017-01-01 15:51:09 +0000
commitba4428b8c3e53fa42e7dd0f6692538e83d2b816b (patch)
tree5a18cfda692a8d6e8c1a470d3359a1fd61c83618
parentDo lots more work with compile time formatter instead runtime formatters (diff)
downloadlibdbpp-mysql-ba4428b8c3e53fa42e7dd0f6692538e83d2b816b.tar.bz2
libdbpp-mysql-ba4428b8c3e53fa42e7dd0f6692538e83d2b816b.tar.xz
libdbpp-mysql-ba4428b8c3e53fa42e7dd0f6692538e83d2b816b.zip
Register mock db implementations
-rw-r--r--libmysqlpp/my-mock.cpp11
-rw-r--r--libmysqlpp/my-mock.h1
2 files changed, 10 insertions, 2 deletions
diff --git a/libmysqlpp/my-mock.cpp b/libmysqlpp/my-mock.cpp
index 2eee416..8cf3057 100644
--- a/libmysqlpp/my-mock.cpp
+++ b/libmysqlpp/my-mock.cpp
@@ -2,15 +2,22 @@
#include "my-mock.h"
#include <compileTimeFormatter.h>
+NAMEDFACTORY("mysql", MySQL::Mock, DB::MockDatabaseFactory);
+
namespace MySQL {
-Mock::Mock(const std::string & name, const std::vector<boost::filesystem::path> & ss) :
- MockServerDatabase("options=p2testmysql", name, "mysql")
+Mock::Mock(const std::string & master, const std::string & name, const std::vector<boost::filesystem::path> & ss) :
+ MockServerDatabase(master, name, "mysql")
{
CreateNewDatabase();
PlaySchemaScripts(ss);
}
+Mock::Mock(const std::string & name, const std::vector<boost::filesystem::path> & ss) :
+ Mock("options=p2testmysql", name, ss)
+{
+}
+
AdHocFormatter(MockConnStr, "options=p2testmysql;database=%?");
DB::Connection *
Mock::openConnection() const
diff --git a/libmysqlpp/my-mock.h b/libmysqlpp/my-mock.h
index ce4fdf2..0855015 100644
--- a/libmysqlpp/my-mock.h
+++ b/libmysqlpp/my-mock.h
@@ -9,6 +9,7 @@ namespace MySQL {
class DLL_PUBLIC Mock : public DB::MockServerDatabase {
public:
+ Mock(const std::string & master, const std::string & name, const std::vector<boost::filesystem::path> & ss);
Mock(const std::string & name, const std::vector<boost::filesystem::path> & ss);
~Mock();