summaryrefslogtreecommitdiff
path: root/src/backenddb/plugin_merchantdb_postgres.c
diff options
context:
space:
mode:
authorJonathan Buchanan <jonathan.russ.buchanan@gmail.com>2020-06-30 20:03:45 -0400
committerJonathan Buchanan <jonathan.russ.buchanan@gmail.com>2020-06-30 20:03:45 -0400
commit2da3c81f9dacb34ddb6a6f087ec85f6225f5e0d2 (patch)
tree9ebdab00ffe0c136cefd348b43f03d1c80dd9482 /src/backenddb/plugin_merchantdb_postgres.c
parentbd6a7e949fa07c7b4c87a694c0037e2df3903665 (diff)
downloadmerchant-2da3c81f9dacb34ddb6a6f087ec85f6225f5e0d2.tar.gz
merchant-2da3c81f9dacb34ddb6a6f087ec85f6225f5e0d2.tar.bz2
merchant-2da3c81f9dacb34ddb6a6f087ec85f6225f5e0d2.zip
improved db tests for transfers
Diffstat (limited to 'src/backenddb/plugin_merchantdb_postgres.c')
-rw-r--r--src/backenddb/plugin_merchantdb_postgres.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/backenddb/plugin_merchantdb_postgres.c b/src/backenddb/plugin_merchantdb_postgres.c
index ae566021..88944c9f 100644
--- a/src/backenddb/plugin_merchantdb_postgres.c
+++ b/src/backenddb/plugin_merchantdb_postgres.c
@@ -1012,6 +1012,7 @@ postgres_update_product (void *cls,
TALER_PQ_query_param_json (pd->taxes),
TALER_PQ_query_param_amount (&pd->price),
GNUNET_PQ_query_param_uint64 (&pd->total_stock),
+ GNUNET_PQ_query_param_uint64 (&pd->total_sold),
GNUNET_PQ_query_param_uint64 (&pd->total_lost), /* $11 */
TALER_PQ_query_param_json (pd->address),
GNUNET_PQ_query_param_absolute_time (&pd->next_restock),
@@ -6091,18 +6092,20 @@ libtaler_plugin_merchantdb_postgres_init (void *cls)
",price_val=$8"
",price_frac=$9"
",total_stock=$10"
- ",total_lost=$11"
- ",address=$12"
- ",next_restock=$13"
+ ",total_sold=$11"
+ ",total_lost=$12"
+ ",address=$13"
+ ",next_restock=$14"
" WHERE merchant_serial="
" (SELECT merchant_serial"
" FROM merchant_instances"
" WHERE merchant_id=$1)"
" AND product_id=$2"
" AND total_stock <= $10"
- " AND $10 - total_sold >= $11"
- " AND total_lost <= $11",
- 13),
+ " AND total_sold <= $11"
+ " AND $10 - $11 >= $12"
+ " AND total_lost <= $12",
+ 14),
/* for postgres_lock_product() */
GNUNET_PQ_make_prepare ("lock_product",