summaryrefslogtreecommitdiff
path: root/libpqpp/pq-mock.cpp
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2017-01-01 21:18:09 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2017-01-01 21:25:38 +0000
commitd76fc20498a0c0d771976936c51e5e96923f368c (patch)
tree55eea84d689368810fca18ad65d8815c3f517b98 /libpqpp/pq-mock.cpp
parentUse command options statement hash when it's available (diff)
downloadlibdbpp-postgresql-d76fc20498a0c0d771976936c51e5e96923f368c.tar.bz2
libdbpp-postgresql-d76fc20498a0c0d771976936c51e5e96923f368c.tar.xz
libdbpp-postgresql-d76fc20498a0c0d771976936c51e5e96923f368c.zip
Force mock DB names to lower caselibdbpp-postgresql-1.1.1
Diffstat (limited to 'libpqpp/pq-mock.cpp')
-rw-r--r--libpqpp/pq-mock.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/libpqpp/pq-mock.cpp b/libpqpp/pq-mock.cpp
index f72c01f..2d081d1 100644
--- a/libpqpp/pq-mock.cpp
+++ b/libpqpp/pq-mock.cpp
@@ -4,6 +4,7 @@
#include <modifycommand.h>
#include <selectcommand.h>
#include <selectcommandUtil.impl.h>
+#include <boost/algorithm/string.hpp>
NAMEDFACTORY("postgresql", PQ::Mock, DB::MockDatabaseFactory);
@@ -21,7 +22,7 @@ AdHocFormatter(MockConnStr, "user=postgres dbname=%?");
DB::Connection *
Mock::openConnection() const
{
- return new Connection(MockConnStr::get(testDbName));
+ return new Connection(MockConnStr::get(boost::algorithm::to_lower_copy(testDbName)));
}
AdHocFormatter(MockSetUnlogged, "ALTER TABLE %?.%? SET UNLOGGED");
@@ -29,7 +30,7 @@ void
Mock::SetTablesToUnlogged() const
{
auto c = DB::ConnectionPtr(openConnection());
- auto s = c->select(R"SQL(
+ auto s = c->select(R"SQL(
SELECT n.nspname, c.relname
FROM pg_class c, pg_namespace n
WHERE c.relkind = 'r'
@@ -64,7 +65,7 @@ Mock::~Mock()
void
Mock::DropDatabase() const
{
- auto t = master->modify("SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE datname = ?");
+ auto t = master->modify("SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE LOWER(datname) = LOWER(?)");
t->bindParamS(0, testDbName);
t->execute();
MockServerDatabase::DropDatabase();