From 90421ed05ded9e4460cb6fdca5c3e3b494737ece Mon Sep 17 00:00:00 2001 From: Iván Ávalos Date: Mon, 8 May 2023 21:19:23 -0600 Subject: Factor out delete_instance_private_key (shit job) --- src/backenddb/plugin_merchantdb_postgres.c | 36 +++--------------------------- 1 file changed, 3 insertions(+), 33 deletions(-) (limited to 'src/backenddb/plugin_merchantdb_postgres.c') diff --git a/src/backenddb/plugin_merchantdb_postgres.c b/src/backenddb/plugin_merchantdb_postgres.c index b1aa8d2c..80f03871 100644 --- a/src/backenddb/plugin_merchantdb_postgres.c +++ b/src/backenddb/plugin_merchantdb_postgres.c @@ -47,6 +47,7 @@ #include "pg_insert_instance.h" #include "pg_account_kyc_set_status.h" #include "pg_account_kyc_get_status.h" +#include "pg_delete_instance_private_key.h" #include "pg_set_transfer_status_to_confirmed.h" @@ -324,31 +325,6 @@ postgres_commit (void *cls) } -/** - * Delete private key of an instance from our database. - * - * @param cls closure - * @param merchant_id identifier of the instance - * @return database result code - */ -static enum GNUNET_DB_QueryStatus -postgres_delete_instance_private_key ( - void *cls, - const char *merchant_id) -{ - struct PostgresClosure *pg = cls; - struct GNUNET_PQ_QueryParam params[] = { - GNUNET_PQ_query_param_string (merchant_id), - GNUNET_PQ_query_param_end - }; - - check_connection (pg); - return GNUNET_PQ_eval_prepared_non_select (pg->conn, - "delete_key", - params); -} - - /** * Purge an instance and all associated information from our database. * Highly likely to cause undesired data loss. Use with caution. @@ -6712,13 +6688,6 @@ postgres_connect (void *cls) struct GNUNET_PQ_PreparedStatement ps[] = { GNUNET_PQ_make_prepare ("end_transaction", "COMMIT"), - /* for postgres_delete_instance_private_key() */ - GNUNET_PQ_make_prepare ("delete_key", - "DELETE FROM merchant_keys" - " USING merchant_instances" - " WHERE merchant_keys.merchant_serial" - " = merchant_instances.merchant_serial" - " AND merchant_instances.merchant_id = $1"), /* for postgres_purge_instance() */ GNUNET_PQ_make_prepare ("purge_instance", "DELETE FROM merchant_instances" @@ -9074,7 +9043,8 @@ libtaler_plugin_merchantdb_postgres_init (void *cls) = &TMH_PG_account_kyc_set_status; plugin->account_kyc_get_status = &TMH_PG_account_kyc_get_status; - plugin->delete_instance_private_key = &postgres_delete_instance_private_key; + plugin->delete_instance_private_key + = &TMH_PG_delete_instance_private_key; plugin->purge_instance = &postgres_purge_instance; plugin->update_instance = &postgres_update_instance; plugin->update_instance_auth = &postgres_update_instance_auth; -- cgit v1.2.3