From c015ffc7fc80c4a9f348d9eaea41e67e4e97a814 Mon Sep 17 00:00:00 2001 From: Marcello Stanisci Date: Mon, 17 Oct 2016 17:24:38 +0200 Subject: closing #4709 --- src/exchangedb/plugin_exchangedb_postgres.c | 68 +++++++++++++++++++++++++++-- 1 file changed, 65 insertions(+), 3 deletions(-) (limited to 'src/exchangedb/plugin_exchangedb_postgres.c') diff --git a/src/exchangedb/plugin_exchangedb_postgres.c b/src/exchangedb/plugin_exchangedb_postgres.c index c85a439f..1eaafe3a 100644 --- a/src/exchangedb/plugin_exchangedb_postgres.c +++ b/src/exchangedb/plugin_exchangedb_postgres.c @@ -1279,8 +1279,9 @@ postgres_prepare (PGconn *db_conn) /* Used in #postgres_select_prepare_above_serial_id() */ PREPARE ("audit_get_wire_incr", "SELECT" - ",type" + " type" ",buf" + ",finished" " FROM prewire" " WHERE prewire_uuid>=$1" " ORDER BY prewire_uuid ASC", @@ -4826,8 +4827,69 @@ postgres_select_prepare_above_serial_id (void *cls, TALER_EXCHANGEDB_WirePreparationCallback cb, void *cb_cls) { - GNUNET_break (0); // FIXME: not implemented - return GNUNET_SYSERR; + + struct GNUNET_PQ_QueryParam params[] = { + GNUNET_PQ_query_param_uint64 (&serial_id), + GNUNET_PQ_query_param_end + }; + PGresult *result; + result = GNUNET_PQ_exec_prepared (session->conn, + "audit_get_wire_incr", + params); + if (PGRES_COMMAND_OK != + PQresultStatus (result)) + { + BREAK_DB_ERR (result); + PQclear (result); + return GNUNET_SYSERR; + } + int nrows; + int i; + + nrows = PQntuples (result); + if (0 == nrows) + { + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "select_prepare_above_serial_id() returned 0 matching rows\n"); + PQclear (result); + return GNUNET_NO; + } + for (i=0;i