summaryrefslogtreecommitdiff
path: root/libpqpp/pq-bulkselectcommand.cpp
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2016-04-24 18:48:23 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2016-04-24 18:48:23 +0100
commit56de3f5f9768396525669af327fd00d36e621ada (patch)
tree385bc028607b5d573a87ab2da861c06596fb61cf /libpqpp/pq-bulkselectcommand.cpp
parentSupport bulk selects which don't use cursors, always use of RETURNING (diff)
downloadlibdbpp-postgresql-56de3f5f9768396525669af327fd00d36e621ada.tar.bz2
libdbpp-postgresql-56de3f5f9768396525669af327fd00d36e621ada.tar.xz
libdbpp-postgresql-56de3f5f9768396525669af327fd00d36e621ada.zip
Use prepared statements for bulk selects
Diffstat (limited to 'libpqpp/pq-bulkselectcommand.cpp')
-rw-r--r--libpqpp/pq-bulkselectcommand.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/libpqpp/pq-bulkselectcommand.cpp b/libpqpp/pq-bulkselectcommand.cpp
index 27674f5..8b669f4 100644
--- a/libpqpp/pq-bulkselectcommand.cpp
+++ b/libpqpp/pq-bulkselectcommand.cpp
@@ -6,10 +6,9 @@
PQ::BulkSelectCommand::BulkSelectCommand(Connection * conn, const std::string & sql, unsigned int no) :
DB::Command(sql),
DB::SelectCommand(sql),
- PQ::Command(conn, sql, no),
+ PQ::PreparedStatement(conn, sql, no),
executed(false)
{
- prepareSql(preparedSql, sql);
}
PQ::BulkSelectCommand::~BulkSelectCommand()
@@ -24,7 +23,7 @@ PQ::BulkSelectCommand::execute()
{
if (!executed) {
execRes = c->checkResult(
- PQexecParams(c->conn, preparedSql.c_str(), values.size(), NULL, &values.front(), &lengths.front(), NULL, 0),
+ PQexecPrepared(c->conn, prepare(), values.size(), &values.front(), &lengths.front(), NULL, 0),
PGRES_TUPLES_OK);
nTuples = PQntuples(execRes);
tuple = -1;