diff options
Diffstat (limited to 'src/pq/pq_eval.c')
-rw-r--r-- | src/pq/pq_eval.c | 15 |
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, | |||
119 | * @param statement_name name of the statement | 119 | * @param statement_name name of the statement |
120 | * @param params parameters to give to the statement (#GNUNET_PQ_query_param_end-terminated) | 120 | * @param params parameters to give to the statement (#GNUNET_PQ_query_param_end-terminated) |
121 | * @return status code from the result, mapping PQ status | 121 | * @return status code from the result, mapping PQ status |
122 | * codes to `enum GNUNET_PQ_QueryStatus`. Never | 122 | * codes to `enum GNUNET_PQ_QueryStatus`. If the |
123 | * returns positive values as this function does | 123 | * statement was a DELETE or UPDATE statement, the |
124 | * not look at the result set. | 124 | * number of affected rows is returned. |
125 | */ | 125 | */ |
126 | enum GNUNET_PQ_QueryStatus | 126 | enum GNUNET_PQ_QueryStatus |
127 | GNUNET_PQ_eval_prepared_non_select (PGconn *connection, | 127 | GNUNET_PQ_eval_prepared_non_select (PGconn *connection, |
@@ -137,6 +137,15 @@ GNUNET_PQ_eval_prepared_non_select (PGconn *connection, | |||
137 | qs = GNUNET_PQ_eval_result (connection, | 137 | qs = GNUNET_PQ_eval_result (connection, |
138 | statement_name, | 138 | statement_name, |
139 | result); | 139 | result); |
140 | if (GNUNET_PQ_STATUS_SUCCESS_NO_RESULTS == qs) | ||
141 | { | ||
142 | const char *tuples; | ||
143 | |||
144 | /* What an awful API, this function really does return a string */ | ||
145 | tuples = PQcmdTuples (result); | ||
146 | if (NULL != tuples) | ||
147 | qs = strtol (tuples, NULL, 10); | ||
148 | } | ||
140 | PQclear (result); | 149 | PQclear (result); |
141 | return qs; | 150 | return qs; |
142 | } | 151 | } |