diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2021-08-02 21:13:43 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2021-08-02 21:13:43 +0100 |
commit | 25e2428754a3ac6c02650812564c857d1e25df55 (patch) | |
tree | e5175651650126f77c46a9030853dafeac13c4f7 /lib/row.cpp | |
parent | Assert DbValue is copyable and moveable (diff) | |
download | mygrate-25e2428754a3ac6c02650812564c857d1e25df55.tar.bz2 mygrate-25e2428754a3ac6c02650812564c857d1e25df55.tar.xz mygrate-25e2428754a3ac6c02650812564c857d1e25df55.zip |
Handle Rows events with more than one row
Diffstat (limited to 'lib/row.cpp')
-rw-r--r-- | lib/row.cpp | 29 |
1 files changed, 9 insertions, 20 deletions
diff --git a/lib/row.cpp b/lib/row.cpp index 9d81906..ba8045d 100644 --- a/lib/row.cpp +++ b/lib/row.cpp @@ -10,17 +10,6 @@ #include <string> namespace MyGrate { - Row::Row(const st_mariadb_rpl_rows_event & row, const st_mariadb_rpl_table_map_event & tm) : - Row(row, tm, RawDataReader {tm.metadata}, RawDataReader {row.row_data, row.row_data_size}) - { - } - - Row::Row(const st_mariadb_rpl_rows_event & row, const st_mariadb_rpl_table_map_event & tm, - MyGrate::RawDataReader && md, MyGrate::RawDataReader && data) : - Row {row, tm, md, data} - { - } - Row::Row(const st_mariadb_rpl_rows_event & row, const st_mariadb_rpl_table_map_event & tm, MyGrate::RawDataReader & md, MyGrate::RawDataReader & data) { @@ -114,15 +103,15 @@ namespace MyGrate { } } - RowPair::RowPair(const st_mariadb_rpl_rows_event & row, const st_mariadb_rpl_table_map_event & tm) : - RowPair(row, tm, RawDataReader {tm.metadata}, RawDataReader {tm.metadata}, - RawDataReader {row.row_data, row.row_data_size}) - { - } - - RowPair::RowPair(const st_mariadb_rpl_rows_event & row, const st_mariadb_rpl_table_map_event & tm, - MyGrate::RawDataReader && md1, MyGrate::RawDataReader && md2, MyGrate::RawDataReader && data) : - std::pair<Row, Row> {Row {row, tm, md1, data}, Row {row, tm, md2, data}} + Row::Rows + Row::fromRowsEvent(const st_mariadb_rpl_rows_event & row, const st_mariadb_rpl_table_map_event & tm) { + Rows rtn; + RawDataReader data {row.row_data, row.row_data_size}; + while (data.more()) { + RawDataReader md {tm.metadata}; + rtn.emplace_back(row, tm, md, data); + } + return rtn; } } |