summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/Jamfile.jam1
-rw-r--r--lib/bitset.h2
-rw-r--r--lib/eventHandlerBase.cpp2
-rw-r--r--lib/input/mysqlConn.cpp4
-rw-r--r--lib/input/replStream.cpp9
-rw-r--r--lib/input/replStream.h6
-rw-r--r--lib/mysql_types.cpp10
-rw-r--r--lib/mysql_types.h5
-rw-r--r--lib/output/dumpToConsole.cpp6
-rw-r--r--lib/output/dumpToConsole.h2
-rw-r--r--lib/rawDataReader.cpp5
-rw-r--r--lib/rawDataReader.h8
-rw-r--r--lib/row.cpp6
-rw-r--r--lib/row.h9
-rw-r--r--lib/streamSupport.cpp2
15 files changed, 45 insertions, 32 deletions
diff --git a/lib/Jamfile.jam b/lib/Jamfile.jam
index 02374c9..05699a8 100644
--- a/lib/Jamfile.jam
+++ b/lib/Jamfile.jam
@@ -2,6 +2,7 @@ lib mygrate :
[ glob-tree *.cpp ]
:
<link>static
+ <include>.
<use>..//libmariadb
: :
<include>.
diff --git a/lib/bitset.h b/lib/bitset.h
index 40ee3ed..b604ccf 100644
--- a/lib/bitset.h
+++ b/lib/bitset.h
@@ -2,7 +2,7 @@
#define MYGRATE_BITSET_H
#include <cstddef>
-#include <cstdint>
+#include <iterator>
#include <span>
namespace MyGrate {
diff --git a/lib/eventHandlerBase.cpp b/lib/eventHandlerBase.cpp
index 7f9b2d4..777c746 100644
--- a/lib/eventHandlerBase.cpp
+++ b/lib/eventHandlerBase.cpp
@@ -1,4 +1,6 @@
#include "eventHandlerBase.h"
+#include <type_traits>
+#include <utility>
namespace MyGrate {
void
diff --git a/lib/input/mysqlConn.cpp b/lib/input/mysqlConn.cpp
index 38feb35..6c00628 100644
--- a/lib/input/mysqlConn.cpp
+++ b/lib/input/mysqlConn.cpp
@@ -2,7 +2,9 @@
#include <stdexcept>
namespace MyGrate::Input {
- MySQLConn::MySQLConn(const char * const host, const char * const user, const char * const pass, unsigned short port)
+ MySQLConn::MySQLConn(
+ const char * const host, const char * const user, const char * const pass, unsigned short port) :
+ st_mysql {}
{
mysql_init(this);
if (!mysql_real_connect(this, host, user, pass, "", port, nullptr, 0)) {
diff --git a/lib/input/replStream.cpp b/lib/input/replStream.cpp
index 88c3caf..c894941 100644
--- a/lib/input/replStream.cpp
+++ b/lib/input/replStream.cpp
@@ -1,6 +1,11 @@
#include "replStream.h"
-#include "../eventHandlers.h"
-#include "../mariadb_repl.h"
+#include "mariadb_repl.h"
+#include <eventHandlerBase.h>
+#include <eventHandlers.h>
+#include <memory>
+#include <mysql.h>
+#include <stdexcept>
+#include <utility>
namespace MyGrate::Input {
void
diff --git a/lib/input/replStream.h b/lib/input/replStream.h
index 983d9d3..4b1a7b6 100644
--- a/lib/input/replStream.h
+++ b/lib/input/replStream.h
@@ -1,8 +1,12 @@
#ifndef MYGRATE_INPUT_REPLSTREAM_H
#define MYGRATE_INPUT_REPLSTREAM_H
-#include "../eventSourceBase.h"
#include "mysqlConn.h"
+#include <eventSourceBase.h>
+
+namespace MyGrate {
+ class EventHandlerBase;
+}
namespace MyGrate::Input {
class ReplicationStream : public EventSourceBase, MySQLConn {
diff --git a/lib/mysql_types.cpp b/lib/mysql_types.cpp
index b61de08..a4641ba 100644
--- a/lib/mysql_types.cpp
+++ b/lib/mysql_types.cpp
@@ -1,8 +1,10 @@
#include "mysql_types.h"
#include "helpers.h"
#include "rawDataReader.h"
-#include <iostream>
+#include <algorithm>
+#include <array>
#include <stdexcept>
+#include <string>
namespace MyGrate::MySQL {
typename Type<MYSQL_TYPE_NULL, false>::C
@@ -96,13 +98,11 @@ namespace MyGrate::MySQL {
const auto realtype {md.readValue<enum_field_types, 1>()}; \
const auto lenlen {md.readValue<uint8_t>()}; \
switch (realtype) { \
- case MYSQL_TYPE_ENUM: { \
+ case MYSQL_TYPE_ENUM: \
+ case MYSQL_TYPE_VAR_STRING: \
return data.viewValue<std::string_view>(lenlen); \
- break; \
- } \
default: \
throw std::logic_error("Not implemented: sub-type: " + std::to_string(realtype)); \
- break; \
} \
throw std::logic_error("Didn't return a value: " + std::to_string(realtype)); \
}
diff --git a/lib/mysql_types.h b/lib/mysql_types.h
index ec578f7..af45b4f 100644
--- a/lib/mysql_types.h
+++ b/lib/mysql_types.h
@@ -2,16 +2,15 @@
#define MYGRATE_MYSQL_TYPES_H
#include "bitset.h"
-#include <array>
#include <cstddef>
#include <cstdint>
#include <ctime>
-#include <mysql.h> // IWYU pragma: keep
+#include <mysql.h>
#include <span>
#include <string_view>
#include <variant>
-#include <mariadb_rpl.h>
+struct timespec;
namespace MyGrate {
class RawDataReader;
diff --git a/lib/output/dumpToConsole.cpp b/lib/output/dumpToConsole.cpp
index 6ece800..4cc9cc9 100644
--- a/lib/output/dumpToConsole.cpp
+++ b/lib/output/dumpToConsole.cpp
@@ -1,7 +1,7 @@
#include "dumpToConsole.h"
-#include "../compileTimeFormatter.h"
-#include "../row.h"
-#include "../streamSupport.h"
+#include <compileTimeFormatter.h>
+#include <row.h>
+#include <streamSupport.h>
namespace MyGrate::Output {
void
diff --git a/lib/output/dumpToConsole.h b/lib/output/dumpToConsole.h
index 98769a6..d03c795 100644
--- a/lib/output/dumpToConsole.h
+++ b/lib/output/dumpToConsole.h
@@ -1,7 +1,7 @@
#ifndef MYGRATE_OUTPUT_DUMPTOCONSOLE_H
#define MYGRATE_OUTPUT_DUMPTOCONSOLE_H
-#include "../eventHandlerBase.h"
+#include <eventHandlerBase.h>
namespace MyGrate::Output {
class DumpToConsole : public MyGrate::EventHandlerBase {
diff --git a/lib/rawDataReader.cpp b/lib/rawDataReader.cpp
index 2dd87a9..90e227a 100644
--- a/lib/rawDataReader.cpp
+++ b/lib/rawDataReader.cpp
@@ -1,9 +1,4 @@
#include "rawDataReader.h"
-#include "helpers.h"
-#include "streamSupport.h"
-#include <cstring>
-#include <iomanip>
-#include <iostream>
namespace MyGrate {
RawDataReader::RawDataReader(const void * const d, std::size_t l) :
diff --git a/lib/rawDataReader.h b/lib/rawDataReader.h
index 0ed2847..906eaef 100644
--- a/lib/rawDataReader.h
+++ b/lib/rawDataReader.h
@@ -2,17 +2,11 @@
#define MYGRATE_RAW_DATA_READER_H
#include "helpers.h"
-#include <array>
+#include "mariadb_repl.h"
#include <cstddef>
#include <cstdint>
#include <cstring>
-#include <ctime>
-#include <mysql.h> // IWYU pragma: keep
-#include <span>
#include <stdexcept>
-#include <string_view>
-
-#include <mariadb_rpl.h>
namespace MyGrate {
struct PackedInteger {
diff --git a/lib/row.cpp b/lib/row.cpp
index 45e2959..65ac591 100644
--- a/lib/row.cpp
+++ b/lib/row.cpp
@@ -1,4 +1,10 @@
#include "row.h"
+#include "bitset.h"
+#include "mariadb_repl.h"
+#include "rawDataReader.h"
+#include <cstddef>
+#include <mysql.h>
+#include <span>
#include <stdexcept>
#include <string>
diff --git a/lib/row.h b/lib/row.h
index 4191644..a40b1b2 100644
--- a/lib/row.h
+++ b/lib/row.h
@@ -2,8 +2,13 @@
#define MYGRATE_ROW_H
#include "mysql_types.h"
-#include "rawDataReader.h"
-#include <functional>
+#include <utility>
+#include <vector>
+namespace MyGrate {
+ class RawDataReader;
+}
+struct st_mariadb_rpl_rows_event;
+struct st_mariadb_rpl_table_map_event;
namespace MyGrate {
class Row : public std::vector<MySQL::FieldValue> {
diff --git a/lib/streamSupport.cpp b/lib/streamSupport.cpp
index 541b191..1e5258c 100644
--- a/lib/streamSupport.cpp
+++ b/lib/streamSupport.cpp
@@ -11,7 +11,7 @@ namespace std {
std::ostream &
operator<<(std::ostream & s, const MARIADB_STRING & str)
{
- return s.write(str.str, str.length);
+ return s << std::string_view(str.str, str.length);
}
std::ostream &