From c1d88b7c7c1acab583b0c3bae4a6b7ddb320e2b7 Mon Sep 17 00:00:00 2001 From: randomdan Date: Fri, 18 Feb 2011 20:46:01 +0000 Subject: Split prepare back into it's proper function --- libpqpp/modifycommand.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/libpqpp/modifycommand.cpp b/libpqpp/modifycommand.cpp index c14ff74..69cd8cc 100644 --- a/libpqpp/modifycommand.cpp +++ b/libpqpp/modifycommand.cpp @@ -15,8 +15,8 @@ PQ::ModifyCommand::~ModifyCommand() { } -unsigned int -PQ::ModifyCommand::execute(bool anc) +void +PQ::ModifyCommand::prepare() const { if (!prepared) { std::string psql; @@ -41,6 +41,12 @@ PQ::ModifyCommand::execute(bool anc) c->conn, stmntName.c_str(), psql.c_str(), values.size(), NULL), PGRES_COMMAND_OK); prepared = true; } +} + +unsigned int +PQ::ModifyCommand::execute(bool anc) +{ + prepare(); PGresult * res = PQexecPrepared(c->conn, stmntName.c_str(), values.size(), &values.front(), &lengths.front(), &formats.front(), 0); c->checkResult(res, PGRES_COMMAND_OK); unsigned int rows = atoi(PQcmdTuples(res)); -- cgit v1.2.3