diff options
Diffstat (limited to 'src/backenddb/plugin_merchantdb_postgres.c')
-rw-r--r-- | src/backenddb/plugin_merchantdb_postgres.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/src/backenddb/plugin_merchantdb_postgres.c b/src/backenddb/plugin_merchantdb_postgres.c index d7e35897..830a3182 100644 --- a/src/backenddb/plugin_merchantdb_postgres.c +++ b/src/backenddb/plugin_merchantdb_postgres.c @@ -824,13 +824,12 @@ postgres_insert_account ( const struct TALER_MERCHANTDB_AccountDetails *account_details) { struct PostgresClosure *pg = cls; - uint8_t active = account_details->active; struct GNUNET_PQ_QueryParam params[] = { GNUNET_PQ_query_param_string (id), GNUNET_PQ_query_param_auto_from_type (&account_details->h_wire), GNUNET_PQ_query_param_auto_from_type (&account_details->salt), GNUNET_PQ_query_param_string (account_details->payto_uri), - GNUNET_PQ_query_param_auto_from_type (&active), + GNUNET_PQ_query_param_bool (account_details->active), GNUNET_PQ_query_param_end }; @@ -2088,6 +2087,7 @@ postgres_lookup_contract_terms (void *cls, * @param instance_id instance's identifier * @param order_id order_id used to store * @param contract_terms contract terms to store + * @param[out] order_serial set to the serial of the order * @return transaction status, #GNUNET_DB_STATUS_HARD_ERROR if @a contract_terms * is malformed */ @@ -2095,7 +2095,8 @@ static enum GNUNET_DB_QueryStatus postgres_insert_contract_terms (void *cls, const char *instance_id, const char *order_id, - json_t *contract_terms) + json_t *contract_terms, + uint64_t *order_serial) { struct PostgresClosure *pg = cls; struct GNUNET_TIME_Timestamp pay_deadline; @@ -2148,10 +2149,16 @@ postgres_insert_contract_terms (void *cls, : GNUNET_PQ_query_param_string (fulfillment_url), GNUNET_PQ_query_param_end }; + struct GNUNET_PQ_ResultSpec rs[] = { + GNUNET_PQ_result_spec_uint64 ("order_serial", + order_serial), + GNUNET_PQ_result_spec_end + }; - return GNUNET_PQ_eval_prepared_non_select (pg->conn, - "insert_contract_terms", - params); + return GNUNET_PQ_eval_prepared_singleton_select (pg->conn, + "insert_contract_terms", + params, + rs); } } @@ -8105,7 +8112,8 @@ postgres_connect (void *cls) " AND merchant_serial=" " (SELECT merchant_serial" " FROM merchant_instances" - " WHERE merchant_id=$1)", + " WHERE merchant_id=$1)" + " RETURNING order_serial", 7), /* for postgres_update_contract_terms() */ GNUNET_PQ_make_prepare ("update_contract_terms", |