summaryrefslogtreecommitdiff
path: root/libpqpp/pq-command.cpp
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2022-03-17 19:45:15 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2022-03-17 19:45:15 +0000
commitd6fd5db66afb2493202192c018cdb153f0a1ca84 (patch)
tree686ff00a1a0699e0fc11dae2deaa427e2f9e7a59 /libpqpp/pq-command.cpp
parentenum class BulkUpdates (diff)
downloadlibdbpp-postgresql-d6fd5db66afb2493202192c018cdb153f0a1ca84.tar.bz2
libdbpp-postgresql-d6fd5db66afb2493202192c018cdb153f0a1ca84.tar.xz
libdbpp-postgresql-d6fd5db66afb2493202192c018cdb153f0a1ca84.zip
Lots of pass by value and perfect forwarding optimisations
Diffstat (limited to 'libpqpp/pq-command.cpp')
-rw-r--r--libpqpp/pq-command.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/libpqpp/pq-command.cpp b/libpqpp/pq-command.cpp
index 9e98eb5..dad2ef9 100644
--- a/libpqpp/pq-command.cpp
+++ b/libpqpp/pq-command.cpp
@@ -3,6 +3,7 @@
#include <dbTypes.h>
#include <factory.h>
#include <optional>
+#include <utility>
namespace Glib {
class ustring;
@@ -69,17 +70,17 @@ PQ::Command::paramsAtLeast(unsigned int n)
AdHocFormatter(PQCommandParamFmt, "%?");
template<typename... T>
void
-PQ::Command::paramSet(unsigned int n, const T &... v)
+PQ::Command::paramSet(unsigned int n, T &&... v)
{
paramsAtLeast(n);
- bufs[n] = std::make_unique<std::string>(PQCommandParamFmt::get(v...));
+ bufs[n] = std::make_unique<std::string>(PQCommandParamFmt::get(std::forward<T>(v)...));
lengths[n] = static_cast<int>(bufs[n]->length());
formats[n] = 0;
values[n] = bufs[n]->data();
}
void
-PQ::Command::paramSet(unsigned int n, const std::string_view & b)
+PQ::Command::paramSet(unsigned int n, const std::string_view b)
{
paramsAtLeast(n);
bufs[n] = std::make_unique<std::string>(b);
@@ -139,17 +140,17 @@ PQ::Command::bindParamS(unsigned int n, const Glib::ustring & s)
paramSet(n, std::string_view(s.data(), s.bytes()));
}
void
-PQ::Command::bindParamS(unsigned int n, const std::string_view & s)
+PQ::Command::bindParamS(unsigned int n, const std::string_view s)
{
paramSet(n, s);
}
void
-PQ::Command::bindParamT(unsigned int n, const boost::posix_time::time_duration & v)
+PQ::Command::bindParamT(unsigned int n, const boost::posix_time::time_duration v)
{
paramSet(n, boost::posix_time::to_simple_string(v));
}
void
-PQ::Command::bindParamT(unsigned int n, const boost::posix_time::ptime & v)
+PQ::Command::bindParamT(unsigned int n, const boost::posix_time::ptime v)
{
paramSet(n, boost::posix_time::to_iso_extended_string(v));
}