summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libdbpp/column.h8
-rw-r--r--libdbpp/command.h6
-rw-r--r--libdbpp/connection.cpp2
-rw-r--r--libdbpp/connection.h2
-rw-r--r--libdbpp/mockDatabase.h7
-rw-r--r--libdbpp/selectcommandUtil.impl.h4
-rw-r--r--libdbpp/tablepatch.cpp13
-rw-r--r--libdbpp/testCore.cpp43
-rw-r--r--libdbpp/testCore.h4
m---------libdbpp/unittests/libdbpp-mysql0
m---------libdbpp/unittests/libdbpp-odbc0
m---------libdbpp/unittests/libdbpp-postgresql0
m---------libdbpp/unittests/libdbpp-sqlite0
13 files changed, 46 insertions, 43 deletions
diff --git a/libdbpp/column.h b/libdbpp/column.h
index a30e1b8..b9260cb 100644
--- a/libdbpp/column.h
+++ b/libdbpp/column.h
@@ -42,9 +42,9 @@ namespace DB {
/// The field is floating point/fixed point/numeric.
virtual void floatingpoint(double) = 0;
/// The field is an interval/duration/time span.
- virtual void interval(const boost::posix_time::time_duration &) = 0;
+ virtual void interval(const boost::posix_time::time_duration) = 0;
/// The field is a timestamp/date/datetime.
- virtual void timestamp(const boost::posix_time::ptime &) = 0;
+ virtual void timestamp(const boost::posix_time::ptime) = 0;
/// The field is a BLOB.
virtual void blob(const Blob &);
};
@@ -100,12 +100,12 @@ namespace DB {
(*this)(v);
}
void
- timestamp(const boost::posix_time::ptime & v) override
+ timestamp(const boost::posix_time::ptime v) override
{
(*this)(v);
}
void
- interval(const boost::posix_time::time_duration & v) override
+ interval(const boost::posix_time::time_duration v) override
{
(*this)(v);
}
diff --git a/libdbpp/command.h b/libdbpp/command.h
index eae7775..98e59b4 100644
--- a/libdbpp/command.h
+++ b/libdbpp/command.h
@@ -100,7 +100,7 @@ namespace DB {
/// Bind a string to parameter i.
virtual void bindParamS(unsigned int i, const Glib::ustring &) = 0;
/// Bind a string_view to parameter i.
- virtual void bindParamS(unsigned int i, const std::string_view &) = 0;
+ virtual void bindParamS(unsigned int i, const std::string_view) = 0;
/// Bind a string to parameter i (wraps string_view).
inline void
bindParamS(unsigned int i, const std::string & v)
@@ -109,9 +109,9 @@ namespace DB {
}
/// Bind a duration to parameter i.
- virtual void bindParamT(unsigned int i, const boost::posix_time::time_duration &) = 0;
+ virtual void bindParamT(unsigned int i, const boost::posix_time::time_duration) = 0;
/// Bind a date time to parameter i.
- virtual void bindParamT(unsigned int i, const boost::posix_time::ptime &) = 0;
+ virtual void bindParamT(unsigned int i, const boost::posix_time::ptime) = 0;
/// Bind a BLOB to parameter i.
virtual void bindParamBLOB(unsigned int i, const Blob &);
diff --git a/libdbpp/connection.cpp b/libdbpp/connection.cpp
index 7d3db42..7208c93 100644
--- a/libdbpp/connection.cpp
+++ b/libdbpp/connection.cpp
@@ -162,7 +162,7 @@ DB::Connection::bulkUploadData(FILE * in) const
AdHocFormatter(PluginLibraryFormat, "libdbpp-%?.so");
std::optional<std::string>
-DB::Connection::resolvePlugin(const std::type_info &, const std::string_view & name)
+DB::Connection::resolvePlugin(const std::type_info &, const std::string_view name)
{
return PluginLibraryFormat::get(name);
}
diff --git a/libdbpp/connection.h b/libdbpp/connection.h
index 8bf74af..4399b37 100644
--- a/libdbpp/connection.h
+++ b/libdbpp/connection.h
@@ -145,7 +145,7 @@ namespace DB {
PatchResult patchTable(TablePatch * tp);
/// AdHoc plugin resolver helper for database connectors.
- static std::optional<std::string> resolvePlugin(const std::type_info &, const std::string_view &);
+ static std::optional<std::string> resolvePlugin(const std::type_info &, const std::string_view);
protected:
/// Create a new connection.
diff --git a/libdbpp/mockDatabase.h b/libdbpp/mockDatabase.h
index 55c175f..d067967 100644
--- a/libdbpp/mockDatabase.h
+++ b/libdbpp/mockDatabase.h
@@ -8,6 +8,7 @@
#include <initializer_list>
#include <memory>
#include <string>
+#include <utility>
#include <vector>
#include <visibility.h>
// IWYU pragma: no_include "factory.impl.h"
@@ -68,11 +69,11 @@ namespace DB {
/// @param s the collection of scripts to populate the mock database.
/// @param args arguments to the mock database constructor.
template<typename... Args>
- PluginMock(const std::string & name, const std::initializer_list<std::filesystem::path> & s,
- const Args &... args) :
+ PluginMock(const std::string & name, const std::initializer_list<std::filesystem::path> & s, Args &&... args) :
mockName(name)
{
- AdHoc::PluginManager::getDefault()->create<MockDatabase, T>(mockName, __FILE__, __LINE__, args..., name, s);
+ AdHoc::PluginManager::getDefault()->create<MockDatabase, T>(
+ mockName, __FILE__, __LINE__, std::forward<Args>(args)..., name, s);
}
~PluginMock()
{
diff --git a/libdbpp/selectcommandUtil.impl.h b/libdbpp/selectcommandUtil.impl.h
index ec1d56a..9ef901e 100644
--- a/libdbpp/selectcommandUtil.impl.h
+++ b/libdbpp/selectcommandUtil.impl.h
@@ -8,11 +8,11 @@
namespace DB {
template<typename Fields, typename Func, unsigned int field, typename... Fn, typename... Args>
inline void
- forEachField(DB::SelectCommand * sel, const Func & func, const Args &... args)
+ forEachField(DB::SelectCommand * sel, const Func & func, Args &&... args)
{
if constexpr (field >= std::tuple_size<Fields>::value) {
(void)sel;
- func(args...);
+ func(std::forward<Args>(args)...);
}
else {
typename std::tuple_element<field, Fields>::type a;
diff --git a/libdbpp/tablepatch.cpp b/libdbpp/tablepatch.cpp
index 132e28c..db8cac6 100644
--- a/libdbpp/tablepatch.cpp
+++ b/libdbpp/tablepatch.cpp
@@ -8,6 +8,7 @@
#include <buffer.h>
#include <memory>
#include <safeMapFind.h>
+#include <utility>
DB::PatchResult
DB::Connection::patchTable(TablePatch * tp)
@@ -41,17 +42,17 @@ push(const boost::format &, typename Container::const_iterator &)
template<typename Container, typename Value, typename... Values>
static inline void
-push(boost::format & f, typename Container::const_iterator & i, const Value & v, const Values &... vs)
+push(boost::format & f, typename Container::const_iterator & i, const Value & v, Values &&... vs)
{
f % v(i);
- push<Container>(f, i, vs...);
+ push<Container>(f, i, std::forward<Values>(vs)...);
}
template<typename Separator, typename Container, typename... Ps>
static inline unsigned int
appendIf(AdHoc::Buffer & buf, const Container & c,
const std::function<bool(const typename Container::const_iterator)> & sel, const Separator & sep,
- const std::string & fmts, const Ps &... ps)
+ const std::string & fmts, Ps &&... ps)
{
auto fmt = AdHoc::Buffer::getFormat(fmts);
unsigned int x = 0;
@@ -60,7 +61,7 @@ appendIf(AdHoc::Buffer & buf, const Container & c,
if (x > 0) {
buf.appendbf("%s", sep);
}
- push<Container>(fmt, i, ps...);
+ push<Container>(fmt, i, std::forward<Ps>(ps)...);
buf.append(fmt.str());
x += 1;
}
@@ -70,14 +71,14 @@ appendIf(AdHoc::Buffer & buf, const Container & c,
template<typename Separator, typename Container, typename... Ps>
static inline unsigned int
-append(AdHoc::Buffer & buf, const Container & c, const Separator & sep, const std::string & fmts, const Ps &... ps)
+append(AdHoc::Buffer & buf, const Container & c, const Separator & sep, const std::string & fmts, Ps &&... ps)
{
return appendIf(
buf, c,
[](auto) {
return true;
},
- sep, fmts, ps...);
+ sep, fmts, std::forward<Ps>(ps)...);
}
template<typename Container>
diff --git a/libdbpp/testCore.cpp b/libdbpp/testCore.cpp
index 94e1cbf..ef2588d 100644
--- a/libdbpp/testCore.cpp
+++ b/libdbpp/testCore.cpp
@@ -44,12 +44,12 @@ namespace DB {
(*this)(v);
}
void
- timestamp(const boost::posix_time::ptime & v) override
+ timestamp(const boost::posix_time::ptime v) override
{
(*this)(v);
}
void
- interval(const boost::posix_time::time_duration & v) override
+ interval(const boost::posix_time::time_duration v) override
{
(*this)(v);
}
@@ -82,8 +82,9 @@ namespace DB {
template<typename T>
void
- TestCore::assertScalarValueHelper(DB::SelectCommand & sel, const T & t) const
+ TestCore::assertScalarValueHelper(DB::SelectCommand & sel, const T t) const
{
+ static_assert(std::is_trivially_copyable_v<T>);
while (sel.fetch()) {
assertColumnValueHelper(sel, 0, t);
}
@@ -91,8 +92,9 @@ namespace DB {
template<typename T>
void
- TestCore::assertColumnValueHelper(DB::SelectCommand & sel, unsigned int col, const T & t) const
+ TestCore::assertColumnValueHelper(DB::SelectCommand & sel, unsigned int col, const T t) const
{
+ static_assert(std::is_trivially_copyable_v<T>);
Assert<T> a(t);
sel[col].apply(a);
}
@@ -105,27 +107,26 @@ namespace DB {
return s;
}
- template void TestCore::assertScalarValueHelper<bool>(SelectCommand &, const bool &) const;
- template void TestCore::assertScalarValueHelper<int64_t>(SelectCommand &, const int64_t &) const;
- template void TestCore::assertScalarValueHelper<int>(SelectCommand &, const int &) const;
- template void TestCore::assertScalarValueHelper<double>(SelectCommand &, const double &) const;
- template void TestCore::assertScalarValueHelper<std::string_view>(SelectCommand &, const std::string_view &) const;
+ template void TestCore::assertScalarValueHelper<bool>(SelectCommand &, const bool) const;
+ template void TestCore::assertScalarValueHelper<int64_t>(SelectCommand &, const int64_t) const;
+ template void TestCore::assertScalarValueHelper<int>(SelectCommand &, const int) const;
+ template void TestCore::assertScalarValueHelper<double>(SelectCommand &, const double) const;
+ template void TestCore::assertScalarValueHelper<std::string_view>(SelectCommand &, const std::string_view) const;
template void TestCore::assertScalarValueHelper<boost::posix_time::ptime>(
- SelectCommand &, const boost::posix_time::ptime &) const;
+ SelectCommand &, const boost::posix_time::ptime) const;
template void TestCore::assertScalarValueHelper<boost::posix_time::time_duration>(
- SelectCommand &, const boost::posix_time::time_duration &) const;
- template void TestCore::assertScalarValueHelper<DB::Blob>(SelectCommand &, const DB::Blob &) const;
+ SelectCommand &, const boost::posix_time::time_duration) const;
+ template void TestCore::assertScalarValueHelper<DB::Blob>(SelectCommand &, const DB::Blob) const;
- template void TestCore::assertColumnValueHelper<bool>(SelectCommand &, unsigned int, const bool &) const;
- template void TestCore::assertColumnValueHelper<int>(SelectCommand &, unsigned int, const int &) const;
- template void TestCore::assertColumnValueHelper<int64_t>(SelectCommand &, unsigned int, const int64_t &) const;
- template void TestCore::assertColumnValueHelper<double>(SelectCommand &, unsigned int, const double &) const;
+ template void TestCore::assertColumnValueHelper<bool>(SelectCommand &, unsigned int, const bool) const;
+ template void TestCore::assertColumnValueHelper<int>(SelectCommand &, unsigned int, const int) const;
+ template void TestCore::assertColumnValueHelper<int64_t>(SelectCommand &, unsigned int, const int64_t) const;
+ template void TestCore::assertColumnValueHelper<double>(SelectCommand &, unsigned int, const double) const;
template void TestCore::assertColumnValueHelper<std::string_view>(
- SelectCommand &, unsigned int, const std::string_view &) const;
+ SelectCommand &, unsigned int, const std::string_view) const;
template void TestCore::assertColumnValueHelper<boost::posix_time::ptime>(
- SelectCommand &, unsigned int, const boost::posix_time::ptime &) const;
+ SelectCommand &, unsigned int, const boost::posix_time::ptime) const;
template void TestCore::assertColumnValueHelper<boost::posix_time::time_duration>(
- SelectCommand &, unsigned int, const boost::posix_time::time_duration &) const;
- template void TestCore::assertColumnValueHelper<DB::Blob>(SelectCommand &, unsigned int, const DB::Blob &) const;
-
+ SelectCommand &, unsigned int, const boost::posix_time::time_duration) const;
+ template void TestCore::assertColumnValueHelper<DB::Blob>(SelectCommand &, unsigned int, const DB::Blob) const;
}
diff --git a/libdbpp/testCore.h b/libdbpp/testCore.h
index 32c033d..16c4999 100644
--- a/libdbpp/testCore.h
+++ b/libdbpp/testCore.h
@@ -27,8 +27,8 @@ namespace DB {
std::vector<unsigned char> testBlobData;
DB::Blob testBlob;
- template<typename T> void assertScalarValueHelper(SelectCommand & sel, const T & t) const;
- template<typename T> void assertColumnValueHelper(SelectCommand & sel, unsigned int col, const T & t) const;
+ template<typename T> void assertScalarValueHelper(SelectCommand & sel, const T t) const;
+ template<typename T> void assertColumnValueHelper(SelectCommand & sel, unsigned int col, const T t) const;
};
/// @endcond
diff --git a/libdbpp/unittests/libdbpp-mysql b/libdbpp/unittests/libdbpp-mysql
-Subproject ce5d5f847b07d980a6042fd4ef14bc80154b6c0
+Subproject aae2742b9dbc2a5908459372d75e11a0fdec5cb
diff --git a/libdbpp/unittests/libdbpp-odbc b/libdbpp/unittests/libdbpp-odbc
-Subproject 40ad9a3711e703fde3d78a5633e42113cb45070
+Subproject 704dd8c7ecedb68161c52329e22141877143ff1
diff --git a/libdbpp/unittests/libdbpp-postgresql b/libdbpp/unittests/libdbpp-postgresql
-Subproject 26e6666d48d0c2e467603f07b60b91f825c5534
+Subproject d6fd5db66afb2493202192c018cdb153f0a1ca8
diff --git a/libdbpp/unittests/libdbpp-sqlite b/libdbpp/unittests/libdbpp-sqlite
-Subproject 045b8ebd2234ee5b356f0b9cc6ba54cf1e57685
+Subproject 8f00ea37def4d0f3d36d77ec643a9abd193161b