summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrandomdan <randomdan@localhost>2011-02-18 20:46:01 +0000
committerrandomdan <randomdan@localhost>2011-02-18 20:46:01 +0000
commitc1d88b7c7c1acab583b0c3bae4a6b7ddb320e2b7 (patch)
treed4ef9b84bd263f7981b8cd5c4905d5af85de788c
parentAdd check function for when a connection is finished with, but you don't want... (diff)
downloadlibdbpp-postgresql-c1d88b7c7c1acab583b0c3bae4a6b7ddb320e2b7.tar.bz2
libdbpp-postgresql-c1d88b7c7c1acab583b0c3bae4a6b7ddb320e2b7.tar.xz
libdbpp-postgresql-c1d88b7c7c1acab583b0c3bae4a6b7ddb320e2b7.zip
Split prepare back into it's proper function
-rw-r--r--libpqpp/modifycommand.cpp10
1 files 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));