-more db logic refactoring
This commit is contained in:
parent
c1c02b8a3c
commit
d0debc467e
@ -92,9 +92,14 @@ static struct Table tables[] = {
|
|||||||
{ .rt = TALER_EXCHANGEDB_RT_DENOMINATIONS},
|
{ .rt = TALER_EXCHANGEDB_RT_DENOMINATIONS},
|
||||||
{ .rt = TALER_EXCHANGEDB_RT_DENOMINATION_REVOCATIONS},
|
{ .rt = TALER_EXCHANGEDB_RT_DENOMINATION_REVOCATIONS},
|
||||||
{ .rt = TALER_EXCHANGEDB_RT_WIRE_TARGETS},
|
{ .rt = TALER_EXCHANGEDB_RT_WIRE_TARGETS},
|
||||||
|
{ .rt = TALER_EXCHANGEDB_RT_LEGITIMIZATION_PROCESSES},
|
||||||
|
{ .rt = TALER_EXCHANGEDB_RT_LEGITIMIZATION_REQUIREMENTS},
|
||||||
{ .rt = TALER_EXCHANGEDB_RT_RESERVES},
|
{ .rt = TALER_EXCHANGEDB_RT_RESERVES},
|
||||||
{ .rt = TALER_EXCHANGEDB_RT_RESERVES_IN},
|
{ .rt = TALER_EXCHANGEDB_RT_RESERVES_IN},
|
||||||
{ .rt = TALER_EXCHANGEDB_RT_RESERVES_CLOSE},
|
{ .rt = TALER_EXCHANGEDB_RT_RESERVES_CLOSE},
|
||||||
|
{ .rt = TALER_EXCHANGEDB_RT_RESERVES_OPEN_REQUESTS},
|
||||||
|
{ .rt = TALER_EXCHANGEDB_RT_RESERVES_OPEN_DEPOSITS},
|
||||||
|
{ .rt = TALER_EXCHANGEDB_RT_RESERVES_CLOSE_REQUESTS},
|
||||||
{ .rt = TALER_EXCHANGEDB_RT_RESERVES_OUT},
|
{ .rt = TALER_EXCHANGEDB_RT_RESERVES_OUT},
|
||||||
{ .rt = TALER_EXCHANGEDB_RT_AUDITORS},
|
{ .rt = TALER_EXCHANGEDB_RT_AUDITORS},
|
||||||
{ .rt = TALER_EXCHANGEDB_RT_AUDITOR_DENOM_SIGS},
|
{ .rt = TALER_EXCHANGEDB_RT_AUDITOR_DENOM_SIGS},
|
||||||
@ -155,7 +160,7 @@ struct InsertContext
|
|||||||
* @return #GNUNET_OK to continue to iterate,
|
* @return #GNUNET_OK to continue to iterate,
|
||||||
* #GNUNET_SYSERR to fail with an error
|
* #GNUNET_SYSERR to fail with an error
|
||||||
*/
|
*/
|
||||||
static int
|
static enum GNUNET_GenericReturnValue
|
||||||
do_insert (void *cls,
|
do_insert (void *cls,
|
||||||
const struct TALER_EXCHANGEDB_TableData *td)
|
const struct TALER_EXCHANGEDB_TableData *td)
|
||||||
{
|
{
|
||||||
|
@ -76,6 +76,7 @@ libtaler_plugin_exchangedb_postgres_la_SOURCES = \
|
|||||||
pg_iterate_kyc_reference.c pg_iterate_kyc_reference.h \
|
pg_iterate_kyc_reference.c pg_iterate_kyc_reference.h \
|
||||||
pg_iterate_reserve_close_info.c pg_iterate_reserve_close_info.h \
|
pg_iterate_reserve_close_info.c pg_iterate_reserve_close_info.h \
|
||||||
pg_lookup_records_by_table.c pg_lookup_records_by_table.h \
|
pg_lookup_records_by_table.c pg_lookup_records_by_table.h \
|
||||||
|
pg_lookup_serial_by_table.c pg_lookup_serial_by_table.h \
|
||||||
pg_select_reserve_close_info.c pg_select_reserve_close_info.h
|
pg_select_reserve_close_info.c pg_select_reserve_close_info.h
|
||||||
libtaler_plugin_exchangedb_postgres_la_LIBADD = \
|
libtaler_plugin_exchangedb_postgres_la_LIBADD = \
|
||||||
$(LTLIBINTL)
|
$(LTLIBINTL)
|
||||||
|
366
src/exchangedb/pg_lookup_serial_by_table.c
Normal file
366
src/exchangedb/pg_lookup_serial_by_table.c
Normal file
@ -0,0 +1,366 @@
|
|||||||
|
/*
|
||||||
|
This file is part of TALER
|
||||||
|
Copyright (C) 2022 Taler Systems SA
|
||||||
|
|
||||||
|
TALER is free software; you can redistribute it and/or modify it under the
|
||||||
|
terms of the GNU General Public License as published by the Free Software
|
||||||
|
Foundation; either version 3, or (at your option) any later version.
|
||||||
|
|
||||||
|
TALER is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||||
|
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License along with
|
||||||
|
TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* @file pg_lookup_serial_by_table.c
|
||||||
|
* @brief Low-level (statement-level) Postgres database access for the exchange
|
||||||
|
* @author Christian Grothoff
|
||||||
|
*/
|
||||||
|
#include "platform.h"
|
||||||
|
#include "taler_error_codes.h"
|
||||||
|
#include "taler_dbevents.h"
|
||||||
|
#include "taler_pq_lib.h"
|
||||||
|
#include "pg_lookup_serial_by_table.h"
|
||||||
|
#include "pg_helper.h"
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Assign statement to @a n and PREPARE
|
||||||
|
* @a sql under name @a n.
|
||||||
|
*/
|
||||||
|
#define XPREPARE(n,sql) \
|
||||||
|
statement = n; \
|
||||||
|
PREPARE (pg, n, sql);
|
||||||
|
|
||||||
|
|
||||||
|
enum GNUNET_DB_QueryStatus
|
||||||
|
TEH_PG_lookup_serial_by_table (void *cls,
|
||||||
|
enum TALER_EXCHANGEDB_ReplicatedTable table,
|
||||||
|
uint64_t *serial)
|
||||||
|
{
|
||||||
|
struct PostgresClosure *pg = cls;
|
||||||
|
struct GNUNET_PQ_QueryParam params[] = {
|
||||||
|
GNUNET_PQ_query_param_end
|
||||||
|
};
|
||||||
|
struct GNUNET_PQ_ResultSpec rs[] = {
|
||||||
|
GNUNET_PQ_result_spec_uint64 ("serial",
|
||||||
|
serial),
|
||||||
|
GNUNET_PQ_result_spec_end
|
||||||
|
};
|
||||||
|
const char *statement = NULL;
|
||||||
|
|
||||||
|
switch (table)
|
||||||
|
{
|
||||||
|
case TALER_EXCHANGEDB_RT_DENOMINATIONS:
|
||||||
|
XPREPARE ("select_serial_by_table_denominations",
|
||||||
|
"SELECT"
|
||||||
|
" denominations_serial AS serial"
|
||||||
|
" FROM denominations"
|
||||||
|
" ORDER BY denominations_serial DESC"
|
||||||
|
" LIMIT 1;");
|
||||||
|
break;
|
||||||
|
case TALER_EXCHANGEDB_RT_DENOMINATION_REVOCATIONS:
|
||||||
|
XPREPARE ("select_serial_by_table_denomination_revocations",
|
||||||
|
"SELECT"
|
||||||
|
" denom_revocations_serial_id AS serial"
|
||||||
|
" FROM denomination_revocations"
|
||||||
|
" ORDER BY denom_revocations_serial_id DESC"
|
||||||
|
" LIMIT 1;");
|
||||||
|
break;
|
||||||
|
case TALER_EXCHANGEDB_RT_WIRE_TARGETS:
|
||||||
|
XPREPARE ("select_serial_by_table_wire_targets",
|
||||||
|
"SELECT"
|
||||||
|
" wire_target_serial_id AS serial"
|
||||||
|
" FROM wire_targets"
|
||||||
|
" ORDER BY wire_target_serial_id DESC"
|
||||||
|
" LIMIT 1;");
|
||||||
|
break;
|
||||||
|
case TALER_EXCHANGEDB_RT_RESERVES:
|
||||||
|
XPREPARE ("select_serial_by_table_reserves",
|
||||||
|
"SELECT"
|
||||||
|
" reserve_uuid AS serial"
|
||||||
|
" FROM reserves"
|
||||||
|
" ORDER BY reserve_uuid DESC"
|
||||||
|
" LIMIT 1;");
|
||||||
|
break;
|
||||||
|
case TALER_EXCHANGEDB_RT_RESERVES_IN:
|
||||||
|
XPREPARE ("select_serial_by_table_reserves_in",
|
||||||
|
"SELECT"
|
||||||
|
" reserve_in_serial_id AS serial"
|
||||||
|
" FROM reserves_in"
|
||||||
|
" ORDER BY reserve_in_serial_id DESC"
|
||||||
|
" LIMIT 1;");
|
||||||
|
break;
|
||||||
|
case TALER_EXCHANGEDB_RT_RESERVES_CLOSE:
|
||||||
|
XPREPARE ("select_serial_by_table_reserves_close",
|
||||||
|
"SELECT"
|
||||||
|
" close_uuid AS serial"
|
||||||
|
" FROM reserves_close"
|
||||||
|
" ORDER BY close_uuid DESC"
|
||||||
|
" LIMIT 1;");
|
||||||
|
break;
|
||||||
|
case TALER_EXCHANGEDB_RT_RESERVES_OUT:
|
||||||
|
XPREPARE ("select_serial_by_table_reserves_out",
|
||||||
|
"SELECT"
|
||||||
|
" reserve_out_serial_id AS serial"
|
||||||
|
" FROM reserves_out"
|
||||||
|
" ORDER BY reserve_out_serial_id DESC"
|
||||||
|
" LIMIT 1;");
|
||||||
|
break;
|
||||||
|
case TALER_EXCHANGEDB_RT_AUDITORS:
|
||||||
|
XPREPARE ("select_serial_by_table_auditors",
|
||||||
|
"SELECT"
|
||||||
|
" auditor_uuid AS serial"
|
||||||
|
" FROM auditors"
|
||||||
|
" ORDER BY auditor_uuid DESC"
|
||||||
|
" LIMIT 1;");
|
||||||
|
break;
|
||||||
|
case TALER_EXCHANGEDB_RT_AUDITOR_DENOM_SIGS:
|
||||||
|
XPREPARE ("select_serial_by_table_auditor_denom_sigs",
|
||||||
|
"SELECT"
|
||||||
|
" auditor_denom_serial AS serial"
|
||||||
|
" FROM auditor_denom_sigs"
|
||||||
|
" ORDER BY auditor_denom_serial DESC"
|
||||||
|
" LIMIT 1;");
|
||||||
|
break;
|
||||||
|
case TALER_EXCHANGEDB_RT_EXCHANGE_SIGN_KEYS:
|
||||||
|
XPREPARE ("select_serial_by_table_exchange_sign_keys",
|
||||||
|
"SELECT"
|
||||||
|
" esk_serial AS serial"
|
||||||
|
" FROM exchange_sign_keys"
|
||||||
|
" ORDER BY esk_serial DESC"
|
||||||
|
" LIMIT 1;");
|
||||||
|
break;
|
||||||
|
case TALER_EXCHANGEDB_RT_SIGNKEY_REVOCATIONS:
|
||||||
|
XPREPARE ("select_serial_by_table_signkey_revocations",
|
||||||
|
"SELECT"
|
||||||
|
" signkey_revocations_serial_id AS serial"
|
||||||
|
" FROM signkey_revocations"
|
||||||
|
" ORDER BY signkey_revocations_serial_id DESC"
|
||||||
|
" LIMIT 1;");
|
||||||
|
break;
|
||||||
|
case TALER_EXCHANGEDB_RT_KNOWN_COINS:
|
||||||
|
XPREPARE ("select_serial_by_table_known_coins",
|
||||||
|
"SELECT"
|
||||||
|
" known_coin_id AS serial"
|
||||||
|
" FROM known_coins"
|
||||||
|
" ORDER BY known_coin_id DESC"
|
||||||
|
" LIMIT 1;");
|
||||||
|
break;
|
||||||
|
case TALER_EXCHANGEDB_RT_REFRESH_COMMITMENTS:
|
||||||
|
XPREPARE ("select_serial_by_table_refresh_commitments",
|
||||||
|
"SELECT"
|
||||||
|
" melt_serial_id AS serial"
|
||||||
|
" FROM refresh_commitments"
|
||||||
|
" ORDER BY melt_serial_id DESC"
|
||||||
|
" LIMIT 1;");
|
||||||
|
break;
|
||||||
|
case TALER_EXCHANGEDB_RT_REFRESH_REVEALED_COINS:
|
||||||
|
XPREPARE ("select_serial_by_table_refresh_revealed_coins",
|
||||||
|
"SELECT"
|
||||||
|
" rrc_serial AS serial"
|
||||||
|
" FROM refresh_revealed_coins"
|
||||||
|
" ORDER BY rrc_serial DESC"
|
||||||
|
" LIMIT 1;");
|
||||||
|
break;
|
||||||
|
case TALER_EXCHANGEDB_RT_REFRESH_TRANSFER_KEYS:
|
||||||
|
XPREPARE ("select_serial_by_table_refresh_transfer_keys",
|
||||||
|
"SELECT"
|
||||||
|
" rtc_serial AS serial"
|
||||||
|
" FROM refresh_transfer_keys"
|
||||||
|
" ORDER BY rtc_serial DESC"
|
||||||
|
" LIMIT 1;");
|
||||||
|
break;
|
||||||
|
case TALER_EXCHANGEDB_RT_DEPOSITS:
|
||||||
|
XPREPARE ("select_serial_by_table_deposits",
|
||||||
|
"SELECT"
|
||||||
|
" deposit_serial_id AS serial"
|
||||||
|
" FROM deposits"
|
||||||
|
" ORDER BY deposit_serial_id DESC"
|
||||||
|
" LIMIT 1;");
|
||||||
|
break;
|
||||||
|
case TALER_EXCHANGEDB_RT_REFUNDS:
|
||||||
|
XPREPARE ("select_serial_by_table_refunds",
|
||||||
|
"SELECT"
|
||||||
|
" refund_serial_id AS serial"
|
||||||
|
" FROM refunds"
|
||||||
|
" ORDER BY refund_serial_id DESC"
|
||||||
|
" LIMIT 1;");
|
||||||
|
break;
|
||||||
|
case TALER_EXCHANGEDB_RT_WIRE_OUT:
|
||||||
|
XPREPARE ("select_serial_by_table_wire_out",
|
||||||
|
"SELECT"
|
||||||
|
" wireout_uuid AS serial"
|
||||||
|
" FROM wire_out"
|
||||||
|
" ORDER BY wireout_uuid DESC"
|
||||||
|
" LIMIT 1;");
|
||||||
|
break;
|
||||||
|
case TALER_EXCHANGEDB_RT_AGGREGATION_TRACKING:
|
||||||
|
XPREPARE ("select_serial_by_table_aggregation_tracking",
|
||||||
|
"SELECT"
|
||||||
|
" aggregation_serial_id AS serial"
|
||||||
|
" FROM aggregation_tracking"
|
||||||
|
" ORDER BY aggregation_serial_id DESC"
|
||||||
|
" LIMIT 1;");
|
||||||
|
break;
|
||||||
|
case TALER_EXCHANGEDB_RT_WIRE_FEE:
|
||||||
|
XPREPARE ("select_serial_by_table_wire_fee",
|
||||||
|
"SELECT"
|
||||||
|
" wire_fee_serial AS serial"
|
||||||
|
" FROM wire_fee"
|
||||||
|
" ORDER BY wire_fee_serial DESC"
|
||||||
|
" LIMIT 1;");
|
||||||
|
break;
|
||||||
|
case TALER_EXCHANGEDB_RT_GLOBAL_FEE:
|
||||||
|
XPREPARE ("select_serial_by_table_global_fee",
|
||||||
|
"SELECT"
|
||||||
|
" global_fee_serial AS serial"
|
||||||
|
" FROM global_fee"
|
||||||
|
" ORDER BY global_fee_serial DESC"
|
||||||
|
" LIMIT 1;");
|
||||||
|
break;
|
||||||
|
case TALER_EXCHANGEDB_RT_RECOUP:
|
||||||
|
XPREPARE ("select_serial_by_table_recoup",
|
||||||
|
"SELECT"
|
||||||
|
" recoup_uuid AS serial"
|
||||||
|
" FROM recoup"
|
||||||
|
" ORDER BY recoup_uuid DESC"
|
||||||
|
" LIMIT 1;");
|
||||||
|
break;
|
||||||
|
case TALER_EXCHANGEDB_RT_RECOUP_REFRESH:
|
||||||
|
XPREPARE ("select_serial_by_table_recoup_refresh",
|
||||||
|
"SELECT"
|
||||||
|
" recoup_refresh_uuid AS serial"
|
||||||
|
" FROM recoup_refresh"
|
||||||
|
" ORDER BY recoup_refresh_uuid DESC"
|
||||||
|
" LIMIT 1;");
|
||||||
|
break;
|
||||||
|
case TALER_EXCHANGEDB_RT_EXTENSIONS:
|
||||||
|
XPREPARE ("select_serial_by_table_extensions",
|
||||||
|
"SELECT"
|
||||||
|
" extension_id AS serial"
|
||||||
|
" FROM extensions"
|
||||||
|
" ORDER BY extension_id DESC"
|
||||||
|
" LIMIT 1;");
|
||||||
|
break;
|
||||||
|
case TALER_EXCHANGEDB_RT_EXTENSION_DETAILS:
|
||||||
|
XPREPARE ("select_serial_by_table_extension_details",
|
||||||
|
"SELECT"
|
||||||
|
" extension_details_serial_id AS serial"
|
||||||
|
" FROM extension_details"
|
||||||
|
" ORDER BY extension_details_serial_id DESC"
|
||||||
|
" LIMIT 1;");
|
||||||
|
break;
|
||||||
|
case TALER_EXCHANGEDB_RT_PURSE_REQUESTS:
|
||||||
|
XPREPARE ("select_serial_by_table_purse_requests",
|
||||||
|
"SELECT"
|
||||||
|
" purse_requests_serial_id AS serial"
|
||||||
|
" FROM purse_requests"
|
||||||
|
" ORDER BY purse_requests_serial_id DESC"
|
||||||
|
" LIMIT 1;")
|
||||||
|
break;
|
||||||
|
case TALER_EXCHANGEDB_RT_PURSE_REFUNDS:
|
||||||
|
XPREPARE ("select_serial_by_table_purse_refunds",
|
||||||
|
"SELECT"
|
||||||
|
" purse_refunds_serial_id AS serial"
|
||||||
|
" FROM purse_refunds"
|
||||||
|
" ORDER BY purse_refunds_serial_id DESC"
|
||||||
|
" LIMIT 1;");
|
||||||
|
break;
|
||||||
|
case TALER_EXCHANGEDB_RT_PURSE_MERGES:
|
||||||
|
XPREPARE ("select_serial_by_table_purse_merges",
|
||||||
|
"SELECT"
|
||||||
|
" purse_merge_request_serial_id AS serial"
|
||||||
|
" FROM purse_merges"
|
||||||
|
" ORDER BY purse_merge_request_serial_id DESC"
|
||||||
|
" LIMIT 1;");
|
||||||
|
break;
|
||||||
|
case TALER_EXCHANGEDB_RT_PURSE_DEPOSITS:
|
||||||
|
XPREPARE ("select_serial_by_table_purse_deposits",
|
||||||
|
"SELECT"
|
||||||
|
" purse_deposit_serial_id AS serial"
|
||||||
|
" FROM purse_deposits"
|
||||||
|
" ORDER BY purse_deposit_serial_id DESC"
|
||||||
|
" LIMIT 1;");
|
||||||
|
break;
|
||||||
|
case TALER_EXCHANGEDB_RT_ACCOUNT_MERGES:
|
||||||
|
XPREPARE ("select_serial_by_table_account_merges",
|
||||||
|
"SELECT"
|
||||||
|
" account_merge_request_serial_id AS serial"
|
||||||
|
" FROM account_merges"
|
||||||
|
" ORDER BY account_merge_request_serial_id DESC"
|
||||||
|
" LIMIT 1;");
|
||||||
|
break;
|
||||||
|
case TALER_EXCHANGEDB_RT_HISTORY_REQUESTS:
|
||||||
|
XPREPARE ("select_serial_by_table_history_requests",
|
||||||
|
"SELECT"
|
||||||
|
" history_request_serial_id AS serial"
|
||||||
|
" FROM history_requests"
|
||||||
|
" ORDER BY history_request_serial_id DESC"
|
||||||
|
" LIMIT 1;");
|
||||||
|
break;
|
||||||
|
case TALER_EXCHANGEDB_RT_CLOSE_REQUESTS:
|
||||||
|
XPREPARE ("select_serial_by_table_close_requests",
|
||||||
|
"SELECT"
|
||||||
|
" close_request_serial_id AS serial"
|
||||||
|
" FROM close_requests"
|
||||||
|
" ORDER BY close_request_serial_id DESC"
|
||||||
|
" LIMIT 1;");
|
||||||
|
break;
|
||||||
|
case TALER_EXCHANGEDB_RT_WADS_OUT:
|
||||||
|
XPREPARE ("select_serial_by_table_wads_out",
|
||||||
|
"SELECT"
|
||||||
|
" wad_out_serial_id AS serial"
|
||||||
|
" FROM wads_out"
|
||||||
|
" ORDER BY wad_out_serial_id DESC"
|
||||||
|
" LIMIT 1;");
|
||||||
|
break;
|
||||||
|
case TALER_EXCHANGEDB_RT_WADS_OUT_ENTRIES:
|
||||||
|
XPREPARE ("select_serial_by_table_wads_out_entries",
|
||||||
|
"SELECT"
|
||||||
|
" wad_out_entry_serial_id AS serial"
|
||||||
|
" FROM wad_out_entries"
|
||||||
|
" ORDER BY wad_out_entry_serial_id DESC"
|
||||||
|
" LIMIT 1;");
|
||||||
|
break;
|
||||||
|
case TALER_EXCHANGEDB_RT_WADS_IN:
|
||||||
|
XPREPARE ("select_serial_by_table_wads_in",
|
||||||
|
"SELECT"
|
||||||
|
" wad_in_serial_id AS serial"
|
||||||
|
" FROM wads_in"
|
||||||
|
" ORDER BY wad_in_serial_id DESC"
|
||||||
|
" LIMIT 1;");
|
||||||
|
break;
|
||||||
|
case TALER_EXCHANGEDB_RT_WADS_IN_ENTRIES:
|
||||||
|
XPREPARE ("select_serial_by_table_wads_in_entries",
|
||||||
|
"SELECT"
|
||||||
|
" wad_in_entry_serial_id AS serial"
|
||||||
|
" FROM wad_in_entries"
|
||||||
|
" ORDER BY wad_in_entry_serial_id DESC"
|
||||||
|
" LIMIT 1;");
|
||||||
|
break;
|
||||||
|
case TALER_EXCHANGEDB_RT_PROFIT_DRAINS:
|
||||||
|
XPREPARE ("select_serial_by_table_profit_drains",
|
||||||
|
"SELECT"
|
||||||
|
" profit_drain_serial_id AS serial"
|
||||||
|
" FROM profit_drains"
|
||||||
|
" ORDER BY profit_drain_serial_id DESC"
|
||||||
|
" LIMIT 1;");
|
||||||
|
statement = "select_serial_by_table_profit_drains";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (NULL == statement)
|
||||||
|
{
|
||||||
|
GNUNET_break (0);
|
||||||
|
return GNUNET_DB_STATUS_HARD_ERROR;
|
||||||
|
}
|
||||||
|
return GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
|
||||||
|
statement,
|
||||||
|
params,
|
||||||
|
rs);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#undef XPREPARE
|
45
src/exchangedb/pg_lookup_serial_by_table.h
Normal file
45
src/exchangedb/pg_lookup_serial_by_table.h
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
/*
|
||||||
|
This file is part of TALER
|
||||||
|
Copyright (C) 2022 Taler Systems SA
|
||||||
|
|
||||||
|
TALER is free software; you can redistribute it and/or modify it under the
|
||||||
|
terms of the GNU General Public License as published by the Free Software
|
||||||
|
Foundation; either version 3, or (at your option) any later version.
|
||||||
|
|
||||||
|
TALER is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||||
|
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License along with
|
||||||
|
TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* @file pg_lookup_serial_by_table.h
|
||||||
|
* @brief implementation of the lookup_serial_by_table function
|
||||||
|
* @author Christian Grothoff
|
||||||
|
*/
|
||||||
|
#ifndef PG_LOOKUP_SERIAL_BY_TABLE_H
|
||||||
|
#define PG_LOOKUP_SERIAL_BY_TABLE_H
|
||||||
|
|
||||||
|
#include "taler_util.h"
|
||||||
|
#include "taler_json_lib.h"
|
||||||
|
#include "taler_exchangedb_plugin.h"
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lookup the latest serial number of @a table. Used in
|
||||||
|
* exchange-auditor database replication.
|
||||||
|
*
|
||||||
|
* @param cls closure
|
||||||
|
* @param table table for which we should return the serial
|
||||||
|
* @param[out] serial latest serial number in use
|
||||||
|
* @return transaction status code, GNUNET_DB_STATUS_HARD_ERROR if
|
||||||
|
* @a table does not have a serial number
|
||||||
|
*/
|
||||||
|
enum GNUNET_DB_QueryStatus
|
||||||
|
TEH_PG_lookup_serial_by_table (void *cls,
|
||||||
|
enum TALER_EXCHANGEDB_ReplicatedTable table,
|
||||||
|
uint64_t *serial);
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
@ -36,6 +36,7 @@
|
|||||||
#include "pg_iterate_kyc_reference.h"
|
#include "pg_iterate_kyc_reference.h"
|
||||||
#include "pg_iterate_reserve_close_info.h"
|
#include "pg_iterate_reserve_close_info.h"
|
||||||
#include "pg_lookup_records_by_table.h"
|
#include "pg_lookup_records_by_table.h"
|
||||||
|
#include "pg_lookup_serial_by_table.h"
|
||||||
#include "pg_select_reserve_close_info.h"
|
#include "pg_select_reserve_close_info.h"
|
||||||
#include <poll.h>
|
#include <poll.h>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
@ -2788,303 +2789,6 @@ prepare_statements (struct PostgresClosure *pg)
|
|||||||
"do_commit",
|
"do_commit",
|
||||||
"COMMIT",
|
"COMMIT",
|
||||||
0),
|
0),
|
||||||
/* used in #postgres_lookup_serial_by_table() */
|
|
||||||
GNUNET_PQ_make_prepare (
|
|
||||||
"select_serial_by_table_denominations",
|
|
||||||
"SELECT"
|
|
||||||
" denominations_serial AS serial"
|
|
||||||
" FROM denominations"
|
|
||||||
" ORDER BY denominations_serial DESC"
|
|
||||||
" LIMIT 1;",
|
|
||||||
0),
|
|
||||||
GNUNET_PQ_make_prepare (
|
|
||||||
"select_serial_by_table_denomination_revocations",
|
|
||||||
"SELECT"
|
|
||||||
" denom_revocations_serial_id AS serial"
|
|
||||||
" FROM denomination_revocations"
|
|
||||||
" ORDER BY denom_revocations_serial_id DESC"
|
|
||||||
" LIMIT 1;",
|
|
||||||
0),
|
|
||||||
GNUNET_PQ_make_prepare (
|
|
||||||
"select_serial_by_table_wire_targets",
|
|
||||||
"SELECT"
|
|
||||||
" wire_target_serial_id AS serial"
|
|
||||||
" FROM wire_targets"
|
|
||||||
" ORDER BY wire_target_serial_id DESC"
|
|
||||||
" LIMIT 1;",
|
|
||||||
0),
|
|
||||||
GNUNET_PQ_make_prepare (
|
|
||||||
"select_serial_by_table_reserves",
|
|
||||||
"SELECT"
|
|
||||||
" reserve_uuid AS serial"
|
|
||||||
" FROM reserves"
|
|
||||||
" ORDER BY reserve_uuid DESC"
|
|
||||||
" LIMIT 1;",
|
|
||||||
0),
|
|
||||||
GNUNET_PQ_make_prepare (
|
|
||||||
"select_serial_by_table_reserves_in",
|
|
||||||
"SELECT"
|
|
||||||
" reserve_in_serial_id AS serial"
|
|
||||||
" FROM reserves_in"
|
|
||||||
" ORDER BY reserve_in_serial_id DESC"
|
|
||||||
" LIMIT 1;",
|
|
||||||
0),
|
|
||||||
GNUNET_PQ_make_prepare (
|
|
||||||
"select_serial_by_table_reserves_close",
|
|
||||||
"SELECT"
|
|
||||||
" close_uuid AS serial"
|
|
||||||
" FROM reserves_close"
|
|
||||||
" ORDER BY close_uuid DESC"
|
|
||||||
" LIMIT 1;",
|
|
||||||
0),
|
|
||||||
GNUNET_PQ_make_prepare (
|
|
||||||
"select_serial_by_table_reserves_out",
|
|
||||||
"SELECT"
|
|
||||||
" reserve_out_serial_id AS serial"
|
|
||||||
" FROM reserves_out"
|
|
||||||
" ORDER BY reserve_out_serial_id DESC"
|
|
||||||
" LIMIT 1;",
|
|
||||||
0),
|
|
||||||
GNUNET_PQ_make_prepare (
|
|
||||||
"select_serial_by_table_auditors",
|
|
||||||
"SELECT"
|
|
||||||
" auditor_uuid AS serial"
|
|
||||||
" FROM auditors"
|
|
||||||
" ORDER BY auditor_uuid DESC"
|
|
||||||
" LIMIT 1;",
|
|
||||||
0),
|
|
||||||
GNUNET_PQ_make_prepare (
|
|
||||||
"select_serial_by_table_auditor_denom_sigs",
|
|
||||||
"SELECT"
|
|
||||||
" auditor_denom_serial AS serial"
|
|
||||||
" FROM auditor_denom_sigs"
|
|
||||||
" ORDER BY auditor_denom_serial DESC"
|
|
||||||
" LIMIT 1;",
|
|
||||||
0),
|
|
||||||
GNUNET_PQ_make_prepare (
|
|
||||||
"select_serial_by_table_exchange_sign_keys",
|
|
||||||
"SELECT"
|
|
||||||
" esk_serial AS serial"
|
|
||||||
" FROM exchange_sign_keys"
|
|
||||||
" ORDER BY esk_serial DESC"
|
|
||||||
" LIMIT 1;",
|
|
||||||
0),
|
|
||||||
GNUNET_PQ_make_prepare (
|
|
||||||
"select_serial_by_table_signkey_revocations",
|
|
||||||
"SELECT"
|
|
||||||
" signkey_revocations_serial_id AS serial"
|
|
||||||
" FROM signkey_revocations"
|
|
||||||
" ORDER BY signkey_revocations_serial_id DESC"
|
|
||||||
" LIMIT 1;",
|
|
||||||
0),
|
|
||||||
GNUNET_PQ_make_prepare (
|
|
||||||
"select_serial_by_table_known_coins",
|
|
||||||
"SELECT"
|
|
||||||
" known_coin_id AS serial"
|
|
||||||
" FROM known_coins"
|
|
||||||
" ORDER BY known_coin_id DESC"
|
|
||||||
" LIMIT 1;",
|
|
||||||
0),
|
|
||||||
GNUNET_PQ_make_prepare (
|
|
||||||
"select_serial_by_table_refresh_commitments",
|
|
||||||
"SELECT"
|
|
||||||
" melt_serial_id AS serial"
|
|
||||||
" FROM refresh_commitments"
|
|
||||||
" ORDER BY melt_serial_id DESC"
|
|
||||||
" LIMIT 1;",
|
|
||||||
0),
|
|
||||||
GNUNET_PQ_make_prepare (
|
|
||||||
"select_serial_by_table_refresh_revealed_coins",
|
|
||||||
"SELECT"
|
|
||||||
" rrc_serial AS serial"
|
|
||||||
" FROM refresh_revealed_coins"
|
|
||||||
" ORDER BY rrc_serial DESC"
|
|
||||||
" LIMIT 1;",
|
|
||||||
0),
|
|
||||||
GNUNET_PQ_make_prepare (
|
|
||||||
"select_serial_by_table_refresh_transfer_keys",
|
|
||||||
"SELECT"
|
|
||||||
" rtc_serial AS serial"
|
|
||||||
" FROM refresh_transfer_keys"
|
|
||||||
" ORDER BY rtc_serial DESC"
|
|
||||||
" LIMIT 1;",
|
|
||||||
0),
|
|
||||||
GNUNET_PQ_make_prepare (
|
|
||||||
"select_serial_by_table_deposits",
|
|
||||||
"SELECT"
|
|
||||||
" deposit_serial_id AS serial"
|
|
||||||
" FROM deposits"
|
|
||||||
" ORDER BY deposit_serial_id DESC"
|
|
||||||
" LIMIT 1;",
|
|
||||||
0),
|
|
||||||
GNUNET_PQ_make_prepare (
|
|
||||||
"select_serial_by_table_refunds",
|
|
||||||
"SELECT"
|
|
||||||
" refund_serial_id AS serial"
|
|
||||||
" FROM refunds"
|
|
||||||
" ORDER BY refund_serial_id DESC"
|
|
||||||
" LIMIT 1;",
|
|
||||||
0),
|
|
||||||
GNUNET_PQ_make_prepare (
|
|
||||||
"select_serial_by_table_wire_out",
|
|
||||||
"SELECT"
|
|
||||||
" wireout_uuid AS serial"
|
|
||||||
" FROM wire_out"
|
|
||||||
" ORDER BY wireout_uuid DESC"
|
|
||||||
" LIMIT 1;",
|
|
||||||
0),
|
|
||||||
GNUNET_PQ_make_prepare (
|
|
||||||
"select_serial_by_table_aggregation_tracking",
|
|
||||||
"SELECT"
|
|
||||||
" aggregation_serial_id AS serial"
|
|
||||||
" FROM aggregation_tracking"
|
|
||||||
" ORDER BY aggregation_serial_id DESC"
|
|
||||||
" LIMIT 1;",
|
|
||||||
0),
|
|
||||||
GNUNET_PQ_make_prepare (
|
|
||||||
"select_serial_by_table_wire_fee",
|
|
||||||
"SELECT"
|
|
||||||
" wire_fee_serial AS serial"
|
|
||||||
" FROM wire_fee"
|
|
||||||
" ORDER BY wire_fee_serial DESC"
|
|
||||||
" LIMIT 1;",
|
|
||||||
0),
|
|
||||||
GNUNET_PQ_make_prepare (
|
|
||||||
"select_serial_by_table_global_fee",
|
|
||||||
"SELECT"
|
|
||||||
" global_fee_serial AS serial"
|
|
||||||
" FROM global_fee"
|
|
||||||
" ORDER BY global_fee_serial DESC"
|
|
||||||
" LIMIT 1;",
|
|
||||||
0),
|
|
||||||
GNUNET_PQ_make_prepare (
|
|
||||||
"select_serial_by_table_recoup",
|
|
||||||
"SELECT"
|
|
||||||
" recoup_uuid AS serial"
|
|
||||||
" FROM recoup"
|
|
||||||
" ORDER BY recoup_uuid DESC"
|
|
||||||
" LIMIT 1;",
|
|
||||||
0),
|
|
||||||
GNUNET_PQ_make_prepare (
|
|
||||||
"select_serial_by_table_recoup_refresh",
|
|
||||||
"SELECT"
|
|
||||||
" recoup_refresh_uuid AS serial"
|
|
||||||
" FROM recoup_refresh"
|
|
||||||
" ORDER BY recoup_refresh_uuid DESC"
|
|
||||||
" LIMIT 1;",
|
|
||||||
0),
|
|
||||||
GNUNET_PQ_make_prepare (
|
|
||||||
"select_serial_by_table_extensions",
|
|
||||||
"SELECT"
|
|
||||||
" extension_id AS serial"
|
|
||||||
" FROM extensions"
|
|
||||||
" ORDER BY extension_id DESC"
|
|
||||||
" LIMIT 1;",
|
|
||||||
0),
|
|
||||||
GNUNET_PQ_make_prepare (
|
|
||||||
"select_serial_by_table_extension_details",
|
|
||||||
"SELECT"
|
|
||||||
" extension_details_serial_id AS serial"
|
|
||||||
" FROM extension_details"
|
|
||||||
" ORDER BY extension_details_serial_id DESC"
|
|
||||||
" LIMIT 1;",
|
|
||||||
0),
|
|
||||||
GNUNET_PQ_make_prepare (
|
|
||||||
"select_serial_by_table_purse_requests",
|
|
||||||
"SELECT"
|
|
||||||
" purse_requests_serial_id AS serial"
|
|
||||||
" FROM purse_requests"
|
|
||||||
" ORDER BY purse_requests_serial_id DESC"
|
|
||||||
" LIMIT 1;",
|
|
||||||
0),
|
|
||||||
GNUNET_PQ_make_prepare (
|
|
||||||
"select_serial_by_table_purse_refunds",
|
|
||||||
"SELECT"
|
|
||||||
" purse_refunds_serial_id AS serial"
|
|
||||||
" FROM purse_refunds"
|
|
||||||
" ORDER BY purse_refunds_serial_id DESC"
|
|
||||||
" LIMIT 1;",
|
|
||||||
0),
|
|
||||||
GNUNET_PQ_make_prepare (
|
|
||||||
"select_serial_by_table_purse_merges",
|
|
||||||
"SELECT"
|
|
||||||
" purse_merge_request_serial_id AS serial"
|
|
||||||
" FROM purse_merges"
|
|
||||||
" ORDER BY purse_merge_request_serial_id DESC"
|
|
||||||
" LIMIT 1;",
|
|
||||||
0),
|
|
||||||
GNUNET_PQ_make_prepare (
|
|
||||||
"select_serial_by_table_purse_deposits",
|
|
||||||
"SELECT"
|
|
||||||
" purse_deposit_serial_id AS serial"
|
|
||||||
" FROM purse_deposits"
|
|
||||||
" ORDER BY purse_deposit_serial_id DESC"
|
|
||||||
" LIMIT 1;",
|
|
||||||
0),
|
|
||||||
GNUNET_PQ_make_prepare (
|
|
||||||
"select_serial_by_table_account_merges",
|
|
||||||
"SELECT"
|
|
||||||
" account_merge_request_serial_id AS serial"
|
|
||||||
" FROM account_merges"
|
|
||||||
" ORDER BY account_merge_request_serial_id DESC"
|
|
||||||
" LIMIT 1;",
|
|
||||||
0),
|
|
||||||
GNUNET_PQ_make_prepare (
|
|
||||||
"select_serial_by_table_history_requests",
|
|
||||||
"SELECT"
|
|
||||||
" history_request_serial_id AS serial"
|
|
||||||
" FROM history_requests"
|
|
||||||
" ORDER BY history_request_serial_id DESC"
|
|
||||||
" LIMIT 1;",
|
|
||||||
0),
|
|
||||||
GNUNET_PQ_make_prepare (
|
|
||||||
"select_serial_by_table_close_requests",
|
|
||||||
"SELECT"
|
|
||||||
" close_request_serial_id AS serial"
|
|
||||||
" FROM close_requests"
|
|
||||||
" ORDER BY close_request_serial_id DESC"
|
|
||||||
" LIMIT 1;",
|
|
||||||
0),
|
|
||||||
GNUNET_PQ_make_prepare (
|
|
||||||
"select_serial_by_table_wads_out",
|
|
||||||
"SELECT"
|
|
||||||
" wad_out_serial_id AS serial"
|
|
||||||
" FROM wads_out"
|
|
||||||
" ORDER BY wad_out_serial_id DESC"
|
|
||||||
" LIMIT 1;",
|
|
||||||
0),
|
|
||||||
GNUNET_PQ_make_prepare (
|
|
||||||
"select_serial_by_table_wads_out_entries",
|
|
||||||
"SELECT"
|
|
||||||
" wad_out_entry_serial_id AS serial"
|
|
||||||
" FROM wad_out_entries"
|
|
||||||
" ORDER BY wad_out_entry_serial_id DESC"
|
|
||||||
" LIMIT 1;",
|
|
||||||
0),
|
|
||||||
GNUNET_PQ_make_prepare (
|
|
||||||
"select_serial_by_table_wads_in",
|
|
||||||
"SELECT"
|
|
||||||
" wad_in_serial_id AS serial"
|
|
||||||
" FROM wads_in"
|
|
||||||
" ORDER BY wad_in_serial_id DESC"
|
|
||||||
" LIMIT 1;",
|
|
||||||
0),
|
|
||||||
GNUNET_PQ_make_prepare (
|
|
||||||
"select_serial_by_table_wads_in_entries",
|
|
||||||
"SELECT"
|
|
||||||
" wad_in_entry_serial_id AS serial"
|
|
||||||
" FROM wad_in_entries"
|
|
||||||
" ORDER BY wad_in_entry_serial_id DESC"
|
|
||||||
" LIMIT 1;",
|
|
||||||
0),
|
|
||||||
GNUNET_PQ_make_prepare (
|
|
||||||
"select_serial_by_table_profit_drains",
|
|
||||||
"SELECT"
|
|
||||||
" profit_drain_serial_id AS serial"
|
|
||||||
" FROM profit_drains"
|
|
||||||
" ORDER BY profit_drain_serial_id DESC"
|
|
||||||
" LIMIT 1;",
|
|
||||||
0),
|
|
||||||
/* Used in #postgres_begin_shard() */
|
/* Used in #postgres_begin_shard() */
|
||||||
GNUNET_PQ_make_prepare (
|
GNUNET_PQ_make_prepare (
|
||||||
"get_open_shard",
|
"get_open_shard",
|
||||||
@ -13118,157 +12822,6 @@ postgres_lookup_global_fee_by_time (
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Lookup the latest serial number of @a table. Used in
|
|
||||||
* exchange-auditor database replication.
|
|
||||||
*
|
|
||||||
* @param cls closure
|
|
||||||
* @param table table for which we should return the serial
|
|
||||||
* @param[out] serial latest serial number in use
|
|
||||||
* @return transaction status code, GNUNET_DB_STATUS_HARD_ERROR if
|
|
||||||
* @a table does not have a serial number
|
|
||||||
*/
|
|
||||||
static enum GNUNET_DB_QueryStatus
|
|
||||||
postgres_lookup_serial_by_table (void *cls,
|
|
||||||
enum TALER_EXCHANGEDB_ReplicatedTable table,
|
|
||||||
uint64_t *serial)
|
|
||||||
{
|
|
||||||
struct PostgresClosure *pg = cls;
|
|
||||||
struct GNUNET_PQ_QueryParam params[] = {
|
|
||||||
GNUNET_PQ_query_param_end
|
|
||||||
};
|
|
||||||
struct GNUNET_PQ_ResultSpec rs[] = {
|
|
||||||
GNUNET_PQ_result_spec_uint64 ("serial",
|
|
||||||
serial),
|
|
||||||
GNUNET_PQ_result_spec_end
|
|
||||||
};
|
|
||||||
const char *statement;
|
|
||||||
|
|
||||||
switch (table)
|
|
||||||
{
|
|
||||||
case TALER_EXCHANGEDB_RT_DENOMINATIONS:
|
|
||||||
statement = "select_serial_by_table_denominations";
|
|
||||||
break;
|
|
||||||
case TALER_EXCHANGEDB_RT_DENOMINATION_REVOCATIONS:
|
|
||||||
statement = "select_serial_by_table_denomination_revocations";
|
|
||||||
break;
|
|
||||||
case TALER_EXCHANGEDB_RT_WIRE_TARGETS:
|
|
||||||
statement = "select_serial_by_table_wire_targets";
|
|
||||||
break;
|
|
||||||
case TALER_EXCHANGEDB_RT_RESERVES:
|
|
||||||
statement = "select_serial_by_table_reserves";
|
|
||||||
break;
|
|
||||||
case TALER_EXCHANGEDB_RT_RESERVES_IN:
|
|
||||||
statement = "select_serial_by_table_reserves_in";
|
|
||||||
break;
|
|
||||||
case TALER_EXCHANGEDB_RT_RESERVES_CLOSE:
|
|
||||||
statement = "select_serial_by_table_reserves_close";
|
|
||||||
break;
|
|
||||||
case TALER_EXCHANGEDB_RT_RESERVES_OUT:
|
|
||||||
statement = "select_serial_by_table_reserves_out";
|
|
||||||
break;
|
|
||||||
case TALER_EXCHANGEDB_RT_AUDITORS:
|
|
||||||
statement = "select_serial_by_table_auditors";
|
|
||||||
break;
|
|
||||||
case TALER_EXCHANGEDB_RT_AUDITOR_DENOM_SIGS:
|
|
||||||
statement = "select_serial_by_table_auditor_denom_sigs";
|
|
||||||
break;
|
|
||||||
case TALER_EXCHANGEDB_RT_EXCHANGE_SIGN_KEYS:
|
|
||||||
statement = "select_serial_by_table_exchange_sign_keys";
|
|
||||||
break;
|
|
||||||
case TALER_EXCHANGEDB_RT_SIGNKEY_REVOCATIONS:
|
|
||||||
statement = "select_serial_by_table_signkey_revocations";
|
|
||||||
break;
|
|
||||||
case TALER_EXCHANGEDB_RT_KNOWN_COINS:
|
|
||||||
statement = "select_serial_by_table_known_coins";
|
|
||||||
break;
|
|
||||||
case TALER_EXCHANGEDB_RT_REFRESH_COMMITMENTS:
|
|
||||||
statement = "select_serial_by_table_refresh_commitments";
|
|
||||||
break;
|
|
||||||
case TALER_EXCHANGEDB_RT_REFRESH_REVEALED_COINS:
|
|
||||||
statement = "select_serial_by_table_refresh_revealed_coins";
|
|
||||||
break;
|
|
||||||
case TALER_EXCHANGEDB_RT_REFRESH_TRANSFER_KEYS:
|
|
||||||
statement = "select_serial_by_table_refresh_transfer_keys";
|
|
||||||
break;
|
|
||||||
case TALER_EXCHANGEDB_RT_DEPOSITS:
|
|
||||||
statement = "select_serial_by_table_deposits";
|
|
||||||
break;
|
|
||||||
case TALER_EXCHANGEDB_RT_REFUNDS:
|
|
||||||
statement = "select_serial_by_table_refunds";
|
|
||||||
break;
|
|
||||||
case TALER_EXCHANGEDB_RT_WIRE_OUT:
|
|
||||||
statement = "select_serial_by_table_wire_out";
|
|
||||||
break;
|
|
||||||
case TALER_EXCHANGEDB_RT_AGGREGATION_TRACKING:
|
|
||||||
statement = "select_serial_by_table_aggregation_tracking";
|
|
||||||
break;
|
|
||||||
case TALER_EXCHANGEDB_RT_WIRE_FEE:
|
|
||||||
statement = "select_serial_by_table_wire_fee";
|
|
||||||
break;
|
|
||||||
case TALER_EXCHANGEDB_RT_GLOBAL_FEE:
|
|
||||||
statement = "select_serial_by_table_global_fee";
|
|
||||||
break;
|
|
||||||
case TALER_EXCHANGEDB_RT_RECOUP:
|
|
||||||
statement = "select_serial_by_table_recoup";
|
|
||||||
break;
|
|
||||||
case TALER_EXCHANGEDB_RT_RECOUP_REFRESH:
|
|
||||||
statement = "select_serial_by_table_recoup_refresh";
|
|
||||||
break;
|
|
||||||
case TALER_EXCHANGEDB_RT_EXTENSIONS:
|
|
||||||
statement = "select_serial_by_table_extensions";
|
|
||||||
break;
|
|
||||||
case TALER_EXCHANGEDB_RT_EXTENSION_DETAILS:
|
|
||||||
statement = "select_serial_by_table_extension_details";
|
|
||||||
break;
|
|
||||||
case TALER_EXCHANGEDB_RT_PURSE_REQUESTS:
|
|
||||||
statement = "select_serial_by_table_purse_requests";
|
|
||||||
break;
|
|
||||||
case TALER_EXCHANGEDB_RT_PURSE_REFUNDS:
|
|
||||||
statement = "select_serial_by_table_purse_refunds";
|
|
||||||
break;
|
|
||||||
case TALER_EXCHANGEDB_RT_PURSE_MERGES:
|
|
||||||
statement = "select_serial_by_table_purse_merges";
|
|
||||||
break;
|
|
||||||
case TALER_EXCHANGEDB_RT_PURSE_DEPOSITS:
|
|
||||||
statement = "select_serial_by_table_purse_deposits";
|
|
||||||
break;
|
|
||||||
case TALER_EXCHANGEDB_RT_ACCOUNT_MERGES:
|
|
||||||
statement = "select_serial_by_table_account_merges";
|
|
||||||
break;
|
|
||||||
case TALER_EXCHANGEDB_RT_HISTORY_REQUESTS:
|
|
||||||
statement = "select_serial_by_table_history_requests";
|
|
||||||
break;
|
|
||||||
case TALER_EXCHANGEDB_RT_CLOSE_REQUESTS:
|
|
||||||
statement = "select_serial_by_table_close_requests";
|
|
||||||
break;
|
|
||||||
case TALER_EXCHANGEDB_RT_WADS_OUT:
|
|
||||||
statement = "select_serial_by_table_wads_out";
|
|
||||||
break;
|
|
||||||
case TALER_EXCHANGEDB_RT_WADS_OUT_ENTRIES:
|
|
||||||
statement = "select_serial_by_table_wads_out_entries";
|
|
||||||
break;
|
|
||||||
case TALER_EXCHANGEDB_RT_WADS_IN:
|
|
||||||
statement = "select_serial_by_table_wads_in";
|
|
||||||
break;
|
|
||||||
case TALER_EXCHANGEDB_RT_WADS_IN_ENTRIES:
|
|
||||||
statement = "select_serial_by_table_wads_in_entries";
|
|
||||||
break;
|
|
||||||
case TALER_EXCHANGEDB_RT_PROFIT_DRAINS:
|
|
||||||
statement = "select_serial_by_table_profit_drains";
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
GNUNET_break (0);
|
|
||||||
return GNUNET_DB_STATUS_HARD_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
return GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
|
|
||||||
statement,
|
|
||||||
params,
|
|
||||||
rs);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function called to grab a work shard on an operation @a op. Runs in its
|
* Function called to grab a work shard on an operation @a op. Runs in its
|
||||||
* own transaction.
|
* own transaction.
|
||||||
@ -15830,10 +15383,6 @@ libtaler_plugin_exchangedb_postgres_init (void *cls)
|
|||||||
= &postgres_activate_signing_key;
|
= &postgres_activate_signing_key;
|
||||||
plugin->lookup_signing_key
|
plugin->lookup_signing_key
|
||||||
= &postgres_lookup_signing_key;
|
= &postgres_lookup_signing_key;
|
||||||
plugin->lookup_serial_by_table
|
|
||||||
= &postgres_lookup_serial_by_table;
|
|
||||||
plugin->lookup_records_by_table
|
|
||||||
= &TEH_PG_lookup_records_by_table;
|
|
||||||
plugin->begin_shard
|
plugin->begin_shard
|
||||||
= &postgres_begin_shard;
|
= &postgres_begin_shard;
|
||||||
plugin->abort_shard
|
plugin->abort_shard
|
||||||
@ -15921,6 +15470,10 @@ libtaler_plugin_exchangedb_postgres_init (void *cls)
|
|||||||
= &TEH_PG_iterate_reserve_close_info;
|
= &TEH_PG_iterate_reserve_close_info;
|
||||||
plugin->iterate_kyc_reference
|
plugin->iterate_kyc_reference
|
||||||
= &TEH_PG_iterate_kyc_reference;
|
= &TEH_PG_iterate_kyc_reference;
|
||||||
|
plugin->lookup_records_by_table
|
||||||
|
= &TEH_PG_lookup_records_by_table;
|
||||||
|
plugin->lookup_serial_by_table
|
||||||
|
= &TEH_PG_lookup_serial_by_table;
|
||||||
plugin->select_reserve_close_info
|
plugin->select_reserve_close_info
|
||||||
= &TEH_PG_select_reserve_close_info;
|
= &TEH_PG_select_reserve_close_info;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user