summaryrefslogtreecommitdiff
path: root/libpqpp/pq-command.h
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2017-01-06 02:11:57 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2017-01-08 19:33:31 +0000
commite9ecbccaa6547cb067653e7240947a76cc60d8ed (patch)
tree99531b2014984151cf2f3dfc7bdc8ca5e234a600 /libpqpp/pq-command.h
parentFix bug where prepared statement cache wasn't cleared on connection reset lea... (diff)
downloadlibdbpp-postgresql-e9ecbccaa6547cb067653e7240947a76cc60d8ed.tar.bz2
libdbpp-postgresql-e9ecbccaa6547cb067653e7240947a76cc60d8ed.tar.xz
libdbpp-postgresql-e9ecbccaa6547cb067653e7240947a76cc60d8ed.zip
Use SQL hash for prepared statement names, increases reuse and avoids random reuse
Diffstat (limited to 'libpqpp/pq-command.h')
-rw-r--r--libpqpp/pq-command.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/libpqpp/pq-command.h b/libpqpp/pq-command.h
index 056706e..e054da8 100644
--- a/libpqpp/pq-command.h
+++ b/libpqpp/pq-command.h
@@ -5,6 +5,7 @@
#include <libpq-fe.h>
#include <vector>
#include <visibility.h>
+#include "pq-connection.h"
namespace PQ {
class Connection;
@@ -21,7 +22,7 @@ namespace PQ {
class Command : public virtual DB::Command {
public:
- Command(Connection *, const std::string & sql, unsigned int no);
+ Command(Connection *, const std::string & sql, const DB::CommandOptions *);
virtual ~Command() = 0;
void bindParamI(unsigned int, int) override;
@@ -44,6 +45,7 @@ namespace PQ {
void bindNull(unsigned int) override;
protected:
void prepareSql(std::stringstream & psql, const std::string & sql) const;
+ Connection::StatementHash hash;
const std::string stmntName;
Connection * const c;