diff options
author | Christian Grothoff <grothoff@gnunet.org> | 2022-07-24 11:32:52 +0200 |
---|---|---|
committer | Christian Grothoff <grothoff@gnunet.org> | 2022-07-24 11:32:52 +0200 |
commit | 977ddd7bb97f9cec780407f27ccb2dbf8d1cf722 (patch) | |
tree | f2a192aedb47996805842c2dfed79e9fc3170e72 /src/exchangedb/plugin_exchangedb_postgres.c | |
parent | 9eaee4c80353b4e1317c0df2418f24209c2b238d (diff) | |
download | exchange-977ddd7bb97f9cec780407f27ccb2dbf8d1cf722.tar.xz |
-adapt to latest libgnunetpq
Diffstat (limited to 'src/exchangedb/plugin_exchangedb_postgres.c')
-rw-r--r-- | src/exchangedb/plugin_exchangedb_postgres.c | 44 |
1 files changed, 21 insertions, 23 deletions
diff --git a/src/exchangedb/plugin_exchangedb_postgres.c b/src/exchangedb/plugin_exchangedb_postgres.c index 277e3bc4f..abcd221bd 100644 --- a/src/exchangedb/plugin_exchangedb_postgres.c +++ b/src/exchangedb/plugin_exchangedb_postgres.c @@ -155,22 +155,25 @@ postgres_drop_tables (void *cls) { struct PostgresClosure *pg = cls; struct GNUNET_PQ_Context *conn; + enum GNUNET_GenericReturnValue ret; + if (NULL != pg->conn) + { + GNUNET_PQ_disconnect (pg->conn); + pg->conn = NULL; + pg->init = false; + } conn = GNUNET_PQ_connect_with_cfg (pg->cfg, "exchangedb-postgres", - "drop", + NULL, NULL, NULL); if (NULL == conn) return GNUNET_SYSERR; + ret = GNUNET_PQ_exec_sql (conn, + "drop"); GNUNET_PQ_disconnect (conn); - if (NULL != pg->conn) - { - GNUNET_PQ_disconnect (pg->conn); - pg->conn = NULL; - pg->init = false; - } - return GNUNET_OK; + return ret; } @@ -200,6 +203,13 @@ postgres_drop_shard_tables (void *cls, 1), GNUNET_PQ_PREPARED_STATEMENT_END }; + + if (NULL != pg->conn) + { + GNUNET_PQ_disconnect (pg->conn); + pg->conn = NULL; + pg->init = false; + } conn = GNUNET_PQ_connect_with_cfg (pg->cfg, "exchangedb-postgres", NULL, @@ -211,22 +221,10 @@ postgres_drop_shard_tables (void *cls, "drop_shard_tables", params)) ret = GNUNET_SYSERR; + if (GNUNET_OK == ret) + ret = GNUNET_PQ_exec_sql (conn, + "shard-drop"); GNUNET_PQ_disconnect (conn); - - conn = GNUNET_PQ_connect_with_cfg (pg->cfg, - "exchangedb-postgres", - "shard-drop", - NULL, - NULL); - if (NULL == conn) - return GNUNET_SYSERR; - GNUNET_PQ_disconnect (conn); - if (NULL != pg->conn) - { - GNUNET_PQ_disconnect (pg->conn); - pg->conn = NULL; - pg->init = false; - } return ret; } |