diff options
Diffstat (limited to 'lib/output/pq/updateDatabase.h')
-rw-r--r-- | lib/output/pq/updateDatabase.h | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/lib/output/pq/updateDatabase.h b/lib/output/pq/updateDatabase.h index 79df9a9..aa50e90 100644 --- a/lib/output/pq/updateDatabase.h +++ b/lib/output/pq/updateDatabase.h @@ -2,6 +2,7 @@ #define MYGRATE_OUTPUT_PQ_UPDATEDATABASE_H #include "pqConn.h" +#include "pqStmt.h" #include <cstdint> #include <eventHandlerBase.h> #include <eventSourceBase.h> @@ -25,6 +26,7 @@ namespace MyGrate::Output::Pq { TableOutput(const RecordSet &, std::string_view name); std::vector<ColumnDefPtr> columns; + DbPrepStmtPtr update; }; using TableDefPtr = std::unique_ptr<TableOutput>; @@ -32,6 +34,10 @@ namespace MyGrate::Output::Pq { using std::runtime_error::runtime_error; }; + class ReplicationError : public std::runtime_error { + using std::runtime_error::runtime_error; + }; + class UpdateDatabase : public PqConn, public EventHandlerBase { public: UpdateDatabase(const char * const str, uint64_t source); @@ -44,6 +50,10 @@ namespace MyGrate::Output::Pq { void addTable(Input::MySQLConn *, const char * tableName); void copyTableContent(Input::MySQLConn *, const char * tableName); + // Replication events + void updateRow(MariaDB_Event_Ptr) override; + void tableMap(MariaDB_Event_Ptr) override; + const uint64_t source; const std::string schema; const std::string database; @@ -51,7 +61,11 @@ namespace MyGrate::Output::Pq { private: UpdateDatabase(PqConn &&, uint64_t source); UpdateDatabase(PqConn &&, uint64_t source, RecordSetPtr cfg); - std::map<std::string, TableDefPtr, std::less<>> tables; + + using Tables = std::map<std::string, TableDefPtr, std::less<>>; + Tables tables; + Tables::const_iterator selected; + MariaDB_Event_Ptr table_map; }; } |