diff options
author | Christian Grothoff <christian@grothoff.org> | 2019-02-14 14:23:16 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2019-02-14 14:23:16 +0100 |
commit | a98825675b37988c059576b5bfd98bac173bdc25 (patch) | |
tree | 8e7e392fdfc688af5a1066c728f6ef7807e1846a /src/auditordb | |
parent | e56ed85f4f11f3daec80326f7d43635281b3806b (diff) | |
download | exchange-a98825675b37988c059576b5bfd98bac173bdc25.tar.gz exchange-a98825675b37988c059576b5bfd98bac173bdc25.tar.bz2 exchange-a98825675b37988c059576b5bfd98bac173bdc25.zip |
add option to be selective about dropping the exchange list
Diffstat (limited to 'src/auditordb')
-rw-r--r-- | src/auditordb/plugin_auditordb_postgres.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/auditordb/plugin_auditordb_postgres.c b/src/auditordb/plugin_auditordb_postgres.c index bd216a11..1ca5df3a 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 |