diff options
author | Iván Ávalos <avalos@disroot.org> | 2023-05-08 21:19:23 -0600 |
---|---|---|
committer | Iván Ávalos <avalos@disroot.org> | 2023-05-08 21:19:23 -0600 |
commit | 90421ed05ded9e4460cb6fdca5c3e3b494737ece (patch) | |
tree | 0f40bf65d1983b8d5d1adba8af2b990a6e514386 /src/backenddb/plugin_merchantdb_postgres.c | |
parent | 41719f3d9969eba8169deb4101b4c9213c20d3da (diff) | |
download | merchant-90421ed05ded9e4460cb6fdca5c3e3b494737ece.tar.gz merchant-90421ed05ded9e4460cb6fdca5c3e3b494737ece.tar.bz2 merchant-90421ed05ded9e4460cb6fdca5c3e3b494737ece.zip |
Factor out delete_instance_private_key (shit job)
Diffstat (limited to 'src/backenddb/plugin_merchantdb_postgres.c')
-rw-r--r-- | src/backenddb/plugin_merchantdb_postgres.c | 36 |
1 files changed, 3 insertions, 33 deletions
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" @@ -325,31 +326,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; |