[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [taler-merchant] 02/04: fix merge issue: proposal_data -> c
From: |
gnunet |
Subject: |
[GNUnet-SVN] [taler-merchant] 02/04: fix merge issue: proposal_data -> contract_terms rename |
Date: |
Sun, 04 Jun 2017 01:08:38 +0200 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository merchant.
commit d3522a172d544cf759258972fa9de14dfb1e2b3f
Merge: 0878d31 fc6ee7d
Author: Christian Grothoff <address@hidden>
AuthorDate: Sun Jun 4 01:06:09 2017 +0200
fix merge issue: proposal_data -> contract_terms rename
doc/Makefile.am | 2 +-
doc/manual.texi | 74 +++++-
doc/version.texi | 4 +-
src/backend/taler-merchant-httpd_history.c | 10 +-
src/backend/taler-merchant-httpd_pay.c | 80 +++---
src/backend/taler-merchant-httpd_proposal.c | 10 +-
.../taler-merchant-httpd_track-transaction.c | 44 ++--
src/backend/taler-merchant-httpd_track-transfer.c | 24 +-
src/backenddb/plugin_merchantdb_postgres.c | 288 +++++++++++----------
src/backenddb/test_merchantdb.c | 74 +++---
src/include/taler_merchant_service.h | 6 +-
src/include/taler_merchantdb_plugin.h | 98 +++----
src/lib/merchant_api_pay.c | 6 +-
src/lib/merchant_api_proposal.c | 12 +-
src/lib/test_merchant_api.c | 30 +--
.../taler-merchant-generate-payments.c | 26 +-
16 files changed, 436 insertions(+), 352 deletions(-)
diff --cc src/backenddb/plugin_merchantdb_postgres.c
index be9983e,34266a7..31b3646
--- a/src/backenddb/plugin_merchantdb_postgres.c
+++ b/src/backenddb/plugin_merchantdb_postgres.c
@@@ -88,17 -142,13 +88,17 @@@ static in
postgres_drop_tables (void *cls)
{
struct PostgresClosure *pg = cls;
+ struct GNUNET_PQ_ExecuteStatement es[] = {
+ GNUNET_PQ_make_try_execute ("DROP TABLE merchant_transfers;"),
+ GNUNET_PQ_make_try_execute ("DROP TABLE merchant_deposits;"),
+ GNUNET_PQ_make_try_execute ("DROP TABLE merchant_transactions;"),
+ GNUNET_PQ_make_try_execute ("DROP TABLE merchant_proofs;"),
- GNUNET_PQ_make_try_execute ("DROP TABLE merchant_proposal_data;"),
++ GNUNET_PQ_make_try_execute ("DROP TABLE merchant_contract_terms;"),
+ GNUNET_PQ_EXECUTE_STATEMENT_END
+ };
- PG_EXEC_INDEX (pg, "DROP TABLE merchant_transfers;");
- PG_EXEC_INDEX (pg, "DROP TABLE merchant_deposits;");
- PG_EXEC_INDEX (pg, "DROP TABLE merchant_transactions;");
- PG_EXEC_INDEX (pg, "DROP TABLE merchant_proofs;");
- PG_EXEC_INDEX (pg, "DROP TABLE merchant_contract_terms;");
- return GNUNET_OK;
+ return GNUNET_PQ_exec_statements (pg->conn,
+ es);
}
@@@ -112,270 -162,284 +112,270 @@@ static in
postgres_initialize (void *cls)
{
struct PostgresClosure *pg = cls;
+ struct GNUNET_PQ_ExecuteStatement es[] = {
- GNUNET_PQ_make_execute ("CREATE TABLE IF NOT EXISTS
merchant_proposal_data ("
++ GNUNET_PQ_make_execute ("CREATE TABLE IF NOT EXISTS
merchant_contract_terms ("
+ "order_id VARCHAR NOT NULL"
+ ",merchant_pub BYTEA NOT NULL"
- ",proposal_data BYTEA NOT NULL"
- ",h_proposal_data BYTEA NOT NULL"
++ ",contract_terms BYTEA NOT NULL"
++ ",h_contract_terms BYTEA NOT NULL"
+ ",timestamp INT8 NOT NULL"
+ ",row_id BIGSERIAL"
+ ",PRIMARY KEY (order_id, merchant_pub)"
+ ");"),
+ GNUNET_PQ_make_execute ("CREATE TABLE IF NOT EXISTS merchant_transactions
("
- " h_proposal_data BYTEA NOT NULL"
++ " h_contract_terms BYTEA NOT NULL"
+ ",exchange_uri VARCHAR NOT NULL"
+ ",merchant_pub BYTEA NOT NULL CHECK
(LENGTH(merchant_pub)=32)"
+ ",h_wire BYTEA NOT NULL CHECK (LENGTH(h_wire)=64)"
+ ",timestamp INT8 NOT NULL"
+ ",refund_deadline INT8 NOT NULL"
+ ",total_amount_val INT8 NOT NULL"
+ ",total_amount_frac INT4 NOT NULL"
+ ",total_amount_curr VARCHAR("
TALER_CURRENCY_LEN_STR ") NOT NULL"
- ",PRIMARY KEY (h_proposal_data, merchant_pub)"
++ ",PRIMARY KEY (h_contract_terms, merchant_pub)"
+ ");"),
+ GNUNET_PQ_make_execute ("CREATE TABLE IF NOT EXISTS merchant_deposits ("
- " h_proposal_data BYTEA NOT NULL"
++ " h_contract_terms BYTEA NOT NULL"
+ ",merchant_pub BYTEA NOT NULL CHECK
(LENGTH(merchant_pub)=32)"
- ",FOREIGN KEY (h_proposal_data, merchant_pub)
REFERENCES merchant_transactions (h_proposal_data, merchant_pub)"
++ ",FOREIGN KEY (h_contract_terms, merchant_pub)
REFERENCES merchant_transactions (h_contract_terms, merchant_pub)"
+ ",coin_pub BYTEA NOT NULL CHECK
(LENGTH(coin_pub)=32)"
+ ",amount_with_fee_val INT8 NOT NULL"
+ ",amount_with_fee_frac INT4 NOT NULL"
+ ",amount_with_fee_curr VARCHAR("
TALER_CURRENCY_LEN_STR ") NOT NULL"
+ ",deposit_fee_val INT8 NOT NULL"
+ ",deposit_fee_frac INT4 NOT NULL"
+ ",deposit_fee_curr VARCHAR("
TALER_CURRENCY_LEN_STR ") NOT NULL"
+ ",signkey_pub BYTEA NOT NULL CHECK
(LENGTH(signkey_pub)=32)"
+ ",exchange_proof BYTEA NOT NULL"
- ",PRIMARY KEY (h_proposal_data, coin_pub)"
++ ",PRIMARY KEY (h_contract_terms, coin_pub)"
+ ");"),
+ GNUNET_PQ_make_execute ("CREATE TABLE IF NOT EXISTS merchant_proofs ("
+ " exchange_uri VARCHAR NOT NULL"
+ ",wtid BYTEA CHECK (LENGTH(wtid)=32)"
+ ",execution_time INT8 NOT NULL"
+ ",signkey_pub BYTEA NOT NULL CHECK
(LENGTH(signkey_pub)=32)"
+ ",proof BYTEA NOT NULL"
+ ",PRIMARY KEY (wtid, exchange_uri)"
+ ");"),
- /* Note that h_proposal_data + coin_pub may actually be unknown to
++ /* Note that h_contract_terms + coin_pub may actually be unknown to
+ us, e.g. someone else deposits something for us at the exchange.
+ Hence those cannot be foreign keys into deposits/transactions! */
+ GNUNET_PQ_make_execute ("CREATE TABLE IF NOT EXISTS merchant_transfers ("
- " h_proposal_data BYTEA NOT NULL"
++ " h_contract_terms BYTEA NOT NULL"
+ ",coin_pub BYTEA NOT NULL CHECK
(LENGTH(coin_pub)=32)"
+ ",wtid BYTEA NOT NULL CHECK (LENGTH(wtid)=32)"
- ",PRIMARY KEY (h_proposal_data, coin_pub)"
++ ",PRIMARY KEY (h_contract_terms, coin_pub)"
+ ");"),
+ GNUNET_PQ_make_try_execute ("CREATE INDEX IF NOT EXISTS
merchant_transfers_by_coin"
- " ON merchant_transfers (h_proposal_data,
coin_pub)"),
++ " ON merchant_transfers (h_contract_terms,
coin_pub)"),
+ GNUNET_PQ_make_try_execute ("CREATE INDEX IF NOT EXISTS
merchant_transfers_by_wtid"
+ " ON merchant_transfers (wtid)"),
+ GNUNET_PQ_EXECUTE_STATEMENT_END
+ };
+ struct GNUNET_PQ_PreparedStatement ps[] = {
+ GNUNET_PQ_make_prepare ("insert_transaction",
+ "INSERT INTO merchant_transactions"
- "(h_proposal_data"
++ "(h_contract_terms"
+ ",exchange_uri"
+ ",merchant_pub"
+ ",h_wire"
+ ",timestamp"
+ ",refund_deadline"
+ ",total_amount_val"
+ ",total_amount_frac"
+ ",total_amount_curr"
+ ") VALUES "
+ "($1, $2, $3, $4, $5, $6, $7, $8, $9)",
+ 9),
+ GNUNET_PQ_make_prepare ("insert_deposit",
+ "INSERT INTO merchant_deposits"
- "(h_proposal_data"
++ "(h_contract_terms"
+ ",merchant_pub"
+ ",coin_pub"
+ ",amount_with_fee_val"
+ ",amount_with_fee_frac"
+ ",amount_with_fee_curr"
+ ",deposit_fee_val"
+ ",deposit_fee_frac"
+ ",deposit_fee_curr"
+ ",signkey_pub"
+ ",exchange_proof) VALUES "
+ "($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11)",
+ 11),
+ GNUNET_PQ_make_prepare ("insert_transfer",
+ "INSERT INTO merchant_transfers"
- "(h_proposal_data"
++ "(h_contract_terms"
+ ",coin_pub"
+ ",wtid) VALUES "
+ "($1, $2, $3)",
+ 3),
+ GNUNET_PQ_make_prepare ("insert_proof",
+ "INSERT INTO merchant_proofs"
+ "(exchange_uri"
+ ",wtid"
+ ",execution_time"
+ ",signkey_pub"
+ ",proof) VALUES "
+ "($1, $2, $3, $4, $5)",
+ 5),
- GNUNET_PQ_make_prepare ("insert_proposal_data",
- "INSERT INTO merchant_proposal_data"
++ GNUNET_PQ_make_prepare ("insert_contract_terms",
++ "INSERT INTO merchant_contract_terms"
+ "(order_id"
+ ",merchant_pub"
+ ",timestamp"
- ",proposal_data"
- ",h_proposal_data)"
++ ",contract_terms"
++ ",h_contract_terms)"
+ " VALUES "
+ "($1, $2, $3, $4, $5)",
+ 4),
- GNUNET_PQ_make_prepare ("find_proposal_data_from_hash",
- "SELECT"
- " proposal_data"
- " FROM merchant_proposal_data"
- " WHERE"
- " h_proposal_data=$1"
- " AND merchant_pub=$2",
- 2),
- GNUNET_PQ_make_prepare ("find_proposal_data",
++ GNUNET_PQ_make_prepare ("find_contract_terms_from_hash",
+ "SELECT"
- " proposal_data"
- " FROM merchant_proposal_data"
++ " contract_terms"
++ " FROM merchant_contract_terms"
++ " WHERE"
++ " h_contract_terms=$1"
++ " AND merchant_pub=$2",
++ 2),
++ GNUNET_PQ_make_prepare ("find_contract_terms",
++ "SELECT"
++ " contract_terms"
++ " FROM merchant_contract_terms"
+ " WHERE"
+ " order_id=$1"
+ " AND merchant_pub=$2",
+ 2),
- GNUNET_PQ_make_prepare ("find_proposal_data_by_date",
++ GNUNET_PQ_make_prepare ("find_contract_terms_by_date",
+ "SELECT"
- " proposal_data"
++ " contract_terms"
+ ",order_id"
+ ",row_id"
- " FROM merchant_proposal_data"
++ " FROM merchant_contract_terms"
+ " WHERE"
+ " timestamp<$1"
+ " AND merchant_pub=$2"
+ " ORDER BY row_id DESC, timestamp DESC"
+ " LIMIT $3",
+ 3),
- GNUNET_PQ_make_prepare ("find_proposal_data_by_date_and_range",
++ GNUNET_PQ_make_prepare ("find_contract_terms_by_date_and_range",
+ "SELECT"
- " proposal_data"
++ " contract_terms"
+ ",order_id"
+ ",row_id"
- " FROM merchant_proposal_data"
++ " FROM merchant_contract_terms"
+ " WHERE"
+ " timestamp<$1"
+ " AND merchant_pub=$2"
+ " AND row_id<$3"
+ " ORDER BY row_id DESC, timestamp DESC"
+ " LIMIT $4",
+ 4),
- GNUNET_PQ_make_prepare ("find_proposal_data_by_date_and_range_future",
++ GNUNET_PQ_make_prepare ("find_contract_terms_by_date_and_range_future",
+ "SELECT"
- " proposal_data"
++ " contract_terms"
+ ",order_id"
+ ",row_id"
- " FROM merchant_proposal_data"
++ " FROM merchant_contract_terms"
+ " WHERE"
+ " timestamp>$1"
+ " AND merchant_pub=$2"
+ " AND row_id>$3"
+ " ORDER BY row_id DESC, timestamp DESC"
+ " LIMIT $4",
+ 4),
+ GNUNET_PQ_make_prepare ("find_transaction",
+ "SELECT"
+ " exchange_uri"
+ ",h_wire"
+ ",timestamp"
+ ",refund_deadline"
+ ",total_amount_val"
+ ",total_amount_frac"
+ ",total_amount_curr"
+ " FROM merchant_transactions"
- " WHERE h_proposal_data=$1"
++ " WHERE h_contract_terms=$1"
+ " AND merchant_pub=$2",
+ 2),
+ GNUNET_PQ_make_prepare ("find_deposits",
+ "SELECT"
+ " coin_pub"
+ ",amount_with_fee_val"
+ ",amount_with_fee_frac"
+ ",amount_with_fee_curr"
+ ",deposit_fee_val"
+ ",deposit_fee_frac"
+ ",deposit_fee_curr"
+ ",exchange_proof"
+ " FROM merchant_deposits"
- " WHERE h_proposal_data=$1"
++ " WHERE h_contract_terms=$1"
+ " AND merchant_pub=$2",
+ 2),
+ GNUNET_PQ_make_prepare ("find_deposits_by_hash_and_coin",
+ "SELECT"
+ " amount_with_fee_val"
+ ",amount_with_fee_frac"
+ ",amount_with_fee_curr"
+ ",deposit_fee_val"
+ ",deposit_fee_frac"
+ ",deposit_fee_curr"
+ ",exchange_proof"
+ " FROM merchant_deposits"
- " WHERE h_proposal_data=$1"
++ " WHERE h_contract_terms=$1"
+ " AND merchant_pub=$2"
+ " AND coin_pub=$3",
+ 3),
+ GNUNET_PQ_make_prepare ("find_transfers_by_hash",
+ "SELECT"
+ " coin_pub"
+ ",wtid"
+ ",merchant_proofs.execution_time"
+ ",merchant_proofs.proof"
+ " FROM merchant_transfers"
+ " JOIN merchant_proofs USING (wtid)"
- " WHERE h_proposal_data=$1",
++ " WHERE h_contract_terms=$1",
+ 1),
+ GNUNET_PQ_make_prepare ("find_deposits_by_wtid",
+ "SELECT"
- " merchant_transfers.h_proposal_data"
++ " merchant_transfers.h_contract_terms"
+ ",merchant_transfers.coin_pub"
+ ",merchant_deposits.amount_with_fee_val"
+ ",merchant_deposits.amount_with_fee_frac"
+ ",merchant_deposits.amount_with_fee_curr"
+ ",merchant_deposits.deposit_fee_val"
+ ",merchant_deposits.deposit_fee_frac"
+ ",merchant_deposits.deposit_fee_curr"
+ ",merchant_deposits.exchange_proof"
+ " FROM merchant_transfers"
+ " JOIN merchant_deposits"
- " ON (merchant_deposits.h_proposal_data =
merchant_transfers.h_proposal_data"
++ " ON (merchant_deposits.h_contract_terms =
merchant_transfers.h_contract_terms"
+ " AND"
+ " merchant_deposits.coin_pub =
merchant_transfers.coin_pub)"
+ " WHERE wtid=$1",
+ 1),
+ GNUNET_PQ_make_prepare ("find_proof_by_wtid",
+ "SELECT"
+ " proof"
+ " FROM merchant_proofs"
+ " WHERE wtid=$1"
+ " AND exchange_uri=$2",
+ 2),
+ GNUNET_PQ_PREPARED_STATEMENT_END
+ };
+
+ if (GNUNET_OK !=
+ GNUNET_PQ_exec_statements (pg->conn,
+ es))
+ {
+ GNUNET_break (0);
+ return GNUNET_SYSERR;
+ }
- /* Setup tables */
- PG_EXEC (pg,
- "CREATE TABLE IF NOT EXISTS merchant_contract_terms ("
- "order_id VARCHAR NOT NULL"
- ",merchant_pub BYTEA NOT NULL"
- ",contract_terms BYTEA NOT NULL"
- ",h_contract_terms BYTEA NOT NULL"
- ",timestamp INT8 NOT NULL"
- ",row_id BIGSERIAL"
- ",PRIMARY KEY (order_id, merchant_pub)"
- ");");
-
- PG_EXEC (pg,
- "CREATE TABLE IF NOT EXISTS merchant_transactions ("
- " h_contract_terms BYTEA NOT NULL"
- ",exchange_uri VARCHAR NOT NULL"
- ",merchant_pub BYTEA NOT NULL CHECK (LENGTH(merchant_pub)=32)"
- ",h_wire BYTEA NOT NULL CHECK (LENGTH(h_wire)=64)"
- ",timestamp INT8 NOT NULL"
- ",refund_deadline INT8 NOT NULL"
- ",total_amount_val INT8 NOT NULL"
- ",total_amount_frac INT4 NOT NULL"
- ",total_amount_curr VARCHAR(" TALER_CURRENCY_LEN_STR ") NOT NULL"
- ",PRIMARY KEY (h_contract_terms, merchant_pub)"
- ");");
- PG_EXEC (pg,
- "CREATE TABLE IF NOT EXISTS merchant_deposits ("
- " h_contract_terms BYTEA NOT NULL"
- ",merchant_pub BYTEA NOT NULL CHECK (LENGTH(merchant_pub)=32)"
- ",FOREIGN KEY (h_contract_terms, merchant_pub) REFERENCES
merchant_transactions (h_contract_terms, merchant_pub)"
- ",coin_pub BYTEA NOT NULL CHECK (LENGTH(coin_pub)=32)"
- ",amount_with_fee_val INT8 NOT NULL"
- ",amount_with_fee_frac INT4 NOT NULL"
- ",amount_with_fee_curr VARCHAR(" TALER_CURRENCY_LEN_STR ") NOT
NULL"
- ",deposit_fee_val INT8 NOT NULL"
- ",deposit_fee_frac INT4 NOT NULL"
- ",deposit_fee_curr VARCHAR(" TALER_CURRENCY_LEN_STR ") NOT NULL"
- ",signkey_pub BYTEA NOT NULL CHECK (LENGTH(signkey_pub)=32)"
- ",exchange_proof BYTEA NOT NULL"
- ",PRIMARY KEY (h_contract_terms, coin_pub)"
- ");");
- PG_EXEC (pg,
- "CREATE TABLE IF NOT EXISTS merchant_proofs ("
- " exchange_uri VARCHAR NOT NULL"
- ",wtid BYTEA CHECK (LENGTH(wtid)=32)"
- ",execution_time INT8 NOT NULL"
- ",signkey_pub BYTEA NOT NULL CHECK (LENGTH(signkey_pub)=32)"
- ",proof BYTEA NOT NULL"
- ",PRIMARY KEY (wtid, exchange_uri)"
- ");");
- /* Note that h_contract_terms + coin_pub may actually be unknown to
- us, e.g. someone else deposits something for us at the exchange.
- Hence those cannot be foreign keys into deposits/transactions! */
- PG_EXEC (pg,
- "CREATE TABLE IF NOT EXISTS merchant_transfers ("
- " h_contract_terms BYTEA NOT NULL"
- ",coin_pub BYTEA NOT NULL CHECK (LENGTH(coin_pub)=32)"
- ",wtid BYTEA NOT NULL CHECK (LENGTH(wtid)=32)"
- ",PRIMARY KEY (h_contract_terms, coin_pub)"
- ");");
- PG_EXEC_INDEX (pg,
- "CREATE INDEX IF NOT EXISTS merchant_transfers_by_coin"
- " ON merchant_transfers (h_contract_terms, coin_pub)");
- PG_EXEC_INDEX (pg,
- "CREATE INDEX IF NOT EXISTS merchant_transfers_by_wtid"
- " ON merchant_transfers (wtid)");
-
- /* Setup prepared "INSERT" statements */
- PG_PREPARE (pg,
- "insert_transaction",
- "INSERT INTO merchant_transactions"
- "(h_contract_terms"
- ",exchange_uri"
- ",merchant_pub"
- ",h_wire"
- ",timestamp"
- ",refund_deadline"
- ",total_amount_val"
- ",total_amount_frac"
- ",total_amount_curr"
- ") VALUES "
- "($1, $2, $3, $4, $5, $6, $7, $8, $9)",
- 9);
- PG_PREPARE (pg,
- "insert_deposit",
- "INSERT INTO merchant_deposits"
- "(h_contract_terms"
- ",merchant_pub"
- ",coin_pub"
- ",amount_with_fee_val"
- ",amount_with_fee_frac"
- ",amount_with_fee_curr"
- ",deposit_fee_val"
- ",deposit_fee_frac"
- ",deposit_fee_curr"
- ",signkey_pub"
- ",exchange_proof) VALUES "
- "($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11)",
- 11);
- PG_PREPARE (pg,
- "insert_transfer",
- "INSERT INTO merchant_transfers"
- "(h_contract_terms"
- ",coin_pub"
- ",wtid) VALUES "
- "($1, $2, $3)",
- 3);
- PG_PREPARE (pg,
- "insert_proof",
- "INSERT INTO merchant_proofs"
- "(exchange_uri"
- ",wtid"
- ",execution_time"
- ",signkey_pub"
- ",proof) VALUES "
- "($1, $2, $3, $4, $5)",
- 5);
-
- PG_PREPARE (pg,
- "insert_contract_terms",
- "INSERT INTO merchant_contract_terms"
- "(order_id"
- ",merchant_pub"
- ",timestamp"
- ",contract_terms"
- ",h_contract_terms)"
- " VALUES "
- "($1, $2, $3, $4, $5)",
- 4);
-
- PG_PREPARE (pg,
- "find_contract_terms_from_hash",
- "SELECT"
- " contract_terms"
- " FROM merchant_contract_terms"
- " WHERE"
- " h_contract_terms=$1"
- " AND merchant_pub=$2",
- 2);
-
- PG_PREPARE (pg,
- "find_contract_terms",
- "SELECT"
- " contract_terms"
- " FROM merchant_contract_terms"
- " WHERE"
- " order_id=$1"
- " AND merchant_pub=$2",
- 2);
-
- PG_PREPARE (pg,
- "find_contract_terms_by_date",
- "SELECT"
- " contract_terms"
- ",order_id"
- ",row_id"
- " FROM merchant_contract_terms"
- " WHERE"
- " timestamp<$1"
- " AND merchant_pub=$2"
- " ORDER BY row_id DESC, timestamp DESC"
- " LIMIT $3",
- 3);
-
- PG_PREPARE (pg,
- "find_contract_terms_by_date_and_range",
- "SELECT"
- " contract_terms"
- ",order_id"
- ",row_id"
- " FROM merchant_contract_terms"
- " WHERE"
- " timestamp<$1"
- " AND merchant_pub=$2"
- " AND row_id<$3"
- " ORDER BY row_id DESC, timestamp DESC"
- " LIMIT $4",
- 4);
-
- PG_PREPARE (pg,
- "find_contract_terms_by_date_and_range_future",
- "SELECT"
- " contract_terms"
- ",order_id"
- ",row_id"
- " FROM merchant_contract_terms"
- " WHERE"
- " timestamp>$1"
- " AND merchant_pub=$2"
- " AND row_id>$3"
- " ORDER BY row_id DESC, timestamp DESC"
- " LIMIT $4",
- 4);
-
- /* Setup prepared "SELECT" statements */
- PG_PREPARE (pg,
- "find_transaction",
- "SELECT"
- " exchange_uri"
- ",h_wire"
- ",timestamp"
- ",refund_deadline"
- ",total_amount_val"
- ",total_amount_frac"
- ",total_amount_curr"
- " FROM merchant_transactions"
- " WHERE h_contract_terms=$1"
- " AND merchant_pub=$2",
- 2);
- PG_PREPARE (pg,
- "find_deposits",
- "SELECT"
- " coin_pub"
- ",amount_with_fee_val"
- ",amount_with_fee_frac"
- ",amount_with_fee_curr"
- ",deposit_fee_val"
- ",deposit_fee_frac"
- ",deposit_fee_curr"
- ",exchange_proof"
- " FROM merchant_deposits"
- " WHERE h_contract_terms=$1"
- " AND merchant_pub=$2",
- 2);
- PG_PREPARE (pg,
- "find_deposits_by_hash_and_coin",
- "SELECT"
- " amount_with_fee_val"
- ",amount_with_fee_frac"
- ",amount_with_fee_curr"
- ",deposit_fee_val"
- ",deposit_fee_frac"
- ",deposit_fee_curr"
- ",exchange_proof"
- " FROM merchant_deposits"
- " WHERE h_contract_terms=$1"
- " AND merchant_pub=$2"
- " AND coin_pub=$3",
- 3);
- PG_PREPARE (pg,
- "find_transfers_by_hash",
- "SELECT"
- " coin_pub"
- ",wtid"
- ",merchant_proofs.execution_time"
- ",merchant_proofs.proof"
- " FROM merchant_transfers"
- " JOIN merchant_proofs USING (wtid)"
- " WHERE h_contract_terms=$1",
- 1);
- PG_PREPARE (pg,
- "find_deposits_by_wtid",
- "SELECT"
- " merchant_transfers.h_contract_terms"
- ",merchant_transfers.coin_pub"
- ",merchant_deposits.amount_with_fee_val"
- ",merchant_deposits.amount_with_fee_frac"
- ",merchant_deposits.amount_with_fee_curr"
- ",merchant_deposits.deposit_fee_val"
- ",merchant_deposits.deposit_fee_frac"
- ",merchant_deposits.deposit_fee_curr"
- ",merchant_deposits.exchange_proof"
- " FROM merchant_transfers"
- " JOIN merchant_deposits"
- " ON (merchant_deposits.h_contract_terms =
merchant_transfers.h_contract_terms"
- " AND"
- " merchant_deposits.coin_pub =
merchant_transfers.coin_pub)"
- " WHERE wtid=$1",
- 1);
- PG_PREPARE (pg,
- "find_proof_by_wtid",
- "SELECT"
- " proof"
- " FROM merchant_proofs"
- " WHERE wtid=$1"
- " AND exchange_uri=$2",
- 2);
+ if (GNUNET_OK !=
+ GNUNET_PQ_prepare_statements (pg->conn,
+ ps))
+ {
+ GNUNET_break (0);
+ return GNUNET_SYSERR;
+ }
return GNUNET_OK;
}
@@@ -642,9 -717,9 +654,8 @@@ postgres_store_deposit (void *cls
struct PostgresClosure *pg = cls;
PGresult *result;
int ret;
--
struct GNUNET_PQ_QueryParam params[] = {
- GNUNET_PQ_query_param_auto_from_type (h_proposal_data),
+ GNUNET_PQ_query_param_auto_from_type (h_contract_terms),
GNUNET_PQ_query_param_auto_from_type (merchant_pub),
GNUNET_PQ_query_param_auto_from_type (coin_pub),
TALER_PQ_query_param_amount (amount_with_fee),
--
To stop receiving notification emails like this one, please contact
address@hidden