diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2021-09-21 17:59:41 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2021-09-21 17:59:41 +0100 |
commit | a8630518c10667ff88f0e0846de98337743a5808 (patch) | |
tree | 4c926f7af693672b81888d3fcb69757ebf29620c | |
parent | Add JT recommended warnings (diff) | |
download | libdbpp-mysql-a8630518c10667ff88f0e0846de98337743a5808.tar.bz2 libdbpp-mysql-a8630518c10667ff88f0e0846de98337743a5808.tar.xz libdbpp-mysql-a8630518c10667ff88f0e0846de98337743a5808.zip |
First commit passing IWYU
-rw-r--r-- | libmysqlpp/my-column.cpp | 14 | ||||
-rw-r--r-- | libmysqlpp/my-column.h | 4 | ||||
-rw-r--r-- | libmysqlpp/my-command.cpp | 17 | ||||
-rw-r--r-- | libmysqlpp/my-command.h | 11 | ||||
-rw-r--r-- | libmysqlpp/my-connection.cpp | 9 | ||||
-rw-r--r-- | libmysqlpp/my-connection.h | 4 | ||||
-rw-r--r-- | libmysqlpp/my-error.cpp | 2 | ||||
-rw-r--r-- | libmysqlpp/my-error.h | 4 | ||||
-rw-r--r-- | libmysqlpp/my-mock.cpp | 6 | ||||
-rw-r--r-- | libmysqlpp/my-mock.h | 3 | ||||
-rw-r--r-- | libmysqlpp/my-modifycommand.cpp | 7 | ||||
-rw-r--r-- | libmysqlpp/my-modifycommand.h | 1 | ||||
-rw-r--r-- | libmysqlpp/my-selectcommand.cpp | 10 | ||||
-rw-r--r-- | libmysqlpp/my-selectcommand.h | 2 | ||||
-rw-r--r-- | libmysqlpp/unittests/testmysql.cpp | 20 |
15 files changed, 99 insertions, 15 deletions
diff --git a/libmysqlpp/my-column.cpp b/libmysqlpp/my-column.cpp index 4a5cdbf..fdbd7d8 100644 --- a/libmysqlpp/my-column.cpp +++ b/libmysqlpp/my-column.cpp @@ -1,8 +1,14 @@ #include "my-column.h" -#include "my-error.h" -#include "my-selectcommand.h" -#include <boost/date_time/gregorian/gregorian_types.hpp> -#include <cstring> +#include "column.h" +#include <boost/date_time/gregorian/greg_date.hpp> +#include <boost/date_time/posix_time/posix_time_duration.hpp> +#include <boost/date_time/posix_time/posix_time_types.hpp> +#include <boost/date_time/posix_time/ptime.hpp> +#include <boost/date_time/time_duration.hpp> +#include <cstdint> +#include <field_types.h> +#include <mysql.h> +#include <mysql_time.h> MySQL::ColumnBase::ColumnBase(const char * name, unsigned int i) : DB::Column(name, i), is_null(false), length(0) { } diff --git a/libmysqlpp/my-column.h b/libmysqlpp/my-column.h index 966216c..d41e310 100644 --- a/libmysqlpp/my-column.h +++ b/libmysqlpp/my-column.h @@ -6,9 +6,11 @@ #pragma GCC diagnostic ignored "-Wold-style-cast" #include <mysql.h> #pragma GCC diagnostic pop +#include <field_types.h> +#include <mysql_time.h> +#include <vector> namespace MySQL { - class SelectCommand; class ColumnBase : public DB::Column { public: ColumnBase(const char * name, unsigned int field); diff --git a/libmysqlpp/my-command.cpp b/libmysqlpp/my-command.cpp index 114e526..ac3f235 100644 --- a/libmysqlpp/my-command.cpp +++ b/libmysqlpp/my-command.cpp @@ -1,8 +1,25 @@ #include "my-command.h" +#include "command.h" #include "my-connection.h" +#include "my-error.h" +#include <boost/date_time/date.hpp> +#include <boost/date_time/gregorian_calendar.hpp> +#include <boost/date_time/time.hpp> +#include <boost/date_time/time_system_counted.hpp> #include <boost/numeric/conversion/cast.hpp> #include <cstdlib> #include <cstring> +#include <field_types.h> +#include <mysql.h> +#include <mysql_time.h> +#include <type_traits> + +namespace Glib { + class ustring; +} +namespace boost::posix_time { + class time_duration; +} MySQL::Command::Command(const Connection * conn, const std::string & sql) : DB::Command(sql), c(conn), stmt(mysql_stmt_init(&conn->conn), &mysql_stmt_close), paramsNeedBinding(false) diff --git a/libmysqlpp/my-command.h b/libmysqlpp/my-command.h index 87347cf..812d263 100644 --- a/libmysqlpp/my-command.h +++ b/libmysqlpp/my-command.h @@ -6,8 +6,19 @@ #pragma GCC diagnostic ignored "-Wold-style-cast" #include <mysql.h> #pragma GCC diagnostic pop +#include <boost/date_time/posix_time/posix_time_types.hpp> +#include <boost/date_time/posix_time/ptime.hpp> +#include <cstddef> +#include <glibmm/ustring.h> +#include <memory> +#include <string> +#include <string_view> #include <vector> +namespace boost::posix_time { + class time_duration; +} + namespace MySQL { class Connection; class Command : public virtual DB::Command { diff --git a/libmysqlpp/my-connection.cpp b/libmysqlpp/my-connection.cpp index 22ba809..43a8e20 100644 --- a/libmysqlpp/my-connection.cpp +++ b/libmysqlpp/my-connection.cpp @@ -1,12 +1,19 @@ #include "my-connection.h" +#include "connection.h" #include "my-error.h" #include "my-modifycommand.h" #include "my-selectcommand.h" +#include <algorithm> #include <compileTimeFormatter.h> +#include <cstring> +#include <exception.h> +#include <factory.h> +#include <map> +#include <mysql.h> #include <nvpParse.h> #include <optional> #include <runtimeContext.h> -#include <ucontext.h> +#include <stdexcept> NAMEDFACTORY("mysql", MySQL::Connection, DB::ConnectionFactory) diff --git a/libmysqlpp/my-connection.h b/libmysqlpp/my-connection.h index f0edacc..cad2b20 100644 --- a/libmysqlpp/my-connection.h +++ b/libmysqlpp/my-connection.h @@ -8,6 +8,10 @@ #pragma GCC diagnostic ignored "-Wold-style-cast" #include <mysql.h> #pragma GCC diagnostic pop +#include "command_fwd.h" +#include <cstddef> +#include <cstdint> +#include <string> namespace MySQL { class ConnectionError : public virtual Error, public virtual DB::ConnectionError { diff --git a/libmysqlpp/my-error.cpp b/libmysqlpp/my-error.cpp index 1af24ea..157c55a 100644 --- a/libmysqlpp/my-error.cpp +++ b/libmysqlpp/my-error.cpp @@ -1,5 +1,5 @@ #include "my-error.h" -#include <cstring> +#include <mysql.h> MySQL::Error::Error(MYSQL * m) : msg(mysql_error(m)) { } diff --git a/libmysqlpp/my-error.h b/libmysqlpp/my-error.h index 2dfc99b..b0338dd 100644 --- a/libmysqlpp/my-error.h +++ b/libmysqlpp/my-error.h @@ -1,12 +1,14 @@ #ifndef MY_ERROR_H #define MY_ERROR_H -#include <error.h> +#include "error.h" // IWYU pragma: export #include <exception.h> +#include <string> #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wold-style-cast" #include <mysql.h> #pragma GCC diagnostic pop +// IWYU pragma: no_forward_declare DB::Error namespace MySQL { class Error : public AdHoc::Exception<DB::Error> { diff --git a/libmysqlpp/my-mock.cpp b/libmysqlpp/my-mock.cpp index 27e9df2..97783d7 100644 --- a/libmysqlpp/my-mock.cpp +++ b/libmysqlpp/my-mock.cpp @@ -1,6 +1,12 @@ #include "my-mock.h" +#include "connection_fwd.h" +#include "mockDatabase.h" #include "my-connection.h" #include <compileTimeFormatter.h> +#include <factory.h> +#include <memory> +#include <string> +#include <vector> NAMEDFACTORY("mysql", MySQL::Mock, DB::MockDatabaseFactory) diff --git a/libmysqlpp/my-mock.h b/libmysqlpp/my-mock.h index fca2b67..59173ab 100644 --- a/libmysqlpp/my-mock.h +++ b/libmysqlpp/my-mock.h @@ -1,9 +1,12 @@ #ifndef MOCKMYSQLDATASOURCE_H #define MOCKMYSQLDATASOURCE_H +#include "connection_fwd.h" #include <c++11Helpers.h> #include <filesystem> #include <mockDatabase.h> +#include <string> +#include <vector> #include <visibility.h> namespace MySQL { diff --git a/libmysqlpp/my-modifycommand.cpp b/libmysqlpp/my-modifycommand.cpp index 9714638..c3fdee9 100644 --- a/libmysqlpp/my-modifycommand.cpp +++ b/libmysqlpp/my-modifycommand.cpp @@ -1,7 +1,10 @@ #include "my-modifycommand.h" -#include "connection.h" +#include "command.h" +#include "modifycommand.h" +#include "my-command.h" #include "my-error.h" -#include <cstdlib> +#include <memory> +#include <mysql.h> MySQL::ModifyCommand::ModifyCommand(const Connection * conn, const std::string & sql) : DB::Command(sql), DB::ModifyCommand(sql), MySQL::Command(conn, sql) diff --git a/libmysqlpp/my-modifycommand.h b/libmysqlpp/my-modifycommand.h index ec2753f..862e88c 100644 --- a/libmysqlpp/my-modifycommand.h +++ b/libmysqlpp/my-modifycommand.h @@ -3,6 +3,7 @@ #include "my-command.h" #include <modifycommand.h> +#include <string> namespace MySQL { class Connection; diff --git a/libmysqlpp/my-selectcommand.cpp b/libmysqlpp/my-selectcommand.cpp index 73ae7cc..7f1eaf8 100644 --- a/libmysqlpp/my-selectcommand.cpp +++ b/libmysqlpp/my-selectcommand.cpp @@ -1,8 +1,16 @@ #include "my-selectcommand.h" +#include "command.h" #include "my-column.h" -#include "my-connection.h" +#include "my-command.h" #include "my-error.h" +#include "selectcommand.h" +#include <cstdint> #include <cstring> +#include <field_types.h> +#include <memory> +#include <mysql.h> +#include <mysql_time.h> +#include <vector> MySQL::SelectCommand::SelectCommand(const Connection * conn, const std::string & sql) : DB::Command(sql), DB::SelectCommand(sql), MySQL::Command(conn, sql), prepared(false), executed(false) diff --git a/libmysqlpp/my-selectcommand.h b/libmysqlpp/my-selectcommand.h index 9613731..ddfcffb 100644 --- a/libmysqlpp/my-selectcommand.h +++ b/libmysqlpp/my-selectcommand.h @@ -3,10 +3,10 @@ #include "my-command.h" #include <selectcommand.h> +#include <string> namespace MySQL { class Connection; - class ColumnBase; class SelectCommand : public DB::SelectCommand, public Command { public: SelectCommand(const Connection *, const std::string & sql); diff --git a/libmysqlpp/unittests/testmysql.cpp b/libmysqlpp/unittests/testmysql.cpp index fdfb0a8..8c75abd 100644 --- a/libmysqlpp/unittests/testmysql.cpp +++ b/libmysqlpp/unittests/testmysql.cpp @@ -1,17 +1,31 @@ #define BOOST_TEST_MODULE TestMySQL #include <boost/test/unit_test.hpp> -#include <boost/date_time/posix_time/posix_time.hpp> -#include <column.h> +#include "mockDatabase.h" +#include <array> +#include <boost/date_time/posix_time/conversion.hpp> +#include <boost/date_time/posix_time/posix_time_types.hpp> +#include <boost/date_time/posix_time/ptime.hpp> #include <connection.h> +#include <cstdint> +#include <cstdio> #include <definedDirs.h> +#include <factory.impl.h> +#include <filesystem> #include <fstream> +#include <initializer_list> +#include <memory> #include <modifycommand.h> -#include <my-error.h> #include <my-mock.h> #include <selectcommand.h> +#include <stdexcept> +#include <string_view> #include <testCore.h> +namespace DB { + class Error; +} + class StandardMockDatabase : public DB::PluginMock<MySQL::Mock> { public: StandardMockDatabase() : DB::PluginMock<MySQL::Mock>("mysqlmock", {rootDir / "mysqlschema.sql"}, "options=libdbpp") |