summaryrefslogtreecommitdiff
path: root/lib/output/pq
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2021-07-19 20:13:21 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2021-07-19 20:13:21 +0100
commitb58f59e5af68d97683911f291252c5e93993b2e2 (patch)
tree94c61326bf109d36bc25d0d5313a7b97fcd63117 /lib/output/pq
parentPass bindings as a span, only wrap with initializer_list (diff)
downloadmygrate-b58f59e5af68d97683911f291252c5e93993b2e2.tar.bz2
mygrate-b58f59e5af68d97683911f291252c5e93993b2e2.tar.xz
mygrate-b58f59e5af68d97683911f291252c5e93993b2e2.zip
Rename TableDef to TableOutput
Will store things like the prepared statements as they're needed.
Diffstat (limited to 'lib/output/pq')
-rw-r--r--lib/output/pq/updateDatabase.cpp6
-rw-r--r--lib/output/pq/updateDatabase.h8
2 files changed, 7 insertions, 7 deletions
diff --git a/lib/output/pq/updateDatabase.cpp b/lib/output/pq/updateDatabase.cpp
index 1dab95e..55ef561 100644
--- a/lib/output/pq/updateDatabase.cpp
+++ b/lib/output/pq/updateDatabase.cpp
@@ -31,7 +31,7 @@ namespace MyGrate::Output::Pq {
auto trecs = output::pq::sql::selectTables::execute(this, source);
auto crecs = output::pq::sql::selectColumns::execute(this, source);
for (auto t {0U}; t < trecs->rows(); t++) {
- tables.emplace(trecs->at(t, 0), std::make_unique<TableDef>(*crecs, trecs->at(t, 0)));
+ tables.emplace(trecs->at(t, 0), std::make_unique<TableOutput>(*crecs, trecs->at(t, 0)));
}
}
@@ -43,7 +43,7 @@ namespace MyGrate::Output::Pq {
return (*srcrec)[0].create<Input::ReplicationStream, 7>();
}
- TableDef::TableDef(const RecordSet & crecs, std::string_view name)
+ TableOutput::TableOutput(const RecordSet & crecs, std::string_view name)
{
for (auto c {0U}; c < crecs.rows(); c++) {
if (crecs.at(c, 0) == name) {
@@ -71,7 +71,7 @@ namespace MyGrate::Output::Pq {
{
auto cols = input::sql::selectColumns::execute(conn, tableName);
verify<std::logic_error>(cols->rows() > 0, "Table has no rows");
- auto tableDef {std::make_unique<TableDef>()};
+ auto tableDef {std::make_unique<TableOutput>()};
Tx {this}([&] {
const auto table_id = **output::pq::sql::insertTable::execute(this, tableName, source);
std::stringstream ct;
diff --git a/lib/output/pq/updateDatabase.h b/lib/output/pq/updateDatabase.h
index 20ea96a..0355a47 100644
--- a/lib/output/pq/updateDatabase.h
+++ b/lib/output/pq/updateDatabase.h
@@ -19,14 +19,14 @@ namespace MyGrate::Output::Pq {
};
using ColumnDefPtr = std::unique_ptr<ColumnDef>;
- class TableDef {
+ class TableOutput {
public:
- TableDef() = default;
- TableDef(const RecordSet &, std::string_view name);
+ TableOutput() = default;
+ TableOutput(const RecordSet &, std::string_view name);
std::vector<ColumnDefPtr> columns;
};
- using TableDefPtr = std::unique_ptr<TableDef>;
+ using TableDefPtr = std::unique_ptr<TableOutput>;
class ConfigError : public std::runtime_error {
using std::runtime_error::runtime_error;