summaryrefslogtreecommitdiff
path: root/slicer/db
diff options
context:
space:
mode:
Diffstat (limited to 'slicer/db')
-rw-r--r--slicer/db/sqlBinder.cpp1
-rw-r--r--slicer/db/sqlBinder.h9
-rw-r--r--slicer/db/sqlCommon.cpp3
-rw-r--r--slicer/db/sqlCommon.h5
-rw-r--r--slicer/db/sqlInsertSerializer.cpp11
-rw-r--r--slicer/db/sqlInsertSerializer.h8
-rw-r--r--slicer/db/sqlSelectDeserializer.cpp8
-rw-r--r--slicer/db/sqlSelectDeserializer.h9
-rw-r--r--slicer/db/sqlSource.cpp3
-rw-r--r--slicer/db/sqlSource.h14
-rw-r--r--slicer/db/sqlTablePatchSerializer.cpp8
-rw-r--r--slicer/db/sqlTablePatchSerializer.h8
-rw-r--r--slicer/db/sqlUpdateSerializer.cpp5
-rw-r--r--slicer/db/sqlUpdateSerializer.h8
-rw-r--r--slicer/db/testConversions.cpp5
-rw-r--r--slicer/db/testInsert.cpp22
-rw-r--r--slicer/db/testMockCommon.cpp5
-rw-r--r--slicer/db/testMockCommon.h5
-rw-r--r--slicer/db/testPatch.cpp21
-rw-r--r--slicer/db/testSelect.cpp27
-rw-r--r--slicer/db/testUpdate.cpp24
21 files changed, 156 insertions, 53 deletions
diff --git a/slicer/db/sqlBinder.cpp b/slicer/db/sqlBinder.cpp
index 8245217..beaeef0 100644
--- a/slicer/db/sqlBinder.cpp
+++ b/slicer/db/sqlBinder.cpp
@@ -1,4 +1,5 @@
#include "sqlBinder.h"
+#include <command.h>
namespace Slicer {
SqlBinder::SqlBinder(DB::Command & c, unsigned int i) : command(c), idx(i) { }
diff --git a/slicer/db/sqlBinder.h b/slicer/db/sqlBinder.h
index 8c1ce80..4f5437c 100644
--- a/slicer/db/sqlBinder.h
+++ b/slicer/db/sqlBinder.h
@@ -1,9 +1,14 @@
#ifndef SLICER_DB_SQLBINDER_H
#define SLICER_DB_SQLBINDER_H
-#include <boost/date_time/posix_time/ptime.hpp>
-#include <command.h>
+#include <Ice/Config.h>
+#include <boost/date_time/posix_time/posix_time.hpp>
+#include <memory>
#include <slicer/modelParts.h>
+#include <string>
+namespace DB {
+ class Command;
+}
namespace Slicer {
class SqlBinder :
diff --git a/slicer/db/sqlCommon.cpp b/slicer/db/sqlCommon.cpp
index 7ef0046..f60d33f 100644
--- a/slicer/db/sqlCommon.cpp
+++ b/slicer/db/sqlCommon.cpp
@@ -1,7 +1,8 @@
#include "sqlCommon.h"
#include <compileTimeFormatter.h>
-#include <metadata.h>
+#include <modelParts.h>
#include <sqlExceptions.h>
+#include <string_view>
namespace Slicer {
constexpr std::string_view md_pkey {"db:pkey"};
diff --git a/slicer/db/sqlCommon.h b/slicer/db/sqlCommon.h
index 32afd87..acabc51 100644
--- a/slicer/db/sqlCommon.h
+++ b/slicer/db/sqlCommon.h
@@ -1,10 +1,9 @@
#ifndef SLICER_DB_SQLCOMMON_H
#define SLICER_DB_SQLCOMMON_H
-#include <modelParts.h>
-#include <string>
-
namespace Slicer {
+ class HookCommon;
+
bool isPKey(const HookCommon *);
bool isAuto(const HookCommon *);
bool isNotAuto(const HookCommon *);
diff --git a/slicer/db/sqlInsertSerializer.cpp b/slicer/db/sqlInsertSerializer.cpp
index f18df73..96ba457 100644
--- a/slicer/db/sqlInsertSerializer.cpp
+++ b/slicer/db/sqlInsertSerializer.cpp
@@ -1,14 +1,17 @@
#include "sqlInsertSerializer.h"
+#include "common.h"
#include "sqlBinder.h"
#include "sqlCommon.h"
+#include "sqlExceptions.h"
+#include <Ice/Config.h>
#include <boost/numeric/conversion/cast.hpp>
-#include <common.h>
+#include <command_fwd.h>
#include <compileTimeFormatter.h>
+#include <connection.h>
#include <functional>
+#include <memory>
#include <modifycommand.h>
-#include <slicer/metadata.h>
-#include <sqlExceptions.h>
-#include <type_traits>
+#include <utility>
namespace Slicer {
using namespace std::placeholders;
diff --git a/slicer/db/sqlInsertSerializer.h b/slicer/db/sqlInsertSerializer.h
index 8a72b68..6bcfae3 100644
--- a/slicer/db/sqlInsertSerializer.h
+++ b/slicer/db/sqlInsertSerializer.h
@@ -1,10 +1,16 @@
#ifndef SLICER_DB_SQLINSERTSERIALIZER_H
#define SLICER_DB_SQLINSERTSERIALIZER_H
-#include <connection.h>
+#include "modelParts.h"
+#include <command_fwd.h>
#include <ostream>
#include <slicer/serializer.h>
+#include <string>
#include <visibility.h>
+namespace DB {
+ class Connection;
+ class ModifyCommand;
+}
namespace Slicer {
class DLL_PUBLIC SqlInsertSerializer : public Slicer::Serializer {
diff --git a/slicer/db/sqlSelectDeserializer.cpp b/slicer/db/sqlSelectDeserializer.cpp
index 4ecf410..eaf09ac 100644
--- a/slicer/db/sqlSelectDeserializer.cpp
+++ b/slicer/db/sqlSelectDeserializer.cpp
@@ -1,7 +1,11 @@
#include "sqlSelectDeserializer.h"
+#include "common.h"
+#include "sqlExceptions.h"
#include "sqlSource.h"
-#include <common.h>
-#include <sqlExceptions.h>
+#include <column.h>
+#include <memory>
+#include <selectcommand.h>
+#include <utility>
namespace Slicer {
SqlSelectDeserializer::SqlSelectDeserializer(DB::SelectCommand * c, std::optional<std::string> tc) :
diff --git a/slicer/db/sqlSelectDeserializer.h b/slicer/db/sqlSelectDeserializer.h
index 05f1c06..b681817 100644
--- a/slicer/db/sqlSelectDeserializer.h
+++ b/slicer/db/sqlSelectDeserializer.h
@@ -1,9 +1,14 @@
#ifndef SLICER_DB_SQLSELECTDESERIALIZER_H
#define SLICER_DB_SQLSELECTDESERIALIZER_H
-#include <selectcommand.h>
-#include <slicer/serializer.h>
+#include "modelParts.h"
+#include "slicer/serializer.h"
+#include <optional>
+#include <string>
#include <visibility.h>
+namespace DB {
+ class SelectCommand;
+}
namespace Slicer {
class DLL_PUBLIC SqlSelectDeserializer : public Slicer::Deserializer {
diff --git a/slicer/db/sqlSource.cpp b/slicer/db/sqlSource.cpp
index 84964f2..41b9c1c 100644
--- a/slicer/db/sqlSource.cpp
+++ b/slicer/db/sqlSource.cpp
@@ -1,5 +1,8 @@
#include "sqlSource.h"
+#include <boost/date_time/posix_time/posix_time.hpp>
#include <boost/numeric/conversion/cast.hpp>
+#include <column.h>
+#include <cstdint>
namespace Slicer {
SqlSource::SqlSource(const DB::Column & c) : column(c) { }
diff --git a/slicer/db/sqlSource.h b/slicer/db/sqlSource.h
index c48fb4d..4b76974 100644
--- a/slicer/db/sqlSource.h
+++ b/slicer/db/sqlSource.h
@@ -1,9 +1,17 @@
#ifndef SLICER_DB_SQLSOURCE_H
#define SLICER_DB_SQLSOURCE_H
-#include <boost/date_time/posix_time/ptime.hpp>
-#include <column.h>
-#include <slicer/modelParts.h>
+#include "slicer/modelParts.h"
+#include <Ice/Config.h>
+#include <memory>
+#include <string>
+namespace DB {
+ class Column;
+}
+namespace boost::posix_time {
+ class ptime;
+ class time_duration;
+}
namespace Slicer {
class SqlSource :
diff --git a/slicer/db/sqlTablePatchSerializer.cpp b/slicer/db/sqlTablePatchSerializer.cpp
index 7c29be5..b136b15 100644
--- a/slicer/db/sqlTablePatchSerializer.cpp
+++ b/slicer/db/sqlTablePatchSerializer.cpp
@@ -1,10 +1,12 @@
+#include "sqlTablePatchSerializer.h"
#include "sqlCommon.h"
#include "sqlInsertSerializer.h"
-#include "sqlTablePatchSerializer.h"
#include <compileTimeFormatter.h>
-#include <functional>
+#include <connection.h>
+#include <memory>
#include <scopeExit.h>
-#include <slicer/metadata.h>
+#include <string>
+#include <tablepatch.h>
namespace Slicer {
AdHocFormatter(ttname, "slicer_tmp_%?");
diff --git a/slicer/db/sqlTablePatchSerializer.h b/slicer/db/sqlTablePatchSerializer.h
index 025e122..8973072 100644
--- a/slicer/db/sqlTablePatchSerializer.h
+++ b/slicer/db/sqlTablePatchSerializer.h
@@ -1,9 +1,13 @@
#ifndef SLICER_DB_SQLTABLEPATCHSERIALIZER_H
#define SLICER_DB_SQLTABLEPATCHSERIALIZER_H
-#include <connection.h>
+#include "modelParts.h"
#include <slicer/serializer.h>
-#include <tablepatch.h>
+#include <visibility.h>
+namespace DB {
+ class Connection;
+ class TablePatch;
+}
namespace Slicer {
class DLL_PUBLIC SqlTablePatchSerializer : public Slicer::Serializer {
diff --git a/slicer/db/sqlUpdateSerializer.cpp b/slicer/db/sqlUpdateSerializer.cpp
index a2de6a7..9e0e85a 100644
--- a/slicer/db/sqlUpdateSerializer.cpp
+++ b/slicer/db/sqlUpdateSerializer.cpp
@@ -1,12 +1,15 @@
#include "sqlUpdateSerializer.h"
#include "sqlBinder.h"
#include "sqlCommon.h"
+#include <command_fwd.h>
#include <common.h>
#include <compileTimeFormatter.h>
+#include <connection.h>
#include <functional>
+#include <memory>
#include <modifycommand.h>
-#include <slicer/metadata.h>
#include <sqlExceptions.h>
+#include <utility>
namespace Slicer {
using namespace std::placeholders;
diff --git a/slicer/db/sqlUpdateSerializer.h b/slicer/db/sqlUpdateSerializer.h
index e82015b..4204b86 100644
--- a/slicer/db/sqlUpdateSerializer.h
+++ b/slicer/db/sqlUpdateSerializer.h
@@ -1,9 +1,15 @@
#ifndef SLICER_DB_SQLUPDATESERIALIZER_H
#define SLICER_DB_SQLUPDATESERIALIZER_H
-#include <connection.h>
+#include "modelParts.h"
+#include <command_fwd.h>
#include <slicer/serializer.h>
+#include <string>
#include <visibility.h>
+namespace DB {
+ class Connection;
+ class ModifyCommand;
+}
namespace Slicer {
class DLL_PUBLIC SqlUpdateSerializer : public Slicer::Serializer {
diff --git a/slicer/db/testConversions.cpp b/slicer/db/testConversions.cpp
index 68de17a..2c1e482 100644
--- a/slicer/db/testConversions.cpp
+++ b/slicer/db/testConversions.cpp
@@ -1,5 +1,8 @@
-#include <boost/date_time/posix_time/posix_time_types.hpp>
+#include <Ice/Config.h>
+#include <boost/date_time/posix_time/posix_time.hpp>
#include <boost/numeric/conversion/cast.hpp>
+#include <cstdint>
+#include <memory>
#include <testModels.h>
#include <visibility.h>
diff --git a/slicer/db/testInsert.cpp b/slicer/db/testInsert.cpp
index 1919a85..37196b1 100644
--- a/slicer/db/testInsert.cpp
+++ b/slicer/db/testInsert.cpp
@@ -1,13 +1,23 @@
#define BOOST_TEST_MODULE db_insert
+#include <boost/test/unit_test.hpp>
+
+#include "classes.h"
+#include "collections.h"
+#include "common.h"
+#include "slicer/slicer.h"
#include "sqlInsertSerializer.h"
#include "sqlSelectDeserializer.h"
+#include "structs.h"
#include "testMockCommon.h"
-#include <boost/date_time/posix_time/posix_time_io.hpp>
-#include <boost/test/unit_test.hpp>
-#include <common.h>
-#include <slicer/slicer.h>
-#include <testModels.h>
-#include <types.h>
+#include "testModels.h"
+#include <Ice/Optional.h>
+#include <connection.h>
+#include <iosfwd>
+#include <memory>
+#include <string>
+#include <string_view>
+#include <vector>
+// IWYU pragma: no_forward_declare Slicer::UnsupportedModelType
using namespace std::literals;
diff --git a/slicer/db/testMockCommon.cpp b/slicer/db/testMockCommon.cpp
index 0d8c2c9..181a970 100644
--- a/slicer/db/testMockCommon.cpp
+++ b/slicer/db/testMockCommon.cpp
@@ -1,5 +1,10 @@
#include "testMockCommon.h"
+#include <connection_fwd.h>
#include <definedDirs.h>
+#include <filesystem>
+#include <memory>
+#include <mockDatabase.h>
+#include <pq-mock.h>
StandardMockDatabase::StandardMockDatabase() :
DB::PluginMock<PQ::Mock>("pqmock", {rootDir.parent_path() / "db" / "slicer.sql"}, "user=postgres dbname=postgres")
diff --git a/slicer/db/testMockCommon.h b/slicer/db/testMockCommon.h
index c775ae0..e12d2c6 100644
--- a/slicer/db/testMockCommon.h
+++ b/slicer/db/testMockCommon.h
@@ -1,9 +1,14 @@
#ifndef SLICER_DB_MOCKDB_H
#define SLICER_DB_MOCKDB_H
+#include <connection_fwd.h>
#include <mockDatabase.h>
#include <pq-mock.h>
#include <visibility.h>
+// IWYU pragma: no_forward_declare PQ::Mock
+namespace DB {
+ class Connection;
+}
class DLL_PUBLIC StandardMockDatabase : public DB::PluginMock<PQ::Mock> {
public:
diff --git a/slicer/db/testPatch.cpp b/slicer/db/testPatch.cpp
index 5dc5991..6db440a 100644
--- a/slicer/db/testPatch.cpp
+++ b/slicer/db/testPatch.cpp
@@ -1,14 +1,23 @@
#define BOOST_TEST_MODULE db_patch
+#include <boost/test/unit_test.hpp>
+
+#include "classes.h"
+#include "collections.h"
+#include "slicer/slicer.h"
#include "sqlSelectDeserializer.h"
#include "sqlTablePatchSerializer.h"
#include "testMockCommon.h"
-#include <boost/date_time/posix_time/posix_time_io.hpp>
-#include <boost/test/unit_test.hpp>
-#include <common.h>
#include <connection.h>
-#include <slicer/slicer.h>
-#include <testModels.h>
-#include <types.h>
+#include <memory>
+#include <string>
+#include <tablepatch.h>
+namespace TestDatabase {
+ class Timespan;
+}
+namespace TestModule {
+ struct DateTime;
+ struct IsoDate;
+}
// LCOV_EXCL_START
BOOST_TEST_DONT_PRINT_LOG_VALUE(TestModule::DateTime)
diff --git a/slicer/db/testSelect.cpp b/slicer/db/testSelect.cpp
index cbceb02..9759233 100644
--- a/slicer/db/testSelect.cpp
+++ b/slicer/db/testSelect.cpp
@@ -1,14 +1,27 @@
#define BOOST_TEST_MODULE db_select
+#include <boost/test/unit_test.hpp>
+
+#include "classes.h"
+#include "collections.h"
+#include "common.h"
+#include "inheritance.h"
+#include "optionals.h"
+#include "slicer/slicer.h"
+#include "sqlExceptions.h"
#include "sqlSelectDeserializer.h"
+#include "structs.h"
#include "testMockCommon.h"
-#include <boost/date_time/posix_time/posix_time_io.hpp>
-#include <boost/test/unit_test.hpp>
-#include <common.h>
+#include "testModels.h"
+#include <Ice/Config.h>
+#include <Ice/Optional.h>
#include <connection.h>
-#include <slicer/slicer.h>
-#include <sqlExceptions.h>
-#include <testModels.h>
-#include <types.h>
+#include <memory>
+#include <string>
+#include <string_view>
+#include <vector>
+// IWYU pragma: no_forward_declare Slicer::NoRowsReturned
+// IWYU pragma: no_forward_declare Slicer::TooManyRowsReturned
+// IWYU pragma: no_forward_declare Slicer::UnsupportedModelType
using namespace std::literals;
diff --git a/slicer/db/testUpdate.cpp b/slicer/db/testUpdate.cpp
index 04fbdaf..e6368e4 100644
--- a/slicer/db/testUpdate.cpp
+++ b/slicer/db/testUpdate.cpp
@@ -1,15 +1,24 @@
#define BOOST_TEST_MODULE db_update
+#include "classes.h"
+#include "collections.h"
+#include "common.h"
+#include "slicer/slicer.h"
+#include "sqlExceptions.h"
#include "sqlInsertSerializer.h"
#include "sqlSelectDeserializer.h"
#include "sqlUpdateSerializer.h"
#include "testMockCommon.h"
-#include <boost/date_time/posix_time/posix_time_io.hpp>
+#include "testModels.h"
+#include <Ice/Config.h>
+#include <Ice/Optional.h>
#include <boost/test/unit_test.hpp>
-#include <common.h>
-#include <slicer/slicer.h>
-#include <sqlExceptions.h>
-#include <testModels.h>
-#include <types.h>
+#include <connection.h>
+#include <memory>
+#include <string>
+#include <string_view>
+#include <vector>
+// IWYU pragma: no_forward_declare Slicer::NoRowsFound
+// IWYU pragma: no_forward_declare Slicer::UnsupportedModelType
using namespace std::literals;
@@ -94,8 +103,7 @@ BOOST_AUTO_TEST_CASE(update_withNulls)
bis[1]->mbyte = Ice::optional<Ice::Byte>();
bis[0]->mshort = Ice::optional<Ice::Short>();
bis[1]->mdouble = Ice::optional<Ice::Double>();
- BOOST_TEST_CHECKPOINT("Do update");
- Slicer::SerializeAny<Slicer::SqlUpdateSerializer>(bis, db, "builtins");
+ BOOST_REQUIRE_NO_THROW(Slicer::SerializeAny<Slicer::SqlUpdateSerializer>(bis, db, "builtins"));
auto bis2 = Slicer::DeserializeAny<Slicer::SqlSelectDeserializer, TestDatabase::BuiltInSeq>(sel.get());
BOOST_REQUIRE(bis2[0]->mstring);
BOOST_REQUIRE(!bis2[1]->mstring);