summaryrefslogtreecommitdiff
path: root/src/auditordb
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2017-03-14 18:00:17 +0100
committerChristian Grothoff <christian@grothoff.org>2017-03-14 18:00:17 +0100
commit296f919ce4dcd9123c402d52d18afae7e353b11a (patch)
tree13b0151a4f29186e95bff617d6d19ddb17a67d6b /src/auditordb
parent6d798cecba4902623ca2769b30f6b1a0f554d83e (diff)
downloadexchange-296f919ce4dcd9123c402d52d18afae7e353b11a.tar.gz
exchange-296f919ce4dcd9123c402d52d18afae7e353b11a.tar.bz2
exchange-296f919ce4dcd9123c402d52d18afae7e353b11a.zip
more work on auditor, listing open TODOs
Diffstat (limited to 'src/auditordb')
-rw-r--r--src/auditordb/plugin_auditordb_postgres.c49
1 files changed, 49 insertions, 0 deletions
diff --git a/src/auditordb/plugin_auditordb_postgres.c b/src/auditordb/plugin_auditordb_postgres.c
index 81c1b4369..65da0bf18 100644
--- a/src/auditordb/plugin_auditordb_postgres.c
+++ b/src/auditordb/plugin_auditordb_postgres.c
@@ -649,6 +649,13 @@ postgres_prepare (PGconn *db_conn)
" WHERE reserve_pub=$1 AND master_pub=$2;",
2, NULL);
+ /* Used in #postgres_del_reserve_info() */
+ PREPARE ("auditor_reserves_delete",
+ "DELETE"
+ " FROM auditor_reserves"
+ " WHERE reserve_pub=$1 AND master_pub=$2;",
+ 2, NULL);
+
/* Used in #postgres_insert_reserve_summary() */
PREPARE ("auditor_reserve_balance_insert",
"INSERT INTO auditor_reserve_balance"
@@ -1651,6 +1658,47 @@ postgres_update_reserve_info (void *cls,
/**
+ * Delete information about a reserve.
+ *
+ * @param cls the @e cls of this struct with the plugin-specific state
+ * @param session connection to use
+ * @param reserve_pub public key of the reserve
+ * @param master_pub master public key of the exchange
+ * @return #GNUNET_OK on success; #GNUNET_NO if there is no known
+ * record about this reserve; #GNUNET_SYSERR on failure
+ */
+static int
+postgres_del_reserve_info (void *cls,
+ struct TALER_AUDITORDB_Session *session,
+ const struct TALER_ReservePublicKeyP *reserve_pub,
+ const struct TALER_MasterPublicKeyP *master_pub)
+{
+ struct GNUNET_PQ_QueryParam params[] = {
+ GNUNET_PQ_query_param_auto_from_type (reserve_pub),
+ GNUNET_PQ_query_param_auto_from_type (master_pub),
+ GNUNET_PQ_query_param_end
+ };
+ PGresult *result;
+ int ret;
+
+ result = GNUNET_PQ_exec_prepared (session->conn,
+ "auditor_reserves_delete",
+ params);
+ ret = PQresultStatus (result);
+ if (PGRES_COMMAND_OK != ret)
+ {
+ BREAK_DB_ERR (result);
+ PQclear (result);
+ return GNUNET_SYSERR;
+ }
+ if (0 == strcmp ("0",
+ PQcmdTuples (result)))
+ return GNUNET_NO;
+ return GNUNET_OK;
+}
+
+
+/**
* Get information about a reserve.
*
* @param cls the @e cls of this struct with the plugin-specific state
@@ -3110,6 +3158,7 @@ libtaler_plugin_auditordb_postgres_init (void *cls)
plugin->update_auditor_progress = &postgres_update_auditor_progress;
plugin->insert_auditor_progress = &postgres_insert_auditor_progress;
+ plugin->del_reserve_info = &postgres_del_reserve_info;
plugin->get_reserve_info = &postgres_get_reserve_info;
plugin->update_reserve_info = &postgres_update_reserve_info;
plugin->insert_reserve_info = &postgres_insert_reserve_info;