move PostGres-specific logic out of libtalerutil

This commit is contained in:
Christian Grothoff 2015-01-28 20:37:51 +01:00
parent bc8f6e81a4
commit c4b63c1302
8 changed files with 36 additions and 19 deletions

View File

@ -151,6 +151,7 @@ AC_CONFIG_FILES([Makefile
src/Makefile src/Makefile
src/include/Makefile src/include/Makefile
src/util/Makefile src/util/Makefile
src/pq/Makefile
src/mint/Makefile src/mint/Makefile
src/lib/Makefile src/lib/Makefile
]) ])

View File

@ -1,2 +1,2 @@
AM_CPPFLAGS = -I$(top_srcdir)/src/include AM_CPPFLAGS = -I$(top_srcdir)/src/include
SUBDIRS = include util mint lib SUBDIRS = include util pq mint lib

View File

@ -13,13 +13,11 @@
You should have received a copy of the GNU General Public License along with You should have received a copy of the GNU General Public License along with
TALER; see the file COPYING. If not, If not, see <http://www.gnu.org/licenses/> TALER; see the file COPYING. If not, If not, see <http://www.gnu.org/licenses/>
*/ */
/** /**
* @file include/taler_json_lib.h * @file include/taler_json_lib.h
* @brief helper functions for JSON processing using libjansson * @brief helper functions for JSON processing using libjansson
* @author Sree Harsha Totakura <sreeharsha@totakura.in> * @author Sree Harsha Totakura <sreeharsha@totakura.in>
*/ */
#ifndef TALER_JSON_LIB_H_ #ifndef TALER_JSON_LIB_H_
#define TALER_JSON_LIB_H_ #define TALER_JSON_LIB_H_
@ -75,7 +73,7 @@ TALER_JSON_from_data (const void *data, size_t size);
* *
* @param json the json object representing Amount * @param json the json object representing Amount
* @param r_amount where the amount has to be written * @param r_amount where the amount has to be written
* @return #GNUNET_OK upon successful parsing; GNUNET_SYSERR upon error * @return #GNUNET_OK upon successful parsing; #GNUNET_SYSERR upon error
*/ */
int int
TALER_JSON_to_amount (json_t *json, TALER_JSON_to_amount (json_t *json,
@ -86,7 +84,7 @@ TALER_JSON_to_amount (json_t *json,
* *
* @param json the json object representing absolute time in seconds * @param json the json object representing absolute time in seconds
* @param r_abs where the time has to be written * @param r_abs where the time has to be written
* @return #GNUNET_OK upon successful parsing; GNUNET_SYSERR upon error * @return #GNUNET_OK upon successful parsing; #GNUNET_SYSERR upon error
*/ */
int int
TALER_JSON_to_abs (json_t *json, TALER_JSON_to_abs (json_t *json,
@ -97,8 +95,8 @@ TALER_JSON_to_abs (json_t *json,
* *
* @param json the json object representing data * @param json the json object representing data
* @param out the pointer to hold the parsed data. * @param out the pointer to hold the parsed data.
* @param out_size the size of r_data. * @param out_size the size of @a out
* @return #GNUNET_OK upon successful parsing; GNUNET_SYSERR upon error * @return #GNUNET_OK upon successful parsing; #GNUNET_SYSERR upon error
*/ */
int int
TALER_JSON_to_data (json_t *json, TALER_JSON_to_data (json_t *json,

View File

@ -31,6 +31,7 @@ taler_mint_keyup_SOURCES = \
taler_mint_keyup_LDADD = \ taler_mint_keyup_LDADD = \
$(LIBGCRYPT_LIBS) \ $(LIBGCRYPT_LIBS) \
$(top_builddir)/src/util/libtalerutil.la \ $(top_builddir)/src/util/libtalerutil.la \
$(top_builddir)/src/pq/libtalerpq.la \
$(top_builddir)/src/mint/libtalermint_common.la \ $(top_builddir)/src/mint/libtalermint_common.la \
-lpq \ -lpq \
-lgnunetutil -lgnunetutil
@ -43,6 +44,7 @@ taler_mint_keycheck_SOURCES = \
taler_mint_keycheck_LDADD = \ taler_mint_keycheck_LDADD = \
$(LIBGCRYPT_LIBS) \ $(LIBGCRYPT_LIBS) \
$(top_builddir)/src/util/libtalerutil.la \ $(top_builddir)/src/util/libtalerutil.la \
$(top_builddir)/src/pq/libtalerpq.la \
$(top_builddir)/src/mint/libtalermint_common.la \ $(top_builddir)/src/mint/libtalermint_common.la \
-lgnunetutil \ -lgnunetutil \
-lpq -lpq
@ -53,6 +55,7 @@ taler_mint_reservemod_SOURCES = \
taler_mint_reservemod_LDADD = \ taler_mint_reservemod_LDADD = \
$(LIBGCRYPT_LIBS) \ $(LIBGCRYPT_LIBS) \
$(top_builddir)/src/util/libtalerutil.la \ $(top_builddir)/src/util/libtalerutil.la \
$(top_builddir)/src/pq/libtalerpq.la \
$(top_builddir)/src/mint/libtalermint_common.la \ $(top_builddir)/src/mint/libtalermint_common.la \
-lpq \ -lpq \
-lgnunetutil -lgnunetutil
@ -73,6 +76,7 @@ taler_mint_httpd_SOURCES = \
taler_mint_httpd_LDADD = \ taler_mint_httpd_LDADD = \
$(LIBGCRYPT_LIBS) \ $(LIBGCRYPT_LIBS) \
$(top_builddir)/src/util/libtalerutil.la \ $(top_builddir)/src/util/libtalerutil.la \
$(top_builddir)/src/pq/libtalerpq.la \
$(top_builddir)/src/mint/libtalermint_common.la \ $(top_builddir)/src/mint/libtalermint_common.la \
-lpq \ -lpq \
-lmicrohttpd \ -lmicrohttpd \
@ -88,6 +92,7 @@ taler_mint_dbinit_SOURCES = \
taler_mint_dbinit_LDADD = \ taler_mint_dbinit_LDADD = \
$(LIBGCRYPT_LIBS) \ $(LIBGCRYPT_LIBS) \
$(top_builddir)/src/util/libtalerutil.la \ $(top_builddir)/src/util/libtalerutil.la \
$(top_builddir)/src/pq/libtalerpq.la \
$(top_builddir)/src/mint/libtalermint_common.la \ $(top_builddir)/src/mint/libtalermint_common.la \
-lpq \ -lpq \
-lgnunetutil -lgnunetutil

16
src/pq/Makefile.am Normal file
View File

@ -0,0 +1,16 @@
AM_CPPFLAGS = -I$(top_srcdir)/src/include $(LIBGCRYPT_CFLAGS) $(POSTGRESQL_CPPFLAGS)
lib_LTLIBRARIES = \
libtalerpq.la
libtalerpq_la_SOURCES = \
db_pq.c
libtalerpq_la_LIBADD = \
-lgnunetutil \
-lpq
libtalerpq_la_LDFLAGS = \
$(POSTGRESQL_LDFLAGS) \
-version-info 0:0:0 \
-export-dynamic -no-undefined

View File

@ -14,8 +14,8 @@
TALER; see the file COPYING. If not, If not, see <http://www.gnu.org/licenses/> TALER; see the file COPYING. If not, If not, see <http://www.gnu.org/licenses/>
*/ */
/** /**
* @file util/db.c * @file util/db_pq.c
* @brief helper functions for DB interactions * @brief helper functions for libpq (PostGres) interactions
* @author Sree Harsha Totakura <sreeharsha@totakura.in> * @author Sree Harsha Totakura <sreeharsha@totakura.in>
* @author Florian Dold * @author Florian Dold
* @author Christian Grothoff * @author Christian Grothoff
@ -214,4 +214,4 @@ TALER_DB_extract_amount (PGresult *result,
return GNUNET_OK; return GNUNET_OK;
} }
/* end of util/db.c */ /* end of pq/db_pq.c */

View File

@ -7,17 +7,14 @@ libtalerutil_la_SOURCES = \
amount.c \ amount.c \
crypto.c \ crypto.c \
util.c \ util.c \
json.c \ json.c
db.c
libtalerutil_la_LIBADD = \ libtalerutil_la_LIBADD = \
-lgnunetutil \ -lgnunetutil \
$(LIBGCRYPT_LIBS) \ $(LIBGCRYPT_LIBS) \
-ljansson \ -ljansson \
-lmicrohttpd \ -lmicrohttpd
-lpq
libtalerutil_la_LDFLAGS = \ libtalerutil_la_LDFLAGS = \
$(POSTGRESQL_LDFLAGS) \
-version-info 0:0:0 \ -version-info 0:0:0 \
-export-dynamic -no-undefined -export-dynamic -no-undefined

View File

@ -146,7 +146,7 @@ TALER_JSON_from_data (const void *data, size_t size)
* *
* @param json the json object representing Amount * @param json the json object representing Amount
* @param r_amount where the amount has to be written * @param r_amount where the amount has to be written
* @return GNUNET_OK upon successful parsing; GNUNET_SYSERR upon error * @return #GNUNET_OK upon successful parsing; #GNUNET_SYSERR upon error
*/ */
int int
TALER_JSON_to_amount (json_t *json, TALER_JSON_to_amount (json_t *json,
@ -177,7 +177,7 @@ TALER_JSON_to_amount (json_t *json,
* *
* @param json the json object representing Amount * @param json the json object representing Amount
* @param r_amount where the amount has to be written * @param r_amount where the amount has to be written
* @return GNUNET_OK upon successful parsing; GNUNET_SYSERR upon error * @return #GNUNET_OK upon successful parsing; #GNUNET_SYSERR upon error
*/ */
int int
TALER_JSON_to_abs (json_t *json, TALER_JSON_to_abs (json_t *json,
@ -201,8 +201,8 @@ TALER_JSON_to_abs (json_t *json,
* *
* @param json the json object representing data * @param json the json object representing data
* @param out the pointer to hold the parsed data. * @param out the pointer to hold the parsed data.
* @param out_size the size of r_data. * @param out_size the size of @a out
* @return GNUNET_OK upon successful parsing; GNUNET_SYSERR upon error * @return #GNUNET_OK upon successful parsing; #GNUNET_SYSERR upon error
*/ */
int int
TALER_JSON_to_data (json_t *json, TALER_JSON_to_data (json_t *json,