summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2021-07-22 22:21:49 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2021-07-22 22:21:49 +0100
commitecc6aa474cffe8b890a1174d8eac0d9044087f00 (patch)
tree82a05857f5a5b880235707dc75a5b25946613e2f
parentGet source database name into UpdateDatabase on configure (diff)
downloadmygrate-ecc6aa474cffe8b890a1174d8eac0d9044087f00.tar.bz2
mygrate-ecc6aa474cffe8b890a1174d8eac0d9044087f00.tar.xz
mygrate-ecc6aa474cffe8b890a1174d8eac0d9044087f00.zip
Do connection level setup in constructor
-rw-r--r--lib/input/replStream.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/input/replStream.cpp b/lib/input/replStream.cpp
index eb6c030..7a995d3 100644
--- a/lib/input/replStream.cpp
+++ b/lib/input/replStream.cpp
@@ -14,6 +14,8 @@ namespace MyGrate::Input {
MySQLConn {host.c_str(), user.c_str(), pass.c_str(), port},
serverid {sid}, filename {std::move(fn)}, position {pos}
{
+ query("SET @mariadb_slave_capability = 4");
+ query("SET @master_binlog_checksum = @@global.binlog_checksum");
}
void
@@ -22,9 +24,6 @@ namespace MyGrate::Input {
using MariaDB_Rpl_Ptr = std::unique_ptr<MARIADB_RPL, decltype(&mariadb_rpl_close)>;
auto rpl = MariaDB_Rpl_Ptr {mariadb_rpl_init(this), &mariadb_rpl_close};
- query("SET @mariadb_slave_capability = 4");
- query("SET @master_binlog_checksum = @@global.binlog_checksum");
-
mariadb_rpl_optionsv(rpl.get(), MARIADB_RPL_SERVER_ID, serverid);
mariadb_rpl_optionsv(rpl.get(), MARIADB_RPL_FILENAME, filename.c_str(), filename.length());
mariadb_rpl_optionsv(rpl.get(), MARIADB_RPL_START, position);