diff options
author | Marcello Stanisci <marcello.stanisci@inria.fr> | 2015-09-24 10:13:31 +0200 |
---|---|---|
committer | Marcello Stanisci <marcello.stanisci@inria.fr> | 2015-09-24 10:13:31 +0200 |
commit | d8b70e33e6300a168fa35606c5de9723fcd979c4 (patch) | |
tree | f63af4b36829119f850e2d2cab7ccf3300dcf08d /src/backend-lib/merchant_db.c | |
parent | 1e04bb2610bd142aebeb0fd040e649045ec785df (diff) | |
download | merchant-d8b70e33e6300a168fa35606c5de9723fcd979c4.tar.gz merchant-d8b70e33e6300a168fa35606c5de9723fcd979c4.tar.bz2 merchant-d8b70e33e6300a168fa35606c5de9723fcd979c4.zip |
DB query to retrieve the nounce,edate pair based on the
contract hash: tested
Diffstat (limited to 'src/backend-lib/merchant_db.c')
-rw-r--r-- | src/backend-lib/merchant_db.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/backend-lib/merchant_db.c b/src/backend-lib/merchant_db.c index eef10f22..6ee0397b 100644 --- a/src/backend-lib/merchant_db.c +++ b/src/backend-lib/merchant_db.c @@ -138,9 +138,9 @@ MERCHANT_DB_initialize (PGconn *conn, int tmp) EXITIF (NULL == (res = PQprepare (conn, "get_contract_hash", - "SELECT (" - "nounce, edate" - ") FROM contracts " + "SELECT " + "nounce, edate " + "FROM contracts " "WHERE (" "hash=$1" ")", @@ -406,7 +406,7 @@ MERCHANT_DB_get_contract_values (PGconn *conn, TALER_PQ_result_spec_end }; - res = TALER_PQ_exec_prepared (conn, "get_checkout_product", params); + res = TALER_PQ_exec_prepared (conn, "get_contract_hash", params); status = PQresultStatus (res); EXITIF (PGRES_TUPLES_OK != status); @@ -415,6 +415,7 @@ MERCHANT_DB_get_contract_values (PGconn *conn, TALER_LOG_DEBUG ("Contract not found"); goto EXITIF_exit; } + EXITIF (1 != PQntuples (res)); EXITIF (GNUNET_YES != TALER_PQ_extract_result (res, rs, 0)); PQclear (res); |