summaryrefslogtreecommitdiff
path: root/libsqlitepp/sqlite-mock.cpp
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2018-04-17 19:15:08 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2018-04-17 19:15:08 +0100
commita802c57549d0111292eec1b9c0df86377efcf491 (patch)
treeedfe997bfe5d97c84e9ebb555001b9db28eac4b4 /libsqlitepp/sqlite-mock.cpp
parentStandalone split (diff)
downloadlibdbpp-sqlite-a802c57549d0111292eec1b9c0df86377efcf491.tar.bz2
libdbpp-sqlite-a802c57549d0111292eec1b9c0df86377efcf491.tar.xz
libdbpp-sqlite-a802c57549d0111292eec1b9c0df86377efcf491.zip
Updates code largely in-keeping with updates to be C++17 in line with libadhocutil and libdbpp.
Diffstat (limited to 'libsqlitepp/sqlite-mock.cpp')
-rw-r--r--libsqlitepp/sqlite-mock.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/libsqlitepp/sqlite-mock.cpp b/libsqlitepp/sqlite-mock.cpp
index 6a2edb5..418a6ac 100644
--- a/libsqlitepp/sqlite-mock.cpp
+++ b/libsqlitepp/sqlite-mock.cpp
@@ -7,8 +7,7 @@ NAMEDFACTORY("sqlite", SQLite::Mock, DB::MockDatabaseFactory);
namespace SQLite {
-Mock::Mock(const std::string & root, const std::string & name, const std::vector<boost::filesystem::path> & ss) :
- MockDatabase(name),
+Mock::Mock(const std::string & root, const std::string &, const std::vector<boost::filesystem::path> & ss) :
testDbPath(boost::filesystem::path(root) / boost::lexical_cast<std::string>(getpid()) / boost::lexical_cast<std::string>(++DB::MockDatabase::mocked))
{
CreateNewDatabase();
@@ -20,10 +19,10 @@ Mock::Mock(const std::string & name, const std::vector<boost::filesystem::path>
{
}
-DB::Connection *
+DB::ConnectionPtr
Mock::openConnection() const
{
- return new Connection(testDbPath.string());
+ return std::make_shared<Connection>(testDbPath.string());
}
Mock::~Mock()
@@ -39,7 +38,7 @@ void Mock::DropDatabase() const
void Mock::CreateNewDatabase() const
{
boost::filesystem::create_directories(testDbPath.parent_path());
- delete openConnection();
+ openConnection(); // Triggers file creation
}
}