summaryrefslogtreecommitdiff
path: root/libpqpp/modifycommand.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libpqpp/modifycommand.cpp')
-rw-r--r--libpqpp/modifycommand.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/libpqpp/modifycommand.cpp b/libpqpp/modifycommand.cpp
index 14bfb16..ae7abeb 100644
--- a/libpqpp/modifycommand.cpp
+++ b/libpqpp/modifycommand.cpp
@@ -1,4 +1,5 @@
#include "modifycommand.h"
+#include "error.h"
#include <stdlib.h>
#include "connection.h"
@@ -18,9 +19,12 @@ 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, __PRETTY_FUNCTION__);
+ c->checkResult(res, PGRES_COMMAND_OK);
unsigned int rows = atoi(PQcmdTuples(res));
PQclear(res);
+ if (rows == 0 && !anc) {
+ throw Error("No rows affected");
+ }
return rows;
}