[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [taler-merchant] branch master updated: adding db method to
From: |
gnunet |
Subject: |
[GNUnet-SVN] [taler-merchant] branch master updated: adding db method to query proposal data "in the future" |
Date: |
Tue, 18 Apr 2017 13:42:50 +0200 |
This is an automated email from the git hooks/post-receive script.
marcello pushed a commit to branch master
in repository merchant.
The following commit(s) were added to refs/heads/master by this push:
new c5cad65 adding db method to query proposal data "in the future"
c5cad65 is described below
commit c5cad65c87b7e41f2549c6ba83be6714f290e0dc
Author: Marcello Stanisci <address@hidden>
AuthorDate: Tue Apr 18 13:42:34 2017 +0200
adding db method to query proposal data "in the future"
---
src/backenddb/plugin_merchantdb_postgres.c | 26 +++++++++++++++++++++++---
src/backenddb/test_merchantdb.c | 28 +++++++++++++++++++++++++++-
2 files changed, 50 insertions(+), 4 deletions(-)
diff --git a/src/backenddb/plugin_merchantdb_postgres.c
b/src/backenddb/plugin_merchantdb_postgres.c
index 303786e..25c997a 100644
--- a/src/backenddb/plugin_merchantdb_postgres.c
+++ b/src/backenddb/plugin_merchantdb_postgres.c
@@ -341,6 +341,21 @@ postgres_initialize (void *cls)
" LIMIT $4",
4);
+ PG_PREPARE (pg,
+ "find_proposal_data_by_date_and_range_future",
+ "SELECT"
+ " proposal_data"
+ ",order_id"
+ ",row_id"
+ " FROM merchant_proposal_data"
+ " 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",
@@ -862,9 +877,14 @@ postgres_find_proposal_data_by_date_and_range (void *cls,
GNUNET_PQ_query_param_end
};
- result = GNUNET_PQ_exec_prepared (pg->conn,
- "find_proposal_data_by_date_and_range",
- params);
+ if (GNUNET_YES == future)
+ result = GNUNET_PQ_exec_prepared (pg->conn,
+
"find_proposal_data_by_date_and_range_future",
+ params);
+ else
+ result = GNUNET_PQ_exec_prepared (pg->conn,
+ "find_proposal_data_by_date_and_range",
+ params);
if (PGRES_TUPLES_OK != PQresultStatus (result))
{
BREAK_DB_ERR (result);
diff --git a/src/backenddb/test_merchantdb.c b/src/backenddb/test_merchantdb.c
index 040fab5..3b95f27 100644
--- a/src/backenddb/test_merchantdb.c
+++ b/src/backenddb/test_merchantdb.c
@@ -71,6 +71,12 @@ static struct GNUNET_HashCode h_wire;
const char *order_id;
/**
+ * Transaction ID used to test the db query
+ * `find_proposal_data_by_date_and_range_future`
+ */
+const char *order_id_future;
+
+/**
* Proposal's hash
*/
struct GNUNET_HashCode h_proposal_data;
@@ -326,10 +332,11 @@ run (void *cls)
RND_BLK (&h_wire);
RND_BLK (&h_proposal_data);
order_id = "test_ID";
+ order_id_future = "test_ID_future";
RND_BLK (&signkey_pub);
RND_BLK (&merchant_pub);
RND_BLK (&wtid);
- timestamp = GNUNET_TIME_absolute_get();
+ timestamp = GNUNET_TIME_absolute_get ();
GNUNET_TIME_round_abs (×tamp);
delta = GNUNET_TIME_UNIT_MINUTES;
fake_now = GNUNET_TIME_absolute_add (timestamp, delta);
@@ -387,6 +394,25 @@ run (void *cls)
GNUNET_NO,
pd_cb,
NULL));
+ timestamp = GNUNET_TIME_absolute_get ();
+ GNUNET_TIME_round_abs (×tamp);
+
+ FAILIF (GNUNET_OK !=
+ plugin->insert_proposal_data (plugin->cls,
+ order_id_future,
+ &merchant_pub,
+ timestamp,
+ proposal_data));
+
+ FAILIF (1 !=
+ plugin->find_proposal_data_by_date_and_range (plugin->cls,
+ fake_now,
+ &merchant_pub,
+ 0,
+ 5,
+ GNUNET_YES,
+ pd_cb,
+ NULL));
FAILIF (1 !=
plugin->find_proposal_data_by_date (plugin->cls,
--
To stop receiving notification emails like this one, please contact
address@hidden
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] [taler-merchant] branch master updated: adding db method to query proposal data "in the future",
gnunet <=