From a98825675b37988c059576b5bfd98bac173bdc25 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Thu, 14 Feb 2019 14:23:16 +0100 Subject: add option to be selective about dropping the exchange list --- src/auditordb/plugin_auditordb_postgres.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src/auditordb') diff --git a/src/auditordb/plugin_auditordb_postgres.c b/src/auditordb/plugin_auditordb_postgres.c index bd216a117..1ca5df3ae 100644 --- a/src/auditordb/plugin_auditordb_postgres.c +++ b/src/auditordb/plugin_auditordb_postgres.c @@ -131,10 +131,12 @@ connect_to_postgres (struct PostgresClosure *pc) * Drop all Taler tables. This should only be used by testcases. * * @param cls the `struct PostgresClosure` with the plugin-specific state + * @param drop_exchangelist should we also drop the exchange table? * @return #GNUNET_OK upon success; #GNUNET_SYSERR upon failure */ static int -postgres_drop_tables (void *cls) +postgres_drop_tables (void *cls, + int drop_exchangelist) { struct PostgresClosure *pc = cls; struct GNUNET_PQ_ExecuteStatement es[] = { @@ -152,10 +154,13 @@ postgres_drop_tables (void *cls) GNUNET_PQ_make_execute ("DROP TABLE IF EXISTS auditor_progress_deposit_confirmation;"), GNUNET_PQ_make_execute ("DROP TABLE IF EXISTS auditor_progress_coin;"), GNUNET_PQ_make_execute ("DROP TABLE IF EXISTS wire_auditor_progress;"), - GNUNET_PQ_make_execute ("DROP TABLE IF EXISTS auditor_exchanges CASCADE;"), GNUNET_PQ_make_execute ("DROP TABLE IF EXISTS deposit_confirmations CASCADE;"), GNUNET_PQ_EXECUTE_STATEMENT_END }; + struct GNUNET_PQ_ExecuteStatement esx[] = { + GNUNET_PQ_make_execute ("DROP TABLE IF EXISTS auditor_exchanges CASCADE;"), + GNUNET_PQ_EXECUTE_STATEMENT_END + }; PGconn *conn; int ret; @@ -166,6 +171,10 @@ postgres_drop_tables (void *cls) "Dropping ALL tables\n"); ret = GNUNET_PQ_exec_statements (conn, es); + if ( (ret >= 0) && + (drop_exchangelist) ) + ret = GNUNET_PQ_exec_statements (conn, + esx); /* TODO: we probably need a bit more fine-grained control over drops for the '-r' option of taler-auditor; also, for the testcase, we currently fail to drop the -- cgit v1.2.3