summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2021-06-19 21:22:33 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2021-06-19 21:22:33 +0100
commitd6c40826ba1762ece7fb674c330a5950935c39f3 (patch)
tree41478ad13a62eec57479055432da60e7127ee399
parentTreat blobs as text if they're not binary (diff)
downloadmygrate-d6c40826ba1762ece7fb674c330a5950935c39f3.tar.bz2
mygrate-d6c40826ba1762ece7fb674c330a5950935c39f3.tar.xz
mygrate-d6c40826ba1762ece7fb674c330a5950935c39f3.zip
Get the target schema name
-rw-r--r--lib/output/pq/updateDatabase.cpp4
-rw-r--r--lib/output/pq/updateDatabase.h1
2 files changed, 4 insertions, 1 deletions
diff --git a/lib/output/pq/updateDatabase.cpp b/lib/output/pq/updateDatabase.cpp
index f344f42..52388be 100644
--- a/lib/output/pq/updateDatabase.cpp
+++ b/lib/output/pq/updateDatabase.cpp
@@ -11,11 +11,13 @@
#include <output/pq/sql/insertSource.h>
#include <output/pq/sql/selectColumns.h>
#include <output/pq/sql/selectSource.h>
+#include <output/pq/sql/selectSourceSchema.h>
#include <output/pq/sql/selectTables.h>
#include <stdexcept>
namespace MyGrate::Output::Pq {
- UpdateDatabase::UpdateDatabase(const char * const str, uint64_t s) : PqConn {str}, source {s}
+ UpdateDatabase::UpdateDatabase(const char * const str, uint64_t s) :
+ PqConn {str}, source {s}, schema(**output::pq::sql::selectSourceSchema::execute(this, s))
{
auto trecs = output::pq::sql::selectTables::execute(this, source);
auto crecs = output::pq::sql::selectColumns::execute(this, source);
diff --git a/lib/output/pq/updateDatabase.h b/lib/output/pq/updateDatabase.h
index 8fa3b3c..3d3e80d 100644
--- a/lib/output/pq/updateDatabase.h
+++ b/lib/output/pq/updateDatabase.h
@@ -36,6 +36,7 @@ namespace MyGrate::Output::Pq {
const char * db, int sid, const char * sc);
const uint64_t source;
+ const std::string schema;
private:
std::map<std::string, TableDefPtr, std::less<>> tables;