summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libdbpp/mockDatabase.cpp33
-rw-r--r--libdbpp/mockDatabase.h6
2 files changed, 0 insertions, 39 deletions
diff --git a/libdbpp/mockDatabase.cpp b/libdbpp/mockDatabase.cpp
index 694ec6e..52deb7e 100644
--- a/libdbpp/mockDatabase.cpp
+++ b/libdbpp/mockDatabase.cpp
@@ -41,13 +41,11 @@ MockDatabase::PlaySchemaScripts(const std::vector<boost::filesystem::path> & ss)
{
auto conn = ConnectionPtr(openConnection());
try {
- CreateStatusTable(conn.get());
for (auto s : ss) {
conn->beginTx();
PlaySchemaScript(conn.get(), s);
conn->commitTx();
}
- DropStatusTable(conn.get());
}
catch (...) {
if (conn->inTx()) {
@@ -61,7 +59,6 @@ MockDatabase::PlaySchemaScripts(const std::vector<boost::filesystem::path> & ss)
void
MockDatabase::PlaySchemaScript(DB::Connection * conn, const boost::filesystem::path & s) const
{
- UpdateStatusTable(conn, s);
std::ifstream f;
f.open(s.string());
if (!f.good()) {
@@ -71,36 +68,6 @@ MockDatabase::PlaySchemaScript(DB::Connection * conn, const boost::filesystem::p
f.close();
}
-void
-MockDatabase::CreateStatusTable(DB::Connection * conn) const
-{
- conn->execute(
- "CREATE TABLE public._libdbpp_teststatus( \
- pid int, \
- script varchar(256), \
- scriptdir varchar(256))");
- auto ins = ModifyCommandPtr(conn->newModifyCommand(
- "INSERT INTO public._libdbpp_teststatus(pid) VALUES(?)"));
- ins->bindParamI(0, getpid());
- ins->execute();
-}
-
-void
-MockDatabase::DropStatusTable(DB::Connection * conn) const
-{
- conn->execute("DROP TABLE public._libdbpp_teststatus");
-}
-
-void
-MockDatabase::UpdateStatusTable(DB::Connection * conn, const boost::filesystem::path & script) const
-{
- auto upd = ModifyCommandPtr(conn->newModifyCommand(
- "UPDATE public._libdbpp_teststatus SET script = ?, scriptdir = ?"));
- upd->bindParamS(0, script.string());
- upd->bindParamS(1, script.parent_path().string());
- upd->execute();
-}
-
MockServerDatabase::MockServerDatabase(const std::string & masterdb, const std::string & name, const std::string & type) :
MockDatabase(name),
master(DB::ConnectionFactory::createNew(type, masterdb)),
diff --git a/libdbpp/mockDatabase.h b/libdbpp/mockDatabase.h
index 7508881..d6d2328 100644
--- a/libdbpp/mockDatabase.h
+++ b/libdbpp/mockDatabase.h
@@ -32,17 +32,11 @@ class DLL_PUBLIC MockDatabase : public AdHoc::AbstractPluginImplementation {
virtual void PlaySchemaScript(DB::Connection *, const boost::filesystem::path & s) const;
/// Implementation specific method to drop a database.
virtual void DropDatabase() const = 0;
- /// Update the status table.
- virtual void UpdateStatusTable(DB::Connection *, const boost::filesystem::path &) const;
/// The name of this mocked database.
const std::string mockName;
/// Internal counter of mocked databases (for unique name generation)
static unsigned int mocked;
-
- private:
- void CreateStatusTable(DB::Connection *) const;
- void DropStatusTable(DB::Connection *) const;
};
/// MockServerDatabase extends MockDatabase with the functionality to connect to a database service