summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2022-03-19 02:53:45 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2022-03-19 02:53:45 +0000
commit350216db77a193062c3eaf961a4ffa4fd3e3b829 (patch)
treea8e8dc7719ea3a33d98cb7db1f463ee4d24e0bf2
parentLots of pass by value and perfect forwarding optimisations (diff)
downloadlibdbpp-postgresql-350216db77a193062c3eaf961a4ffa4fd3e3b829.tar.bz2
libdbpp-postgresql-350216db77a193062c3eaf961a4ffa4fd3e3b829.tar.xz
libdbpp-postgresql-350216db77a193062c3eaf961a4ffa4fd3e3b829.zip
Use stringstream string c_str by move
-rw-r--r--libpqpp/pq-cursorselectcommand.cpp2
-rw-r--r--libpqpp/pq-prepared.cpp4
2 files changed, 3 insertions, 3 deletions
diff --git a/libpqpp/pq-cursorselectcommand.cpp b/libpqpp/pq-cursorselectcommand.cpp
index da0a95b..5ace13b 100644
--- a/libpqpp/pq-cursorselectcommand.cpp
+++ b/libpqpp/pq-cursorselectcommand.cpp
@@ -33,7 +33,7 @@ PQ::CursorSelectCommand::mkdeclare() const
std::stringstream psql;
PQCursorSelectDeclare::write(psql, stmntName);
prepareSql(psql, sql);
- return psql.str();
+ return std::move(psql).str();
}
void
diff --git a/libpqpp/pq-prepared.cpp b/libpqpp/pq-prepared.cpp
index 78ad285..83bfcd5 100644
--- a/libpqpp/pq-prepared.cpp
+++ b/libpqpp/pq-prepared.cpp
@@ -25,8 +25,8 @@ PQ::PreparedStatement::prepare() const
}
std::stringstream psql;
prepareSql(psql, sql);
- c->checkResultFree(
- PQprepare(c->conn, stmntName.c_str(), psql.str().c_str(), static_cast<int>(values.size()), nullptr),
+ c->checkResultFree(PQprepare(c->conn, stmntName.c_str(), std::move(psql).str().c_str(),
+ static_cast<int>(values.size()), nullptr),
PGRES_COMMAND_OK);
return (pstmt = c->preparedStatements.insert({hash, stmntName}).first->second.c_str());
}