summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2021-06-16 17:08:30 +0200
committerChristian Grothoff <christian@grothoff.org>2021-06-16 17:08:30 +0200
commitae7b5951c1bcee108a3ee03bf97f426640aa996f (patch)
tree2dafc0f221d84ae408588861d7055d0f4e550ec6 /src
parent34a5806eb5c852b66a6552c41a3b8fff508d1b6d (diff)
downloadexchange-ae7b5951c1bcee108a3ee03bf97f426640aa996f.tar.gz
exchange-ae7b5951c1bcee108a3ee03bf97f426640aa996f.tar.bz2
exchange-ae7b5951c1bcee108a3ee03bf97f426640aa996f.zip
update PQ implementation to allow for NULLable amounts
Diffstat (limited to 'src')
-rw-r--r--src/pq/pq_result_helper.c27
1 files changed, 10 insertions, 17 deletions
diff --git a/src/pq/pq_result_helper.c b/src/pq/pq_result_helper.c
index c1c8fe5e..3d252890 100644
--- a/src/pq/pq_result_helper.c
+++ b/src/pq/pq_result_helper.c
@@ -38,7 +38,7 @@
* #GNUNET_NO if at least one result was NULL
* #GNUNET_SYSERR if a result was invalid (non-existing field)
*/
-static int
+static enum GNUNET_GenericReturnValue
extract_amount_nbo_helper (PGresult *result,
int row,
const char *currency,
@@ -87,7 +87,6 @@ extract_amount_nbo_helper (PGresult *result,
row,
frac_num)) )
{
- GNUNET_break (0);
return GNUNET_NO;
}
/* Note that Postgres stores value in NBO internally,
@@ -121,7 +120,7 @@ extract_amount_nbo_helper (PGresult *result,
* #GNUNET_NO if at least one result was NULL
* #GNUNET_SYSERR if a result was invalid (non-existing field)
*/
-static int
+static enum GNUNET_GenericReturnValue
extract_amount_nbo (void *cls,
PGresult *result,
int row,
@@ -132,7 +131,7 @@ extract_amount_nbo (void *cls,
const char *currency = cls;
char *val_name;
char *frac_name;
- int ret;
+ enum GNUNET_GenericReturnValue ret;
if (sizeof (struct TALER_AmountNBO) != *dst_size)
{
@@ -196,7 +195,7 @@ TALER_PQ_result_spec_amount_nbo (const char *name,
* #GNUNET_NO if at least one result was NULL
* #GNUNET_SYSERR if a result was invalid (non-existing field)
*/
-static int
+static enum GNUNET_GenericReturnValue
extract_amount (void *cls,
PGresult *result,
int row,
@@ -209,7 +208,7 @@ extract_amount (void *cls,
char *val_name;
char *frac_name;
struct TALER_AmountNBO amount_nbo;
- int ret;
+ enum GNUNET_GenericReturnValue ret;
if (sizeof (struct TALER_AmountNBO) != *dst_size)
{
@@ -280,7 +279,7 @@ TALER_PQ_result_spec_amount (const char *name,
* #GNUNET_NO if at least one result was NULL
* #GNUNET_SYSERR if a result was invalid (non-existing field)
*/
-static int
+static enum GNUNET_GenericReturnValue
extract_json (void *cls,
PGresult *result,
int row,
@@ -389,7 +388,7 @@ TALER_PQ_result_spec_json (const char *name,
* #GNUNET_YES if all results could be extracted
* #GNUNET_SYSERR if a result was invalid (non-existing field or NULL)
*/
-static int
+static enum GNUNET_GenericReturnValue
extract_round_time (void *cls,
PGresult *result,
int row,
@@ -413,10 +412,7 @@ extract_round_time (void *cls,
if (PQgetisnull (result,
row,
fnum))
- {
- GNUNET_break (0);
- return GNUNET_SYSERR;
- }
+ return GNUNET_NO;
GNUNET_assert (NULL != dst);
if (sizeof (struct GNUNET_TIME_Absolute) != *dst_size)
{
@@ -472,7 +468,7 @@ TALER_PQ_result_spec_absolute_time (const char *name,
* #GNUNET_YES if all results could be extracted
* #GNUNET_SYSERR if a result was invalid (non-existing field or NULL)
*/
-static int
+static enum GNUNET_GenericReturnValue
extract_round_time_nbo (void *cls,
PGresult *result,
int row,
@@ -496,10 +492,7 @@ extract_round_time_nbo (void *cls,
if (PQgetisnull (result,
row,
fnum))
- {
- GNUNET_break (0);
- return GNUNET_SYSERR;
- }
+ return GNUNET_NO;
GNUNET_assert (NULL != dst);
if (sizeof (struct GNUNET_TIME_AbsoluteNBO) != *dst_size)
{