From bf55ecaeb6849eab89fdb9bc5da51ff32dd1ea33 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Fri, 21 May 2021 08:43:43 +0100 Subject: Unpack row data into a vector or vector pair --- main/main.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'main') 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 -- cgit v1.2.3