aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mint/mint_common.c37
-rw-r--r--src/mint/mint_db.c41
2 files changed, 40 insertions, 38 deletions
diff --git a/src/mint/mint_common.c b/src/mint/mint_common.c
index f0ee09110..41b9d6ed5 100644
--- a/src/mint/mint_common.c
+++ b/src/mint/mint_common.c
@@ -231,42 +231,5 @@ TALER_MINT_denomkeys_iterate (const char *mint_base_dir,
}
-int
-TALER_TALER_DB_extract_amount_nbo (PGresult *result,
- unsigned int row,
- int indices[3],
- struct TALER_AmountNBO *denom_nbo)
-{
- if ((indices[0] < 0) || (indices[1] < 0) || (indices[2] < 0))
- return GNUNET_NO;
- if (sizeof (uint32_t) != PQgetlength (result, row, indices[0]))
- return GNUNET_SYSERR;
- if (sizeof (uint32_t) != PQgetlength (result, row, indices[1]))
- return GNUNET_SYSERR;
- if (PQgetlength (result, row, indices[2]) > TALER_CURRENCY_LEN)
- return GNUNET_SYSERR;
- denom_nbo->value = *(uint32_t *) PQgetvalue (result, row, indices[0]);
- denom_nbo->fraction = *(uint32_t *) PQgetvalue (result, row, indices[1]);
- memset (denom_nbo->currency, 0, TALER_CURRENCY_LEN);
- memcpy (denom_nbo->currency, PQgetvalue (result, row, indices[2]), PQgetlength (result, row, indices[2]));
- return GNUNET_OK;
-}
-
-
-int
-TALER_TALER_DB_extract_amount (PGresult *result,
- unsigned int row,
- int indices[3],
- struct TALER_Amount *denom)
-{
- struct TALER_AmountNBO denom_nbo;
- int res;
-
- res = TALER_TALER_DB_extract_amount_nbo (result, row, indices, &denom_nbo);
- if (GNUNET_OK != res)
- return res;
- *denom = TALER_amount_ntoh (denom_nbo);
- return GNUNET_OK;
-}
/* end of mint_common.c */
diff --git a/src/mint/mint_db.c b/src/mint/mint_db.c
index c07490805..35f803e1b 100644
--- a/src/mint/mint_db.c
+++ b/src/mint/mint_db.c
@@ -2007,7 +2007,7 @@ db_conn_destroy (void *cls)
* Initialize database subsystem.
*
* @param connection_cfg configuration to use to talk to DB
- * @return GNUNET_OK on success
+ * @return #GNUNET_OK on success
*/
int
TALER_MINT_DB_init (const char *connection_cfg)
@@ -2022,3 +2022,42 @@ TALER_MINT_DB_init (const char *connection_cfg)
TALER_MINT_db_connection_cfg_str = GNUNET_strdup (connection_cfg);
return GNUNET_OK;
}
+
+
+int
+TALER_TALER_DB_extract_amount_nbo (PGresult *result,
+ unsigned int row,
+ int indices[3],
+ struct TALER_AmountNBO *denom_nbo)
+{
+ if ((indices[0] < 0) || (indices[1] < 0) || (indices[2] < 0))
+ return GNUNET_NO;
+ if (sizeof (uint32_t) != PQgetlength (result, row, indices[0]))
+ return GNUNET_SYSERR;
+ if (sizeof (uint32_t) != PQgetlength (result, row, indices[1]))
+ return GNUNET_SYSERR;
+ if (PQgetlength (result, row, indices[2]) > TALER_CURRENCY_LEN)
+ return GNUNET_SYSERR;
+ denom_nbo->value = *(uint32_t *) PQgetvalue (result, row, indices[0]);
+ denom_nbo->fraction = *(uint32_t *) PQgetvalue (result, row, indices[1]);
+ memset (denom_nbo->currency, 0, TALER_CURRENCY_LEN);
+ memcpy (denom_nbo->currency, PQgetvalue (result, row, indices[2]), PQgetlength (result, row, indices[2]));
+ return GNUNET_OK;
+}
+
+
+int
+TALER_TALER_DB_extract_amount (PGresult *result,
+ unsigned int row,
+ int indices[3],
+ struct TALER_Amount *denom)
+{
+ struct TALER_AmountNBO denom_nbo;
+ int res;
+
+ res = TALER_TALER_DB_extract_amount_nbo (result, row, indices, &denom_nbo);
+ if (GNUNET_OK != res)
+ return res;
+ *denom = TALER_amount_ntoh (denom_nbo);
+ return GNUNET_OK;
+}