summaryrefslogtreecommitdiff
path: root/libpqpp/pq-prepared.cpp
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2017-01-01 20:08:22 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2017-01-01 20:08:22 +0000
commitdaaf7b3facc18bc3073b0ffb245e1c86d8670b8b (patch)
tree3bf72e869b9e19098bdf5792654a02daa230b207 /libpqpp/pq-prepared.cpp
parentAPI change to pass command options through (diff)
downloadlibdbpp-postgresql-daaf7b3facc18bc3073b0ffb245e1c86d8670b8b.tar.bz2
libdbpp-postgresql-daaf7b3facc18bc3073b0ffb245e1c86d8670b8b.tar.xz
libdbpp-postgresql-daaf7b3facc18bc3073b0ffb245e1c86d8670b8b.zip
Use command options statement hash when it's availablelibdbpp-postgresql-1.1.0
Diffstat (limited to 'libpqpp/pq-prepared.cpp')
-rw-r--r--libpqpp/pq-prepared.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/libpqpp/pq-prepared.cpp b/libpqpp/pq-prepared.cpp
index 4cd4540..bdf2a7d 100644
--- a/libpqpp/pq-prepared.cpp
+++ b/libpqpp/pq-prepared.cpp
@@ -1,9 +1,10 @@
#include "pq-prepared.h"
#include "pq-connection.h"
-PQ::PreparedStatement::PreparedStatement(Connection * c, const std::string & sql, unsigned int no) :
+PQ::PreparedStatement::PreparedStatement(Connection * c, const std::string & sql, unsigned int no, const DB::CommandOptions * opts) :
DB::Command(sql),
Command(c, sql, no),
+ hash(opts && opts->hash ? *opts->hash : std::hash<std::string>()(sql)),
pstmt(nullptr)
{
}
@@ -14,7 +15,6 @@ PQ::PreparedStatement::prepare() const
if (pstmt) {
return pstmt;
}
- auto hash(std::hash<std::string>()(sql));
auto i = c->preparedStatements.find(hash);
if (i != c->preparedStatements.end()) {
return (pstmt = i->second.c_str());