summaryrefslogtreecommitdiff
path: root/src/auditordb/plugin_auditordb_postgres.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2019-02-14 14:23:16 +0100
committerChristian Grothoff <christian@grothoff.org>2019-02-14 14:23:16 +0100
commita98825675b37988c059576b5bfd98bac173bdc25 (patch)
tree8e7e392fdfc688af5a1066c728f6ef7807e1846a /src/auditordb/plugin_auditordb_postgres.c
parente56ed85f4f11f3daec80326f7d43635281b3806b (diff)
downloadexchange-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/plugin_auditordb_postgres.c')
-rw-r--r--src/auditordb/plugin_auditordb_postgres.c13
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