summaryrefslogtreecommitdiff
path: root/libpqpp/connection.cpp
diff options
context:
space:
mode:
authorrandomdan <randomdan@localhost>2011-03-30 18:56:11 +0000
committerrandomdan <randomdan@localhost>2011-03-30 18:56:11 +0000
commiteddbb27048c05d3a719acb71534b95d70d85706c (patch)
tree35409299bfd593da3cd5c2d2a3eeb97af9a27c3d /libpqpp/connection.cpp
parentFinally convert ytfs to use boost stuff (untested, but it does build) (diff)
downloadlibdbpp-postgresql-eddbb27048c05d3a719acb71534b95d70d85706c.tar.bz2
libdbpp-postgresql-eddbb27048c05d3a719acb71534b95d70d85706c.tar.xz
libdbpp-postgresql-eddbb27048c05d3a719acb71534b95d70d85706c.zip
Allow PQ_TUPLES_OK as an ok reply for modify commands (for cases when a function was called using SELECT func(...))
Diffstat (limited to 'libpqpp/connection.cpp')
-rw-r--r--libpqpp/connection.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/libpqpp/connection.cpp b/libpqpp/connection.cpp
index 11c043e..8bfc2ff 100644
--- a/libpqpp/connection.cpp
+++ b/libpqpp/connection.cpp
@@ -105,15 +105,15 @@ PQ::Connection::newModifyCommand(const std::string & sql) const
}
bool
-PQ::Connection::checkResultInt(PGresult * res, int expected)
+PQ::Connection::checkResultInt(PGresult * res, int expected, int alt)
{
- return (PQresultStatus(res) == expected);
+ return (PQresultStatus(res) == expected) || (alt != -1 && (PQresultStatus(res) == alt));
}
PGresult *
-PQ::Connection::checkResult(PGresult * res, int expected) const
+PQ::Connection::checkResult(PGresult * res, int expected, int alt) const
{
- if (!checkResultInt(res, expected)) {
+ if (!checkResultInt(res, expected, alt)) {
PQclear(res);
throw Error(PQerrorMessage(conn));
}
@@ -121,9 +121,9 @@ PQ::Connection::checkResult(PGresult * res, int expected) const
}
void
-PQ::Connection::checkResultFree(PGresult * res, int expected) const
+PQ::Connection::checkResultFree(PGresult * res, int expected, int alt) const
{
- if (!checkResultInt(res, expected)) {
+ if (!checkResultInt(res, expected, alt)) {
PQclear(res);
throw Error(PQerrorMessage(conn));
}