summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2022-11-02 11:20:53 +0100
committerChristian Grothoff <christian@grothoff.org>2022-11-02 11:20:53 +0100
commit1d483e2e17efc9fce5e2b3c27fe533e386178e3d (patch)
tree332db230ab8a1fbc54dd5d86f6d67b22e94abdfa
parent481ffc1a0a2c808316877a76d74262aa61274a26 (diff)
downloadexchange-1d483e2e17efc9fce5e2b3c27fe533e386178e3d.tar.gz
exchange-1d483e2e17efc9fce5e2b3c27fe533e386178e3d.tar.bz2
exchange-1d483e2e17efc9fce5e2b3c27fe533e386178e3d.zip
templating helper
-rw-r--r--src/exchangedb/Makefile.am4
-rw-r--r--src/exchangedb/pg_template.c26
-rw-r--r--src/exchangedb/pg_template.h29
-rwxr-xr-xsrc/exchangedb/pg_template.sh12
4 files changed, 71 insertions, 0 deletions
diff --git a/src/exchangedb/Makefile.am b/src/exchangedb/Makefile.am
index f4ea5df9c..39bf4b7d6 100644
--- a/src/exchangedb/Makefile.am
+++ b/src/exchangedb/Makefile.am
@@ -146,3 +146,7 @@ bench_db_postgres_LDADD = \
EXTRA_test_exchangedb_postgres_DEPENDENCIES = \
libtaler_plugin_exchangedb_postgres.la
+
+EXTRA_DIST = \
+ pg_template.h pg_template.c \
+ pg_template.sh
diff --git a/src/exchangedb/pg_template.c b/src/exchangedb/pg_template.c
new file mode 100644
index 000000000..44878794f
--- /dev/null
+++ b/src/exchangedb/pg_template.c
@@ -0,0 +1,26 @@
+/*
+ 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_template.c
+ * @brief Implementation of the template function for Postgres
+ * @author Christian Grothoff
+ */
+#include "platform.h"
+#include "taler_error_codes.h"
+#include "taler_dbevents.h"
+#include "taler_pq_lib.h"
+#include "pg_template.h"
+#include "pg_helper.h"
diff --git a/src/exchangedb/pg_template.h b/src/exchangedb/pg_template.h
new file mode 100644
index 000000000..fe4bdd048
--- /dev/null
+++ b/src/exchangedb/pg_template.h
@@ -0,0 +1,29 @@
+/*
+ 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_template.h
+ * @brief implementation of the template function for Postgres
+ * @author Christian Grothoff
+ */
+#ifndef PG_TEMPLATE_H
+#define PG_TEMPLATE_H
+
+#include "taler_util.h"
+#include "taler_json_lib.h"
+#include "taler_exchangedb_plugin.h"
+
+
+#endif
diff --git a/src/exchangedb/pg_template.sh b/src/exchangedb/pg_template.sh
new file mode 100755
index 000000000..5aa8f8d45
--- /dev/null
+++ b/src/exchangedb/pg_template.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+# This file is in the public domain.
+#
+# Instantiates pg_template for a particular function.
+
+for n in $*
+do
+ NCAPS=`echo $n | tr a-z A-Z`
+ cat pg_template.c | sed -e s/template/$n/g -e s/TEMPLATE/$NCAPS/g > pg_$n.c
+ cat pg_template.h | sed -e s/template/$n/g -e s/TEMPLATE/$NCAPS/g > pg_$n.h
+ echo "\#include \"pg_$n.h\"" >> hdr.h
+done