aboutsummaryrefslogtreecommitdiff
path: root/src/auditor/taler-auditor-httpd_delete_generic.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/auditor/taler-auditor-httpd_delete_generic.c')
-rw-r--r--src/auditor/taler-auditor-httpd_delete_generic.c121
1 files changed, 61 insertions, 60 deletions
diff --git a/src/auditor/taler-auditor-httpd_delete_generic.c b/src/auditor/taler-auditor-httpd_delete_generic.c
index 2f2775cd1..f435454fe 100644
--- a/src/auditor/taler-auditor-httpd_delete_generic.c
+++ b/src/auditor/taler-auditor-httpd_delete_generic.c
@@ -13,8 +13,6 @@
You should have received a copy of the GNU General Public License along with
TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-
-
#include "platform.h"
#include <gnunet/gnunet_util_lib.h>
#include <gnunet/gnunet_json_lib.h>
@@ -24,6 +22,7 @@
#include "taler_json_lib.h"
#include "taler_mhd_lib.h"
#include "taler-auditor-httpd.h"
+#include "taler-auditor-httpd_delete_generic.h"
MHD_RESULT
@@ -33,64 +32,66 @@ TAH_delete_handler_generic (
void **connection_cls,
const char *upload_data,
size_t *upload_data_size,
- const char *const args[]) {
- enum GNUNET_DB_QueryStatus qs;
- unsigned long long row_id;
-
- (void) connection_cls;
- if (GNUNET_SYSERR ==
- TAH_plugin->preflight(TAH_plugin->cls)) {
- GNUNET_break(0);
- return TALER_MHD_reply_with_error(connection,
- MHD_HTTP_INTERNAL_SERVER_ERROR,
- TALER_EC_GENERIC_DB_SETUP_FAILED,
- NULL);
- }
-
- if ((NULL == args[1]) ||
- (1 != sscanf(args[1],
- "%llu",
- &row_id))) {
- GNUNET_break_op(0);
- return TALER_MHD_reply_with_error(connection,
- MHD_HTTP_BAD_REQUEST,
- TALER_EC_AUDITOR_RESOURCE_NOT_FOUND,
- "no row id specified");
- }
+ const char *const args[])
+{
+ enum GNUNET_DB_QueryStatus qs;
+ unsigned long long row_id;
+ char dummy;
- {
+ (void) connection_cls;
+ if (GNUNET_SYSERR ==
+ TAH_plugin->preflight (TAH_plugin->cls))
+ {
+ GNUNET_break (0);
+ return TALER_MHD_reply_with_error (connection,
+ MHD_HTTP_INTERNAL_SERVER_ERROR,
+ TALER_EC_GENERIC_DB_SETUP_FAILED,
+ NULL);
+ }
- /* execute transaction */
- qs = TAH_plugin->delete_generic(TAH_plugin->cls,
- rh->table,
- row_id);
+ if ((NULL == args[1]) ||
+ (1 != sscanf (args[1],
+ "%llu%c",
+ &row_id,
+ &dummy)))
+ {
+ GNUNET_break_op (0);
+ return TALER_MHD_reply_with_error (connection,
+ MHD_HTTP_BAD_REQUEST,
+ TALER_EC_AUDITOR_RESOURCE_NOT_FOUND,
+ "no row id specified");
+ }
- switch (qs) {
- case GNUNET_DB_STATUS_HARD_ERROR:
- GNUNET_break(0);
- return TALER_MHD_reply_with_error(connection,
- MHD_HTTP_INTERNAL_SERVER_ERROR,
- TALER_EC_GENERIC_DB_STORE_FAILED,
- "db store failed");
- case GNUNET_DB_STATUS_SOFT_ERROR:
- GNUNET_break(0);
- return TALER_MHD_reply_with_error(connection,
- MHD_HTTP_INTERNAL_SERVER_ERROR,
- TALER_EC_GENERIC_INTERNAL_INVARIANT_FAILURE,
- "unexpected serialization problem");
- case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS:
- return TALER_MHD_reply_with_error(connection,
- MHD_HTTP_NOT_FOUND,
- TALER_EC_AUDITOR_RESOURCE_NOT_FOUND,
- "no delete executed");
- case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT:
- return TALER_MHD_reply_static(connection,
- MHD_HTTP_NO_CONTENT,
- NULL,
- NULL,
- 0);
- }
- GNUNET_break(0);
- return MHD_NO;
- }
-} \ No newline at end of file
+ /* execute transaction */
+ qs = TAH_plugin->delete_generic (TAH_plugin->cls,
+ rh->table,
+ row_id);
+ switch (qs)
+ {
+ case GNUNET_DB_STATUS_HARD_ERROR:
+ GNUNET_break (0);
+ return TALER_MHD_reply_with_error (connection,
+ MHD_HTTP_INTERNAL_SERVER_ERROR,
+ TALER_EC_GENERIC_DB_STORE_FAILED,
+ "db store failed");
+ case GNUNET_DB_STATUS_SOFT_ERROR:
+ GNUNET_break (0);
+ return TALER_MHD_reply_with_error (connection,
+ MHD_HTTP_INTERNAL_SERVER_ERROR,
+ TALER_EC_GENERIC_INTERNAL_INVARIANT_FAILURE,
+ "unexpected serialization problem");
+ case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS:
+ return TALER_MHD_reply_with_error (connection,
+ MHD_HTTP_NOT_FOUND,
+ TALER_EC_AUDITOR_RESOURCE_NOT_FOUND,
+ "no delete executed");
+ case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT:
+ return TALER_MHD_reply_static (connection,
+ MHD_HTTP_NO_CONTENT,
+ NULL,
+ NULL,
+ 0);
+ }
+ GNUNET_break (0);
+ return MHD_NO;
+}