summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2021-05-21 08:43:43 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2021-05-21 08:43:43 +0100
commitbf55ecaeb6849eab89fdb9bc5da51ff32dd1ea33 (patch)
tree3e5d8bd554aff8f455bf55c38d0cb63505beb4b9 /main
parentDefault intialize structs (diff)
downloadmygrate-bf55ecaeb6849eab89fdb9bc5da51ff32dd1ea33.tar.bz2
mygrate-bf55ecaeb6849eab89fdb9bc5da51ff32dd1ea33.tar.xz
mygrate-bf55ecaeb6849eab89fdb9bc5da51ff32dd1ea33.zip
Unpack row data into a vector or vector pair
Diffstat (limited to 'main')
-rw-r--r--main/main.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/main/main.cpp b/main/main.cpp
index d976a0a..b5d5a4c 100644
--- a/main/main.cpp
+++ b/main/main.cpp
@@ -51,7 +51,19 @@ struct write {
static void
dumpRowData(const st_mariadb_rpl_rows_event & row)
{
- MyGrate::Row {row, tableMaps.at(row.table_id)->event.table_map}.forEachField([](auto && fv) {
+ MyGrate::Row r {row, tableMaps.at(row.table_id)->event.table_map};
+ std::for_each(r.begin(), r.end(), [](auto && fv) {
+ std::visit(write {}, fv);
+ });
+}
+static void
+dumpRowPairData(const st_mariadb_rpl_rows_event & row)
+{
+ MyGrate::RowPair rp {row, tableMaps.at(row.table_id)->event.table_map};
+ std::for_each(rp.first.begin(), rp.first.end(), [](auto && fv) {
+ std::visit(write {}, fv);
+ });
+ std::for_each(rp.second.begin(), rp.second.end(), [](auto && fv) {
std::visit(write {}, fv);
});
}
@@ -80,7 +92,7 @@ doUpdate(MariaDB_Event_Ptr event)
{
const auto & rs = event->event.rows;
AdHoc::scprintf<"Update %?\n">(std::cout, rs.table_id);
- dumpRowData(event->event.rows);
+ dumpRowPairData(event->event.rows);
}
static void