exchange

Base system with REST service to issue digital coins, run by the payment service provider
Log | Files | Refs | Submodules | README | LICENSE

commit 3eee9d787fea13c1aeff4992120d6af9ca8b1cf6
parent 758f1b7b6b162e9e21383bf3f918ae5f0be22afd
Author: Christian Grothoff <grothoff@gnunet.org>
Date:   Tue, 21 Apr 2026 15:38:32 +0200

fix sql

Diffstat:
Msrc/exchange-tools/meson.build | 2++
Msrc/exchange-tools/taler-exchange-dbinit.c | 32+++++++++++++++++++++++++++++++-
Msrc/exchangedb/insert_successor_measure.sql | 2+-
Msrc/exchangedb/sql-schema/Makefile.sql | 2+-
Msrc/testing/meson.build | 6++----
5 files changed, 37 insertions(+), 7 deletions(-)

diff --git a/src/exchange-tools/meson.build b/src/exchange-tools/meson.build @@ -64,7 +64,9 @@ executable( libtalerutil_dep, libtalerpq_dep, libtalerexchangedb_dep, + gnunetpq_dep, gnunetutil_dep, + pq_dep, gcrypt_dep, ], include_directories: [incdir, configuration_inc], diff --git a/src/exchange-tools/taler-exchange-dbinit.c b/src/exchange-tools/taler-exchange-dbinit.c @@ -21,6 +21,7 @@ */ #include "platform.h" #include <gnunet/gnunet_util_lib.h> +#include <gnunet/gnunet_pq_lib.h> #include "exchangedb_lib.h" #include "exchange-database/gc.h" @@ -91,21 +92,50 @@ run (void *cls, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg) { + struct GNUNET_PQ_Context *conn; struct TALER_EXCHANGEDB_PostgresContext *pg; + struct GNUNET_PQ_ExecuteStatement es[] = { + GNUNET_PQ_make_try_execute ("SET search_path TO exchange;"), + GNUNET_PQ_EXECUTE_STATEMENT_END + }; (void) cls; (void) args; (void) cfgfile; if (NULL == + (conn = GNUNET_PQ_connect_with_cfg (cfg, + "exchangedb-postgres", + "exchange-", + es, + NULL))) + { + fprintf (stderr, + "Failed to initialize database.\n"); + global_ret = EXIT_NOTINSTALLED; + return; + } + if (NULL == (pg = TALER_EXCHANGEDB_connect (cfg, true))) { fprintf (stderr, - "Failed to initialize database plugin.\n"); + "Failed to initialize database connection.\n"); global_ret = EXIT_NOTINSTALLED; return; } + if (GNUNET_OK != + GNUNET_PQ_exec_sql (conn, + "procedures")) + { + GNUNET_PQ_disconnect (conn); + fprintf (stderr, + "Failed to load stored procedures.\n"); + global_ret = EXIT_NOTINSTALLED; + return; + } + + GNUNET_PQ_disconnect (conn); if (reset_db) { if (GNUNET_OK != diff --git a/src/exchangedb/insert_successor_measure.sql b/src/exchangedb/insert_successor_measure.sql @@ -145,5 +145,5 @@ EXECUTE FORMAT ( END $$; -COMMENT ON FUNCTION exchange_do_insert_successor_measure(BYTEA, INT8, INT8, TEXT, JSONB) +COMMENT ON FUNCTION exchange_do_insert_successor_measure(BYTEA, INT8, INT8, TEXT, JSONB, TEXT) IS 'Checks whether the AML officer is eligible to make AML decisions and if so inserts the decision into the table'; diff --git a/src/exchangedb/sql-schema/Makefile.sql b/src/exchangedb/sql-schema/Makefile.sql @@ -1,4 +1,4 @@ -procedures.sql: procedures.sql.in exchange_do_*.sql exchange_statistics_*.sql exchange_trigger_*.sql +procedures.sql: procedures.sql.in ../*.sql exchange_do_*.sql exchange_statistics_*.sql exchange_trigger_*.sql chmod +w $@ || true gcc -E -P -undef - < procedures.sql.in 2>/dev/null | sed -e "s/--.*//" | awk 'NF' - >$@ chmod ugo-w $@ diff --git a/src/testing/meson.build b/src/testing/meson.build @@ -4,10 +4,7 @@ # rm -rf report* -check_SCRIPTS = [ - 'test-exchange-taler-harness', - 'test-sanctions', -] +check_SCRIPTS = ['test-exchange-taler-harness', 'test-sanctions'] foreach f : check_SCRIPTS f_sh = '@0@.sh'.format(f) @@ -18,6 +15,7 @@ foreach f : check_SCRIPTS workdir: meson.current_build_dir(), suite: ['testing', 'integrationtests'], is_parallel: false, + timeout: 300, ) endforeach