diff options
-rw-r--r-- | libpqpp/pq-binarycolumn.cpp | 6 | ||||
-rw-r--r-- | libpqpp/pq-binarycolumn.h | 4 | ||||
-rw-r--r-- | libpqpp/pq-bulkselectcommand.cpp | 8 | ||||
-rw-r--r-- | libpqpp/pq-bulkselectcommand.h | 6 | ||||
-rw-r--r-- | libpqpp/pq-column.cpp | 14 | ||||
-rw-r--r-- | libpqpp/pq-command.cpp | 16 | ||||
-rw-r--r-- | libpqpp/pq-command.h | 27 | ||||
-rw-r--r-- | libpqpp/pq-connection.cpp | 8 | ||||
-rw-r--r-- | libpqpp/pq-connection.h | 6 | ||||
-rw-r--r-- | libpqpp/pq-cursorselectcommand.cpp | 7 | ||||
-rw-r--r-- | libpqpp/pq-cursorselectcommand.h | 5 | ||||
-rw-r--r-- | libpqpp/pq-error.cpp | 1 | ||||
-rw-r--r-- | libpqpp/pq-error.h | 4 | ||||
-rw-r--r-- | libpqpp/pq-mock.cpp | 7 | ||||
-rw-r--r-- | libpqpp/pq-mock.h | 5 | ||||
-rw-r--r-- | libpqpp/pq-modifycommand.cpp | 6 | ||||
-rw-r--r-- | libpqpp/pq-modifycommand.h | 4 | ||||
-rw-r--r-- | libpqpp/pq-prepared.cpp | 7 | ||||
-rw-r--r-- | libpqpp/pq-prepared.h | 3 | ||||
-rw-r--r-- | libpqpp/pq-selectbase.cpp | 5 | ||||
-rw-r--r-- | libpqpp/pq-selectbase.h | 1 | ||||
-rw-r--r-- | libpqpp/unittests/testpq.cpp | 38 |
22 files changed, 160 insertions, 28 deletions
diff --git a/libpqpp/pq-binarycolumn.cpp b/libpqpp/pq-binarycolumn.cpp index ce4e8c1..0a488f7 100644 --- a/libpqpp/pq-binarycolumn.cpp +++ b/libpqpp/pq-binarycolumn.cpp @@ -1,5 +1,9 @@ #include "pq-binarycolumn.h" -#include "pq-selectbase.h" +#include "column.h" +#include "dbTypes.h" +#include "pq-column.h" +#include <cstdint> +#include <endian.h> #include <error.h> PQ::BinaryColumn::BinaryColumn(const PQ::SelectBase * s, unsigned int f) : PQ::Column(s, f) { } diff --git a/libpqpp/pq-binarycolumn.h b/libpqpp/pq-binarycolumn.h index 402d0bb..ed6eae7 100644 --- a/libpqpp/pq-binarycolumn.h +++ b/libpqpp/pq-binarycolumn.h @@ -3,7 +3,11 @@ #include "pq-column.h" +namespace DB { + class HandleField; +} namespace PQ { + class SelectBase; class BinaryColumn : public Column { public: BinaryColumn(const SelectBase *, unsigned int field); diff --git a/libpqpp/pq-bulkselectcommand.cpp b/libpqpp/pq-bulkselectcommand.cpp index de2ecb4..8c9e1f0 100644 --- a/libpqpp/pq-bulkselectcommand.cpp +++ b/libpqpp/pq-bulkselectcommand.cpp @@ -1,7 +1,11 @@ #include "pq-bulkselectcommand.h" -#include "pq-column.h" +#include "command.h" +#include "libpq-fe.h" +#include "pq-command.h" #include "pq-connection.h" -#include "pq-error.h" +#include "pq-prepared.h" +#include "pq-selectbase.h" +#include <vector> PQ::BulkSelectCommand::BulkSelectCommand(Connection * conn, const std::string & sql, const PQ::CommandOptionsCPtr & pqco, const DB::CommandOptionsCPtr & opts) : diff --git a/libpqpp/pq-bulkselectcommand.h b/libpqpp/pq-bulkselectcommand.h index 9c1c51b..6470905 100644 --- a/libpqpp/pq-bulkselectcommand.h +++ b/libpqpp/pq-bulkselectcommand.h @@ -1,14 +1,14 @@ #ifndef PQ_BULKSELECTCOMMAND_H #define PQ_BULKSELECTCOMMAND_H +#include "command_fwd.h" +#include "pq-command.h" #include "pq-prepared.h" #include "pq-selectbase.h" -#include <map> -#include <vector> +#include <string> namespace PQ { class Connection; - class Column; class BulkSelectCommand : public SelectBase, public PreparedStatement { public: BulkSelectCommand(Connection *, const std::string & sql, const PQ::CommandOptionsCPtr & pqco, diff --git a/libpqpp/pq-column.cpp b/libpqpp/pq-column.cpp index c1e0d40..d3f9b11 100644 --- a/libpqpp/pq-column.cpp +++ b/libpqpp/pq-column.cpp @@ -1,8 +1,18 @@ #include "pq-column.h" -#include "pq-error.h" +#include "column.h" +#include "dbTypes.h" #include "pq-selectbase.h" -#include <boost/date_time/posix_time/posix_time.hpp> +#include <boost/date_time/gregorian/parsers.hpp> +#include <boost/date_time/posix_time/posix_time_config.hpp> +#include <boost/date_time/posix_time/posix_time_types.hpp> +#include <boost/date_time/posix_time/ptime.hpp> +#include <boost/date_time/posix_time/time_parsers.hpp> +#include <cmath> +#include <cstdio> +#include <cstdlib> #include <cstring> +#include <libpq-fe.h> +#include <memory> PQ::Column::Column(const SelectBase * s, unsigned int i) : DB::Column(PQfname(s->execRes, static_cast<int>(i)), i), sc(s), oid(PQftype(sc->execRes, static_cast<int>(colNo))), diff --git a/libpqpp/pq-command.cpp b/libpqpp/pq-command.cpp index aaa8260..37de3b0 100644 --- a/libpqpp/pq-command.cpp +++ b/libpqpp/pq-command.cpp @@ -1,10 +1,18 @@ #include "pq-command.h" -#include "pq-connection.h" -#include <boost/date_time/posix_time/posix_time.hpp> +#include <algorithm> +#include <boost/date_time/posix_time/time_formatters.hpp> #include <compileTimeFormatter.h> -#include <cstdlib> -#include <cstring> +#include <dbTypes.h> #include <factory.h> +#include <map> +#include <optional> + +namespace Glib { + class ustring; +} +namespace PQ { + class Connection; +} NAMEDFACTORY("postgresql", PQ::CommandOptions, DB::CommandOptionsFactory) diff --git a/libpqpp/pq-command.h b/libpqpp/pq-command.h index 839c991..7e8cd94 100644 --- a/libpqpp/pq-command.h +++ b/libpqpp/pq-command.h @@ -1,16 +1,35 @@ #ifndef PQ_COMMAND_H #define PQ_COMMAND_H +#include "command.h" #include "pq-connection.h" -#include <command.h> -#include <libpq-fe.h> #include <memory> #include <vector> #include <visibility.h> +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wold-style-cast" +#pragma GCC diagnostic ignored "-Wsign-conversion" +#ifndef __clang__ +# pragma GCC diagnostic ignored "-Wuseless-cast" +#endif +#include <glibmm/ustring.h> +#pragma GCC diagnostic pop +#include "command_fwd.h" +#include <boost/date_time/posix_time/posix_time_types.hpp> +#include <boost/date_time/posix_time/ptime.hpp> +#include <cstddef> +#include <iosfwd> +#include <string> +#include <string_view> -namespace PQ { - class Connection; +namespace DB { + class Blob; +} +namespace boost::posix_time { + class time_duration; +} +namespace PQ { class DLL_PUBLIC CommandOptions : public DB::CommandOptions { public: CommandOptions(std::size_t, const DB::CommandOptionsMap &); diff --git a/libpqpp/pq-connection.cpp b/libpqpp/pq-connection.cpp index 4b201f5..049ca8c 100644 --- a/libpqpp/pq-connection.cpp +++ b/libpqpp/pq-connection.cpp @@ -1,10 +1,18 @@ #include "pq-connection.h" +#include "column.h" +#include "command.h" +#include "connection.h" #include "pq-bulkselectcommand.h" +#include "pq-command.h" #include "pq-cursorselectcommand.h" #include "pq-error.h" #include "pq-modifycommand.h" +#include "selectcommand.h" #include <boost/assert.hpp> #include <compileTimeFormatter.h> +#include <factory.h> +#include <libpq-fe.h> +#include <memory> #include <poll.h> #include <unistd.h> diff --git a/libpqpp/pq-connection.h b/libpqpp/pq-connection.h index ec1ae81..83da2d4 100644 --- a/libpqpp/pq-connection.h +++ b/libpqpp/pq-connection.h @@ -1,11 +1,15 @@ #ifndef PQ_CONNECTION_H #define PQ_CONNECTION_H +#include "command_fwd.h" #include "pq-error.h" #include <c++11Helpers.h> #include <connection.h> +#include <cstddef> +#include <cstdint> #include <libpq-fe.h> -#include <set> +#include <map> +#include <string> #include <visibility.h> namespace PQ { diff --git a/libpqpp/pq-cursorselectcommand.cpp b/libpqpp/pq-cursorselectcommand.cpp index 9ae9655..da0a95b 100644 --- a/libpqpp/pq-cursorselectcommand.cpp +++ b/libpqpp/pq-cursorselectcommand.cpp @@ -1,7 +1,12 @@ #include "pq-cursorselectcommand.h" +#include "command.h" +#include "pq-command.h" #include "pq-connection.h" -#include "pq-error.h" +#include "pq-selectbase.h" #include <compileTimeFormatter.h> +#include <libpq-fe.h> +#include <memory> +#include <vector> AdHocFormatter(PQCursorSelectDeclare, "DECLARE %? NO SCROLL CURSOR WITH HOLD FOR "); AdHocFormatter(PQCursorSelectFetch, "FETCH %? IN %?"); diff --git a/libpqpp/pq-cursorselectcommand.h b/libpqpp/pq-cursorselectcommand.h index 853be47..36070bc 100644 --- a/libpqpp/pq-cursorselectcommand.h +++ b/libpqpp/pq-cursorselectcommand.h @@ -1,14 +1,13 @@ #ifndef PQ_CURSORSELECTCOMMAND_H #define PQ_CURSORSELECTCOMMAND_H +#include "command_fwd.h" // for CommandOptionsCPtr #include "pq-command.h" #include "pq-selectbase.h" -#include <map> -#include <vector> +#include <string> // for string namespace PQ { class Connection; - class Column; class CursorSelectCommand : public SelectBase, public Command { public: CursorSelectCommand( diff --git a/libpqpp/pq-error.cpp b/libpqpp/pq-error.cpp index ca33a26..17b4e0a 100644 --- a/libpqpp/pq-error.cpp +++ b/libpqpp/pq-error.cpp @@ -1,4 +1,5 @@ #include "pq-error.h" +#include <libpq-fe.h> PQ::Error::Error(const PGconn * conn) : msg(PQerrorMessage(conn)) { } diff --git a/libpqpp/pq-error.h b/libpqpp/pq-error.h index 9c14e2d..bc701fa 100644 --- a/libpqpp/pq-error.h +++ b/libpqpp/pq-error.h @@ -1,9 +1,11 @@ #ifndef PQ_ERROR_H #define PQ_ERROR_H -#include <error.h> +#include "error.h" // IWYU pragma: export #include <exception.h> #include <libpq-fe.h> +#include <string> +// IWYU pragma: no_forward_declare DB::Error namespace PQ { class Error : public AdHoc::Exception<DB::Error> { diff --git a/libpqpp/pq-mock.cpp b/libpqpp/pq-mock.cpp index fcff52e..748a350 100644 --- a/libpqpp/pq-mock.cpp +++ b/libpqpp/pq-mock.cpp @@ -1,10 +1,15 @@ #include "pq-mock.h" +#include "connection.h" +#include "mockDatabase.h" #include "pq-connection.h" -#include <boost/algorithm/string.hpp> +#include <boost/algorithm/string/case_conv.hpp> #include <compileTimeFormatter.h> +#include <factory.h> +#include <memory> #include <modifycommand.h> #include <selectcommand.h> #include <selectcommandUtil.impl.h> +// IWYU pragma: no_include <boost/iterator/iterator_facade.hpp> NAMEDFACTORY("postgresql", PQ::Mock, DB::MockDatabaseFactory) diff --git a/libpqpp/pq-mock.h b/libpqpp/pq-mock.h index a8d9143..2cb6b68 100644 --- a/libpqpp/pq-mock.h +++ b/libpqpp/pq-mock.h @@ -1,9 +1,12 @@ #ifndef MOCKPQDATASOURCE_H #define MOCKPQDATASOURCE_H -#include "pq-connection.h" +#include "connection_fwd.h" +#include <c++11Helpers.h> #include <filesystem> #include <mockDatabase.h> +#include <string> +#include <vector> #include <visibility.h> namespace PQ { diff --git a/libpqpp/pq-modifycommand.cpp b/libpqpp/pq-modifycommand.cpp index 8697b10..38c10f6 100644 --- a/libpqpp/pq-modifycommand.cpp +++ b/libpqpp/pq-modifycommand.cpp @@ -1,7 +1,11 @@ #include "pq-modifycommand.h" +#include "command.h" +#include "modifycommand.h" #include "pq-connection.h" -#include "pq-error.h" +#include "pq-prepared.h" #include <cstdlib> +#include <libpq-fe.h> +#include <vector> PQ::ModifyCommand::ModifyCommand(Connection * conn, const std::string & sql, const DB::CommandOptionsCPtr & opts) : DB::Command(sql), DB::ModifyCommand(sql), PQ::PreparedStatement(conn, sql, opts) diff --git a/libpqpp/pq-modifycommand.h b/libpqpp/pq-modifycommand.h index 36de37a..cc4ce7b 100644 --- a/libpqpp/pq-modifycommand.h +++ b/libpqpp/pq-modifycommand.h @@ -1,11 +1,13 @@ #ifndef PQ_MODIFYCOMMAND_H #define PQ_MODIFYCOMMAND_H -#include "pq-connection.h" +#include "command_fwd.h" #include "pq-prepared.h" #include <modifycommand.h> +#include <string> namespace PQ { + class Connection; class ModifyCommand : public DB::ModifyCommand, public PreparedStatement { public: ModifyCommand(Connection *, const std::string & sql, const DB::CommandOptionsCPtr &); diff --git a/libpqpp/pq-prepared.cpp b/libpqpp/pq-prepared.cpp index 640b3db..78ad285 100644 --- a/libpqpp/pq-prepared.cpp +++ b/libpqpp/pq-prepared.cpp @@ -1,5 +1,12 @@ #include "pq-prepared.h" +#include "command.h" +#include "pq-command.h" #include "pq-connection.h" +#include <iosfwd> +#include <libpq-fe.h> +#include <map> +#include <utility> +#include <vector> PQ::PreparedStatement::PreparedStatement(Connection * c, const std::string & sql, const DB::CommandOptionsCPtr & opts) : DB::Command(sql), Command(c, sql, opts), pstmt(nullptr) diff --git a/libpqpp/pq-prepared.h b/libpqpp/pq-prepared.h index 6d32f5f..bf88f9e 100644 --- a/libpqpp/pq-prepared.h +++ b/libpqpp/pq-prepared.h @@ -1,9 +1,12 @@ #ifndef stuff #define stuff +#include "command_fwd.h" #include "pq-command.h" +#include <string> namespace PQ { + class Connection; class PreparedStatement : public Command { protected: PreparedStatement(Connection *, const std::string &, const DB::CommandOptionsCPtr &); diff --git a/libpqpp/pq-selectbase.cpp b/libpqpp/pq-selectbase.cpp index 4d4cada..d884d06 100644 --- a/libpqpp/pq-selectbase.cpp +++ b/libpqpp/pq-selectbase.cpp @@ -1,7 +1,12 @@ #include "pq-selectbase.h" +#include "command.h" #include "pq-binarycolumn.h" #include "pq-column.h" #include "pq-command.h" +#include <libpq-fe.h> +#include <memory> +#include <selectcommand.h> +#include <string> PQ::SelectBase::SelectBase(const std::string & sql, const PQ::CommandOptionsCPtr & pqco) : DB::Command(sql), DB::SelectCommand(sql), nTuples(0), tuple(0), execRes(nullptr), diff --git a/libpqpp/pq-selectbase.h b/libpqpp/pq-selectbase.h index 87dcc9d..19bef7a 100644 --- a/libpqpp/pq-selectbase.h +++ b/libpqpp/pq-selectbase.h @@ -4,6 +4,7 @@ #include "pq-command.h" #include <libpq-fe.h> #include <selectcommand.h> +#include <string> namespace PQ { class SelectBase : public DB::SelectCommand { diff --git a/libpqpp/unittests/testpq.cpp b/libpqpp/unittests/testpq.cpp index 2314fb9..ba7fb6b 100644 --- a/libpqpp/unittests/testpq.cpp +++ b/libpqpp/unittests/testpq.cpp @@ -1,19 +1,53 @@ #define BOOST_TEST_MODULE TestPQ #include <boost/test/unit_test.hpp> -#include <boost/date_time/posix_time/posix_time.hpp> +#include "command_fwd.h" +#include "connection.h" +#include "dbTypes.h" +#include "mockDatabase.h" +#include <array> +#include <boost/date_time/gregorian/greg_date.hpp> +#include <boost/date_time/posix_time/conversion.hpp> +#include <boost/date_time/posix_time/posix_time.hpp> // IWYU pragma: keep +#include <boost/date_time/posix_time/posix_time_types.hpp> +#include <boost/date_time/posix_time/ptime.hpp> +#include <boost/date_time/time.hpp> +#include <boost/date_time/time_system_counted.hpp> #include <column.h> +#include <cstdint> +#include <cstdio> +#include <cstring> #include <definedDirs.h> +#include <factory.impl.h> #include <fileUtils.h> #include <fstream> +#include <libpq-fe.h> +#include <memory> #include <modifycommand.h> +#include <optional> #include <pq-command.h> #include <pq-connection.h> -#include <pq-error.h> #include <pq-mock.h> #include <selectcommand.h> #include <selectcommandUtil.impl.h> +#include <stdexcept> +#include <string> +#include <string_view> #include <testCore.h> +#include <type_traits> +#include <unistd.h> +#include <utility> +#include <vector> + +namespace DB { + class ColumnTypeNotSupported; +} +namespace DB { + class Error; +} +namespace boost::posix_time { + class time_duration; +} class StandardMockDatabase : public DB::PluginMock<PQ::Mock> { public: |