diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2015-12-24 04:00:01 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2015-12-24 04:00:01 +0000 |
commit | 55dc8fa7bef00c0d382860b2f9b0245731db2bcb (patch) | |
tree | d68bc64bc6ba5e8c91f2d32f0c691b9be6998cb0 /libpqpp/modifycommand.cpp | |
parent | Use parent glibmm (diff) | |
download | libdbpp-postgresql-55dc8fa7bef00c0d382860b2f9b0245731db2bcb.tar.bz2 libdbpp-postgresql-55dc8fa7bef00c0d382860b2f9b0245731db2bcb.tar.xz libdbpp-postgresql-55dc8fa7bef00c0d382860b2f9b0245731db2bcb.zip |
PostgreSQL files prefixed with pq-
Diffstat (limited to 'libpqpp/modifycommand.cpp')
-rw-r--r-- | libpqpp/modifycommand.cpp | 44 |
1 files changed, 0 insertions, 44 deletions
diff --git a/libpqpp/modifycommand.cpp b/libpqpp/modifycommand.cpp deleted file mode 100644 index 460ec31..0000000 --- a/libpqpp/modifycommand.cpp +++ /dev/null @@ -1,44 +0,0 @@ -#include "modifycommand.h" -#include "error.h" -#include <stdlib.h> -#include "connection.h" - -PQ::ModifyCommand::ModifyCommand(const Connection * conn, const std::string & sql, unsigned int no) : - DB::Command(sql), - DB::ModifyCommand(sql), - PQ::Command(conn, sql, no), - prepared(false) -{ -} - -PQ::ModifyCommand::~ModifyCommand() -{ -} - -void -PQ::ModifyCommand::prepare() const -{ - if (!prepared) { - std::string psql; - psql.reserve(sql.length() + 20); - prepareSql(psql, sql); - c->checkResultFree(PQprepare( - 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, PGRES_TUPLES_OK); - unsigned int rows = atoi(PQcmdTuples(res)); - PQclear(res); - if (rows == 0 && !anc) { - throw Error("No rows affected"); - } - return rows; -} - |