summaryrefslogtreecommitdiff
path: root/libodbcpp/odbc-mock.cpp
blob: 2799fb3d1282a631c2930d7ff372911a72d1d78b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include "odbc-connection.h"
#include "odbc-mock.h"
#include <buffer.h>

namespace ODBC {

Mock::Mock(const std::string & b, const std::string & masterdb, const std::string & name, const std::vector<boost::filesystem::path> & ss) :
	MockServerDatabase(b + ";" + masterdb, name, "odbc"),
	base(b)
{
	CreateNewDatabase();
	PlaySchemaScripts(ss);
}

DB::Connection *
Mock::openConnection() const
{
	return new Connection(stringbf("%s;Database=%s", base, testDbName));
}

Mock::~Mock()
{
	DropDatabase();
}

void Mock::DropDatabase() const
{
	MockServerDatabase::DropDatabase();
}

}