summaryrefslogtreecommitdiff
path: root/src/pq/pq_eval.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2017-06-03 23:33:43 +0200
committerChristian Grothoff <christian@grothoff.org>2017-06-03 23:33:55 +0200
commit8f254866dc993d2e832ef12ea7b4179f87ab3bd9 (patch)
treeebc1ced68bb48f74f189dadd4b29ff5119849224 /src/pq/pq_eval.c
parent1a90e7878a8fa1f5b30421bd3045cf5d6d3e13e4 (diff)
more pq work
Diffstat (limited to 'src/pq/pq_eval.c')
-rw-r--r--src/pq/pq_eval.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/pq/pq_eval.c b/src/pq/pq_eval.c
index d6c10e2c5..9296dce2e 100644
--- a/src/pq/pq_eval.c
+++ b/src/pq/pq_eval.c
@@ -119,9 +119,9 @@ GNUNET_PQ_eval_result (PGconn *connection,
* @param statement_name name of the statement
* @param params parameters to give to the statement (#GNUNET_PQ_query_param_end-terminated)
* @return status code from the result, mapping PQ status
- * codes to `enum GNUNET_PQ_QueryStatus`. Never
- * returns positive values as this function does
- * not look at the result set.
+ * codes to `enum GNUNET_PQ_QueryStatus`. If the
+ * statement was a DELETE or UPDATE statement, the
+ * number of affected rows is returned.
*/
enum GNUNET_PQ_QueryStatus
GNUNET_PQ_eval_prepared_non_select (PGconn *connection,
@@ -137,6 +137,15 @@ GNUNET_PQ_eval_prepared_non_select (PGconn *connection,
qs = GNUNET_PQ_eval_result (connection,
statement_name,
result);
+ if (GNUNET_PQ_STATUS_SUCCESS_NO_RESULTS == qs)
+ {
+ const char *tuples;
+
+ /* What an awful API, this function really does return a string */
+ tuples = PQcmdTuples (result);
+ if (NULL != tuples)
+ qs = strtol (tuples, NULL, 10);
+ }
PQclear (result);
return qs;
}