gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-merchant] branch master updated: -update to latest GNUNET_PQ_make


From: gnunet
Subject: [taler-merchant] branch master updated: -update to latest GNUNET_PQ_make_prepare() API
Date: Wed, 12 Oct 2022 14:49:06 +0200

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository merchant.

The following commit(s) were added to refs/heads/master by this push:
     new 3ed50485 -update to latest GNUNET_PQ_make_prepare() API
3ed50485 is described below

commit 3ed50485d9acc3a9edeb2d695207cdbe41423a7f
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Wed Oct 12 14:49:04 2022 +0200

    -update to latest GNUNET_PQ_make_prepare() API
---
 src/backenddb/plugin_merchantdb_postgres.c | 378 ++++++++++-------------------
 1 file changed, 126 insertions(+), 252 deletions(-)

diff --git a/src/backenddb/plugin_merchantdb_postgres.c 
b/src/backenddb/plugin_merchantdb_postgres.c
index 1277e05b..8e1491b3 100644
--- a/src/backenddb/plugin_merchantdb_postgres.c
+++ b/src/backenddb/plugin_merchantdb_postgres.c
@@ -6830,15 +6830,13 @@ postgres_connect (void *cls)
   struct PostgresClosure *pg = cls;
   struct GNUNET_PQ_PreparedStatement ps[] = {
     GNUNET_PQ_make_prepare ("end_transaction",
-                            "COMMIT",
-                            0),
+                            "COMMIT"),
     /* for call_with_accounts(), part of postgres_lookup_instances() */
     GNUNET_PQ_make_prepare ("lookup_instance_private_key",
                             "SELECT"
                             " merchant_priv"
                             " FROM merchant_keys"
-                            " WHERE merchant_serial=$1",
-                            1),
+                            " WHERE merchant_serial=$1"),
     /* for find_instances_cb(), part of postgres_lookup_instances() */
     GNUNET_PQ_make_prepare ("lookup_accounts",
                             "SELECT"
@@ -6847,16 +6845,14 @@ postgres_connect (void *cls)
                             ",payto_uri"
                             ",active"
                             " FROM merchant_accounts"
-                            " WHERE merchant_serial=$1",
-                            1),
+                            " WHERE merchant_serial=$1"),
     /* for postgres_lookup_instances() */
     GNUNET_PQ_make_prepare ("lookup_instance_auth",
                             "SELECT"
                             " auth_hash"
                             ",auth_salt"
                             " FROM merchant_instances"
-                            " WHERE merchant_id=$1",
-                            1),
+                            " WHERE merchant_id=$1"),
     /* for postgres_lookup_instances() */
     GNUNET_PQ_make_prepare ("lookup_instances",
                             "SELECT"
@@ -6878,8 +6874,7 @@ postgres_connect (void *cls)
                             ",website"
                             ",email"
                             ",logo"
-                            " FROM merchant_instances",
-                            0),
+                            " FROM merchant_instances"),
     /* for postgres_lookup_instance() */
     GNUNET_PQ_make_prepare ("lookup_instance",
                             "SELECT"
@@ -6902,8 +6897,7 @@ postgres_connect (void *cls)
                             ",email"
                             ",logo"
                             " FROM merchant_instances"
-                            " WHERE merchant_id=$1",
-                            1),
+                            " WHERE merchant_id=$1"),
     /* for postgres_insert_instance() */
     GNUNET_PQ_make_prepare ("insert_instance",
                             "INSERT INTO merchant_instances"
@@ -6925,8 +6919,7 @@ postgres_connect (void *cls)
                             ",email"
                             ",logo)"
                             "VALUES"
-                            "($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, 
$12, $13, $14, $15, $16, $17)",
-                            14),
+                            "($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, 
$12, $13, $14, $15, $16, $17)"),
     /* for postgres_insert_instance() */
     GNUNET_PQ_make_prepare ("insert_keys",
                             "INSERT INTO merchant_keys"
@@ -6934,8 +6927,7 @@ postgres_connect (void *cls)
                             ",merchant_serial)"
                             " SELECT $1, merchant_serial"
                             " FROM merchant_instances"
-                            " WHERE merchant_id=$2",
-                            2),
+                            " WHERE merchant_id=$2"),
     /* for postgres_account_kyc_set_status */
     GNUNET_PQ_make_prepare ("upsert_account_kyc",
                             "INSERT INTO merchant_kyc"
@@ -6957,8 +6949,7 @@ postgres_connect (void *cls)
                             "    ,kyc_timestamp=$5"
                             "    ,kyc_ok=$6"
                             "    ,exchange_pub=$7"
-                            "    ,exchange_sig=$8",
-                            8),
+                            "    ,exchange_sig=$8"),
     /* for postgres_account_kyc_get_status */
     GNUNET_PQ_make_prepare ("lookup_kyc_status",
                             "SELECT"
@@ -6973,8 +6964,7 @@ postgres_connect (void *cls)
                             "   USING (merchant_serial)"
                             " JOIN merchant_kyc"
                             "   USING (account_serial)"
-                            " WHERE merchant_instances.merchant_id=$1",
-                            1),
+                            " WHERE merchant_instances.merchant_id=$1"),
     /* for postgres_insert_account() */
     GNUNET_PQ_make_prepare ("insert_account",
                             "INSERT INTO merchant_accounts"
@@ -6985,21 +6975,18 @@ postgres_connect (void *cls)
                             ",active)"
                             " SELECT merchant_serial, $2, $3, $4, $5"
                             " FROM merchant_instances"
-                            " WHERE merchant_id=$1",
-                            5),
+                            " WHERE merchant_id=$1"),
     /* for postgres_delete_instance_private_key() */
     GNUNET_PQ_make_prepare ("delete_key",
                             "DELETE FROM merchant_keys"
                             " USING merchant_instances"
                             " WHERE merchant_keys.merchant_serial"
                             "   = merchant_instances.merchant_serial"
-                            " AND merchant_instances.merchant_id = $1",
-                            1),
+                            " AND merchant_instances.merchant_id = $1"),
     /* for postgres_purge_instance() */
     GNUNET_PQ_make_prepare ("purge_instance",
                             "DELETE FROM merchant_instances"
-                            " WHERE merchant_instances.merchant_id = $1",
-                            1),
+                            " WHERE merchant_instances.merchant_id = $1"),
     /* for postgres_update_instance() */
     GNUNET_PQ_make_prepare ("update_instance",
                             "UPDATE merchant_instances SET"
@@ -7016,15 +7003,13 @@ postgres_connect (void *cls)
                             ",website=$12"
                             ",email=$13"
                             ",logo=$14"
-                            " WHERE merchant_id = $1",
-                            11),
+                            " WHERE merchant_id = $1"),
     /* for postgres_update_instance_auth() */
     GNUNET_PQ_make_prepare ("update_instance_auth",
                             "UPDATE merchant_instances SET"
                             " auth_hash=$2"
                             ",auth_salt=$3"
-                            " WHERE merchant_id=$1",
-                            3),
+                            " WHERE merchant_id=$1"),
     /* for postgres_inactivate_account(); the merchant
        instance is implied from the random salt that
        is part of the h_wire calculation */
@@ -7035,8 +7020,7 @@ postgres_connect (void *cls)
                             " merchant_serial="
                             "   (SELECT merchant_serial"
                             "      FROM merchant_instances"
-                            "      WHERE merchant_id=$1)",
-                            2),
+                            "      WHERE merchant_id=$1)"),
     /* for postgres_activate_account() */
     GNUNET_PQ_make_prepare ("activate_account",
                             "UPDATE merchant_accounts SET"
@@ -7045,8 +7029,7 @@ postgres_connect (void *cls)
                             " merchant_serial="
                             "   (SELECT merchant_serial"
                             "      FROM merchant_instances"
-                            "      WHERE merchant_id=$1)",
-                            2),
+                            "      WHERE merchant_id=$1)"),
     /* for postgres_lookup_products() */
     GNUNET_PQ_make_prepare ("lookup_products",
                             "SELECT"
@@ -7054,8 +7037,7 @@ postgres_connect (void *cls)
                             " FROM merchant_inventory"
                             " JOIN merchant_instances"
                             "   USING (merchant_serial)"
-                            " WHERE merchant_instances.merchant_id=$1",
-                            1),
+                            " WHERE merchant_instances.merchant_id=$1"),
     /* for postgres_lookup_product() */
     GNUNET_PQ_make_prepare ("lookup_product",
                             "SELECT"
@@ -7076,8 +7058,7 @@ postgres_connect (void *cls)
                             " JOIN merchant_instances"
                             "   USING (merchant_serial)"
                             " WHERE merchant_instances.merchant_id=$1"
-                            "   AND merchant_inventory.product_id=$2",
-                            2),
+                            "   AND merchant_inventory.product_id=$2"),
     /* for postgres_delete_product() */
     GNUNET_PQ_make_prepare ("delete_product",
                             "DELETE"
@@ -7090,8 +7071,7 @@ postgres_connect (void *cls)
                             "   AND product_serial NOT IN "
                             "     (SELECT product_serial FROM 
merchant_order_locks)"
                             "   AND product_serial NOT IN "
-                            "     (SELECT product_serial FROM 
merchant_inventory_locks)",
-                            2),
+                            "     (SELECT product_serial FROM 
merchant_inventory_locks)"),
     /* for postgres_insert_product() */
     GNUNET_PQ_make_prepare ("insert_product",
                             "INSERT INTO merchant_inventory"
@@ -7112,8 +7092,7 @@ postgres_connect (void *cls)
                             " SELECT merchant_serial,"
                             " $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, 
$13"
                             " FROM merchant_instances"
-                            " WHERE merchant_id=$1",
-                            13),
+                            " WHERE merchant_id=$1"),
     /* for postgres_update_product() */
     GNUNET_PQ_make_prepare ("update_product",
                             "UPDATE merchant_inventory SET"
@@ -7135,8 +7114,7 @@ postgres_connect (void *cls)
                             "      WHERE merchant_id=$1)"
                             "   AND product_id=$2"
                             "   AND total_stock <= $10"
-                            "   AND total_lost <= $11",
-                            14),
+                            "   AND total_lost <= $11"),
 
     /* for postgres_lock_product() */
     GNUNET_PQ_make_prepare ("lock_product",
@@ -7163,25 +7141,21 @@ postgres_connect (void *cls)
                             "        WHERE product_serial=ps.product_serial) + 
"
                             "     (SELECT COALESCE(SUM(total_locked), 0)"
                             "        FROM merchant_order_locks"
-                            "        WHERE product_serial=ps.product_serial)",
-                            5),
+                            "        WHERE product_serial=ps.product_serial)"),
 
     /* for postgres_expire_locks() */
     GNUNET_PQ_make_prepare ("unlock_products",
                             "DELETE FROM merchant_inventory_locks"
-                            " WHERE expiration < $1",
-                            1),
+                            " WHERE expiration < $1"),
     /* for postgres_expire_locks() */
     GNUNET_PQ_make_prepare ("unlock_orders",
                             "DELETE FROM merchant_orders"
-                            " WHERE pay_deadline < $1",
-                            1),
+                            " WHERE pay_deadline < $1"),
     /* for postgres_expire_locks() */
     GNUNET_PQ_make_prepare ("unlock_contracts",
                             "DELETE FROM merchant_contract_terms"
                             " WHERE NOT paid"
-                            "   AND pay_deadline < $1",
-                            1),
+                            "   AND pay_deadline < $1"),
 
     /* for postgres_delete_order() */
     GNUNET_PQ_make_prepare ("delete_order",
@@ -7200,8 +7174,7 @@ postgres_connect (void *cls)
                             "   AND merchant_serial=(SELECT merchant_serial 
FROM ms)"
                             "   AND (  (pay_deadline < $3)"
                             "       OR (NOT EXISTS (SELECT paid FROM mc))"
-                            "       OR ($4 AND (FALSE=(SELECT paid FROM mc))) 
);",
-                            4),
+                            "       OR ($4 AND (FALSE=(SELECT paid FROM mc))) 
);"),
     GNUNET_PQ_make_prepare ("delete_contract",
                             "DELETE"
                             " FROM merchant_contract_terms"
@@ -7210,8 +7183,7 @@ postgres_connect (void *cls)
                             "     (SELECT merchant_serial "
                             "        FROM merchant_instances"
                             "        WHERE merchant_id=$1)"
-                            "   AND NOT paid;",
-                            2),
+                            "   AND NOT paid;"),
     /* for postgres_lookup_order() */
     GNUNET_PQ_make_prepare ("lookup_order",
                             "SELECT"
@@ -7223,8 +7195,7 @@ postgres_connect (void *cls)
                             "     (SELECT merchant_serial "
                             "        FROM merchant_instances"
                             "        WHERE merchant_id=$1)"
-                            "   AND merchant_orders.order_id=$2",
-                            2),
+                            "   AND merchant_orders.order_id=$2"),
     /* for postgres_lookup_order_summary() */
     GNUNET_PQ_make_prepare ("lookup_order_summary",
                             "(SELECT"
@@ -7245,8 +7216,7 @@ postgres_connect (void *cls)
                             "     (SELECT merchant_serial "
                             "        FROM merchant_instances"
                             "        WHERE merchant_id=$1)"
-                            "   AND merchant_orders.order_id=$2)",
-                            2),
+                            "   AND merchant_orders.order_id=$2)"),
     /* for postgres_lookup_orders() */
     GNUNET_PQ_make_prepare ("lookup_orders_inc",
                             "(SELECT"
@@ -7287,8 +7257,7 @@ postgres_connect (void *cls)
                             " ORDER BY order_serial ASC"
                             " LIMIT $2)"
                             " ORDER BY order_serial ASC"
-                            " LIMIT $2",
-                            7),
+                            " LIMIT $2"),
     GNUNET_PQ_make_prepare ("lookup_orders_inc_paid",
                             "(SELECT"
                             " order_id"
@@ -7334,8 +7303,7 @@ postgres_connect (void *cls)
                             " ORDER BY order_serial ASC"
                             " LIMIT $2)"
                             " ORDER BY order_serial ASC"
-                            " LIMIT $2",
-                            7),
+                            " LIMIT $2"),
     GNUNET_PQ_make_prepare ("lookup_orders_inc_refunded",
                             "(SELECT"
                             " order_id"
@@ -7383,8 +7351,7 @@ postgres_connect (void *cls)
                             " ORDER BY order_serial ASC"
                             " LIMIT $2)"
                             " ORDER BY order_serial ASC"
-                            " LIMIT $2",
-                            7),
+                            " LIMIT $2"),
     GNUNET_PQ_make_prepare ("lookup_orders_inc_wired",
                             "(SELECT"
                             " order_id"
@@ -7430,8 +7397,7 @@ postgres_connect (void *cls)
                             " ORDER BY order_serial ASC"
                             " LIMIT $2)"
                             " ORDER BY order_serial ASC"
-                            " LIMIT $2",
-                            7),
+                            " LIMIT $2"),
     GNUNET_PQ_make_prepare ("lookup_orders_inc_paid_refunded",
                             "(SELECT"
                             " order_id"
@@ -7481,8 +7447,7 @@ postgres_connect (void *cls)
                             " ORDER BY order_serial ASC"
                             " LIMIT $2)"
                             " ORDER BY order_serial ASC"
-                            " LIMIT $2",
-                            7),
+                            " LIMIT $2"),
     GNUNET_PQ_make_prepare ("lookup_orders_inc_paid_wired",
                             "(SELECT"
                             " order_id"
@@ -7530,8 +7495,7 @@ postgres_connect (void *cls)
                             " ORDER BY order_serial ASC"
                             " LIMIT $2)"
                             " ORDER BY order_serial ASC"
-                            " LIMIT $2",
-                            7),
+                            " LIMIT $2"),
     GNUNET_PQ_make_prepare ("lookup_orders_inc_refunded_wired",
                             "(SELECT"
                             " order_id"
@@ -7581,8 +7545,7 @@ postgres_connect (void *cls)
                             " ORDER BY order_serial ASC"
                             " LIMIT $2)"
                             " ORDER BY order_serial ASC"
-                            " LIMIT $2",
-                            7),
+                            " LIMIT $2"),
     GNUNET_PQ_make_prepare ("lookup_orders_inc_paid_refunded_wired",
                             "(SELECT"
                             " order_id"
@@ -7634,8 +7597,7 @@ postgres_connect (void *cls)
                             " ORDER BY order_serial ASC"
                             " LIMIT $2)"
                             " ORDER BY order_serial ASC"
-                            " LIMIT $2",
-                            7),
+                            " LIMIT $2"),
     GNUNET_PQ_make_prepare ("lookup_orders_dec",
                             "(SELECT"
                             " order_id"
@@ -7675,8 +7637,7 @@ postgres_connect (void *cls)
                             " ORDER BY order_serial DESC"
                             " LIMIT $2)"
                             " ORDER BY order_serial DESC"
-                            " LIMIT $2",
-                            7),
+                            " LIMIT $2"),
     GNUNET_PQ_make_prepare ("lookup_orders_dec_paid",
                             "(SELECT"
                             " order_id"
@@ -7722,8 +7683,7 @@ postgres_connect (void *cls)
                             " ORDER BY order_serial DESC"
                             " LIMIT $2)"
                             " ORDER BY order_serial DESC"
-                            " LIMIT $2",
-                            7),
+                            " LIMIT $2"),
     GNUNET_PQ_make_prepare ("lookup_orders_dec_refunded",
                             "(SELECT"
                             " order_id"
@@ -7771,8 +7731,7 @@ postgres_connect (void *cls)
                             " ORDER BY order_serial DESC"
                             " LIMIT $2)"
                             " ORDER BY order_serial DESC"
-                            " LIMIT $2",
-                            7),
+                            " LIMIT $2"),
     GNUNET_PQ_make_prepare ("lookup_orders_dec_wired",
                             "(SELECT"
                             " order_id"
@@ -7818,8 +7777,7 @@ postgres_connect (void *cls)
                             " ORDER BY order_serial DESC"
                             " LIMIT $2)"
                             " ORDER BY order_serial DESC"
-                            " LIMIT $2",
-                            7),
+                            " LIMIT $2"),
     GNUNET_PQ_make_prepare ("lookup_orders_dec_paid_refunded",
                             "(SELECT"
                             " order_id"
@@ -7869,8 +7827,7 @@ postgres_connect (void *cls)
                             " ORDER BY order_serial DESC"
                             " LIMIT $2)"
                             " ORDER BY order_serial DESC"
-                            " LIMIT $2",
-                            7),
+                            " LIMIT $2"),
     GNUNET_PQ_make_prepare ("lookup_orders_dec_paid_wired",
                             "(SELECT"
                             " order_id"
@@ -7918,8 +7875,7 @@ postgres_connect (void *cls)
                             " ORDER BY order_serial DESC"
                             " LIMIT $2)"
                             " ORDER BY order_serial DESC"
-                            " LIMIT $2",
-                            7),
+                            " LIMIT $2"),
     GNUNET_PQ_make_prepare ("lookup_orders_dec_refunded_wired",
                             "(SELECT"
                             " order_id"
@@ -7969,8 +7925,7 @@ postgres_connect (void *cls)
                             " ORDER BY order_serial DESC"
                             " LIMIT $2)"
                             " ORDER BY order_serial DESC"
-                            " LIMIT $2",
-                            7),
+                            " LIMIT $2"),
     GNUNET_PQ_make_prepare ("lookup_orders_dec_paid_refunded_wired",
                             "(SELECT"
                             " order_id"
@@ -8022,8 +7977,7 @@ postgres_connect (void *cls)
                             " ORDER BY order_serial DESC"
                             " LIMIT $2)"
                             " ORDER BY order_serial DESC"
-                            " LIMIT $2",
-                            7),
+                            " LIMIT $2"),
     /* for postgres_insert_order() */
     GNUNET_PQ_make_prepare ("insert_order",
                             "INSERT INTO merchant_orders"
@@ -8037,14 +7991,12 @@ postgres_connect (void *cls)
                             " SELECT merchant_serial,"
                             " $2, $3, $4, $5, $6, $7"
                             " FROM merchant_instances"
-                            " WHERE merchant_id=$1",
-                            7),
+                            " WHERE merchant_id=$1"),
     /* for postgres_unlock_inventory() */
     GNUNET_PQ_make_prepare ("unlock_inventory",
                             "DELETE"
                             " FROM merchant_inventory_locks"
-                            " WHERE lock_uuid=$1",
-                            1),
+                            " WHERE lock_uuid=$1"),
     /* for postgres_insert_order_lock() */
     GNUNET_PQ_make_prepare ("insert_order_lock",
                             "WITH tmp AS"
@@ -8074,8 +8026,7 @@ postgres_connect (void *cls)
                             "        WHERE product_serial=tmp.product_serial) 
+ "
                             "     (SELECT COALESCE(SUM(total_locked), 0)"
                             "        FROM merchant_order_locks"
-                            "        WHERE product_serial=tmp.product_serial)",
-                            4),
+                            "        WHERE 
product_serial=tmp.product_serial)"),
     /* for postgres_lookup_contract_terms() */
     GNUNET_PQ_make_prepare ("lookup_contract_terms",
                             "SELECT"
@@ -8088,8 +8039,7 @@ postgres_connect (void *cls)
                             "   AND merchant_serial="
                             "     (SELECT merchant_serial"
                             "        FROM merchant_instances"
-                            "        WHERE merchant_id=$1)",
-                            2),
+                            "        WHERE merchant_id=$1)"),
     /* for postgres_insert_contract_terms() */
     GNUNET_PQ_make_prepare ("insert_contract_terms",
                             "INSERT INTO merchant_contract_terms"
@@ -8120,8 +8070,7 @@ postgres_connect (void *cls)
                             "     (SELECT merchant_serial"
                             "        FROM merchant_instances"
                             "        WHERE merchant_id=$1)"
-                            " RETURNING order_serial",
-                            7),
+                            " RETURNING order_serial"),
     /* for postgres_update_contract_terms() */
     GNUNET_PQ_make_prepare ("update_contract_terms",
                             "UPDATE merchant_contract_terms SET"
@@ -8134,8 +8083,7 @@ postgres_connect (void *cls)
                             "   AND merchant_serial="
                             "     (SELECT merchant_serial"
                             "        FROM merchant_instances"
-                            "        WHERE merchant_id=$1)",
-                            7),
+                            "        WHERE merchant_id=$1)"),
     /* for postgres_delete_contract_terms() */
     GNUNET_PQ_make_prepare ("delete_contract_terms",
                             "DELETE FROM merchant_contract_terms"
@@ -8146,8 +8094,7 @@ postgres_connect (void *cls)
                             "        WHERE merchant_id=$1)"
                             "   AND ( ( (pay_deadline < $4) AND"
                             "           (NOT paid) ) OR"
-                            "         (creation_time + $3 < $4) )",
-                            4),
+                            "         (creation_time + $3 < $4) )"),
     /* for postgres_lookup_deposits() */
     GNUNET_PQ_make_prepare ("lookup_deposits",
                             "SELECT"
@@ -8169,8 +8116,7 @@ postgres_connect (void *cls)
                             "          AND merchant_serial="
                             "          (SELECT merchant_serial"
                             "             FROM merchant_instances"
-                            "            WHERE merchant_id=$1))",
-                            2),
+                            "            WHERE merchant_id=$1))"),
     /* for postgres_insert_exchange_signkey() */
     GNUNET_PQ_make_prepare ("insert_exchange_signkey",
                             "INSERT INTO merchant_exchange_signing_keys"
@@ -8181,8 +8127,7 @@ postgres_connect (void *cls)
                             ",end_date"
                             ",master_sig)"
                             "VALUES"
-                            "($1, $2, $3, $4, $5, $6)",
-                            6),
+                            "($1, $2, $3, $4, $5, $6)"),
     /* for postgres_insert_deposit() */
     GNUNET_PQ_make_prepare ("insert_deposit",
                             "WITH md AS"
@@ -8223,8 +8168,7 @@ postgres_connect (void *cls)
                             "  FROM merchant_contract_terms"
                             "   JOIN md USING (merchant_serial)"
                             "   FULL OUTER JOIN ed ON TRUE"
-                            "  WHERE h_contract_terms=$2",
-                            16),
+                            "  WHERE h_contract_terms=$2"),
     /* for postgres_lookup_refunds() */
     GNUNET_PQ_make_prepare ("lookup_refunds",
                             "SELECT"
@@ -8239,8 +8183,7 @@ postgres_connect (void *cls)
                             "      AND merchant_serial="
                             "        (SELECT merchant_serial"
                             "           FROM merchant_instances"
-                            "          WHERE merchant_id=$1))",
-                            2),
+                            "          WHERE merchant_id=$1))"),
     /* for postgres_mark_contract_paid() */
     GNUNET_PQ_make_prepare ("mark_contract_paid",
                             "UPDATE merchant_contract_terms SET"
@@ -8250,8 +8193,7 @@ postgres_connect (void *cls)
                             "   AND merchant_serial="
                             "     (SELECT merchant_serial"
                             "        FROM merchant_instances"
-                            "       WHERE merchant_id=$1)",
-                            3),
+                            "       WHERE merchant_id=$1)"),
     /* for postgres_mark_contract_paid() */
     GNUNET_PQ_make_prepare ("mark_inventory_sold",
                             "UPDATE merchant_inventory SET"
@@ -8268,8 +8210,7 @@ postgres_connect (void *cls)
                             "             WHERE merchant_id=$1))"
                             "       ) AS order_locks"
                             " WHERE merchant_inventory.product_serial"
-                            "             =order_locks.product_serial",
-                            2),
+                            "             =order_locks.product_serial"),
     /* for postgres_mark_contract_paid() */
     GNUNET_PQ_make_prepare ("delete_completed_order",
                             "WITH md AS"
@@ -8282,8 +8223,7 @@ postgres_connect (void *cls)
                             "       (SELECT order_serial"
                             "          FROM merchant_contract_terms"
                             "          JOIN md USING (merchant_serial)"
-                            "         WHERE h_contract_terms=$2)",
-                            2),
+                            "         WHERE h_contract_terms=$2)"),
     /* for postgres_refund_coin() */
     GNUNET_PQ_make_prepare ("refund_coin",
                             "INSERT INTO merchant_refunds"
@@ -8312,8 +8252,7 @@ postgres_connect (void *cls)
                             "      AND merchant_serial="
                             "        (SELECT merchant_serial"
                             "           FROM merchant_instances"
-                            "          WHERE merchant_id=$1))",
-                            5),
+                            "          WHERE merchant_id=$1))"),
 
     /* for postgres_lookup_order_status() */
     GNUNET_PQ_make_prepare ("lookup_order_status",
@@ -8325,8 +8264,7 @@ postgres_connect (void *cls)
                             "     (SELECT merchant_serial "
                             "        FROM merchant_instances"
                             "        WHERE merchant_id=$1)"
-                            "   AND order_id=$2",
-                            2),
+                            "   AND order_id=$2"),
 
     /* for postgres_lookup_order_status_by_serial() */
     GNUNET_PQ_make_prepare ("lookup_order_status_by_serial",
@@ -8339,8 +8277,7 @@ postgres_connect (void *cls)
                             "     (SELECT merchant_serial "
                             "        FROM merchant_instances"
                             "        WHERE merchant_id=$1)"
-                            "   AND order_serial=$2",
-                            2),
+                            "   AND order_serial=$2"),
 
     /* for postgres_lookup_payment_status() */
     GNUNET_PQ_make_prepare ("lookup_payment_status",
@@ -8348,8 +8285,7 @@ postgres_connect (void *cls)
                             " wired"
                             ",paid"
                             " FROM merchant_contract_terms"
-                            " WHERE order_serial=$1",
-                            1),
+                            " WHERE order_serial=$1"),
     /* for postgres_lookup_payment_status() */
     GNUNET_PQ_make_prepare ("lookup_payment_status_session_id",
                             "SELECT"
@@ -8357,8 +8293,7 @@ postgres_connect (void *cls)
                             ",paid"
                             " FROM merchant_contract_terms"
                             " WHERE order_serial=$1"
-                            "   AND session_id=$2",
-                            2),
+                            "   AND session_id=$2"),
     /* for postgres_lookup_deposits_by_order() */
     GNUNET_PQ_make_prepare ("lookup_deposits_by_order",
                             "SELECT"
@@ -8372,8 +8307,7 @@ postgres_connect (void *cls)
                             ",coin_pub"
                             " FROM merchant_deposits"
                             "  JOIN merchant_accounts USING (account_serial)"
-                            " WHERE order_serial=$1",
-                            1),
+                            " WHERE order_serial=$1"),
     /* for postgres_lookup_transfer_details_by_order() */
     GNUNET_PQ_make_prepare ("lookup_transfer_details_by_order",
                             "SELECT"
@@ -8392,8 +8326,7 @@ postgres_connect (void *cls)
                             " WHERE deposit_serial IN"
                             "  (SELECT deposit_serial"
                             "   FROM merchant_deposits"
-                            "   WHERE order_serial=$1)",
-                            1),
+                            "   WHERE order_serial=$1)"),
     /* for postgres_insert_deposit_to_transfer() */
     GNUNET_PQ_make_prepare ("insert_deposit_to_transfer",
                             "INSERT INTO merchant_deposit_to_transfer"
@@ -8408,14 +8341,12 @@ postgres_connect (void *cls)
                             " FROM merchant_transfers"
                             " CROSS JOIN merchant_exchange_signing_keys"
                             " WHERE exchange_pub=$6"
-                            "   AND wtid=$7",
-                            7),
+                            "   AND wtid=$7"),
     /* for postgres_mark_order_wired() */
     GNUNET_PQ_make_prepare ("mark_order_wired",
                             "UPDATE merchant_contract_terms SET"
                             " wired=true"
-                            " WHERE order_serial=$1",
-                            1),
+                            " WHERE order_serial=$1"),
     /* for process_refund_cb() used in postgres_increase_refund() */
     GNUNET_PQ_make_prepare ("find_refunds_by_coin",
                             "SELECT"
@@ -8424,8 +8355,7 @@ postgres_connect (void *cls)
                             ",rtransaction_id"
                             " FROM merchant_refunds"
                             " WHERE coin_pub=$1"
-                            "   AND order_serial=$2",
-                            2),
+                            "   AND order_serial=$2"),
     /* for process_deposits_for_refund_cb() used in postgres_increase_refund() 
*/
     GNUNET_PQ_make_prepare ("insert_refund",
                             "INSERT INTO merchant_refunds"
@@ -8437,8 +8367,7 @@ postgres_connect (void *cls)
                             ",refund_amount_val"
                             ",refund_amount_frac"
                             ") VALUES"
-                            "($1, $2, $3, $4, $5, $6, $7)",
-                            7),
+                            "($1, $2, $3, $4, $5, $6, $7)"),
     /* for postgres_increase_refund() */
     GNUNET_PQ_make_prepare ("find_deposits_for_refund",
                             "SELECT"
@@ -8455,8 +8384,7 @@ postgres_connect (void *cls)
                             "      AND merchant_serial="
                             "        (SELECT merchant_serial"
                             "           FROM merchant_instances"
-                            "          WHERE merchant_id=$1))",
-                            2),
+                            "          WHERE merchant_id=$1))"),
     /* for postgres_lookup_refunds_detailed() */
     GNUNET_PQ_make_prepare ("lookup_refunds_detailed",
                             "SELECT"
@@ -8479,8 +8407,7 @@ postgres_connect (void *cls)
                             "      AND merchant_serial="
                             "        (SELECT merchant_serial"
                             "           FROM merchant_instances"
-                            "          WHERE merchant_id=$1))",
-                            2),
+                            "          WHERE merchant_id=$1))"),
     /* for postgres_insert_refund_proof() */
     GNUNET_PQ_make_prepare ("insert_refund_proof",
                             "INSERT INTO merchant_refund_proofs"
@@ -8491,8 +8418,7 @@ postgres_connect (void *cls)
                             " FROM merchant_exchange_signing_keys"
                             " WHERE exchange_pub=$3"
                             "  ORDER BY start_date DESC"
-                            "  LIMIT 1",
-                            5),
+                            "  LIMIT 1"),
     /* for postgres_lookup_refund_proof() */
     GNUNET_PQ_make_prepare ("lookup_refund_proof",
                             "SELECT"
@@ -8502,8 +8428,7 @@ postgres_connect (void *cls)
                             "  JOIN merchant_exchange_signing_keys"
                             "    USING (signkey_serial)"
                             " WHERE"
-                            "   refund_serial=$1",
-                            1),
+                            "   refund_serial=$1"),
     /* for postgres_lookup_order_by_fulfillment() */
     GNUNET_PQ_make_prepare ("lookup_order_by_fulfillment",
                             "SELECT"
@@ -8514,8 +8439,7 @@ postgres_connect (void *cls)
                             "   AND merchant_serial="
                             "        (SELECT merchant_serial"
                             "           FROM merchant_instances"
-                            "          WHERE merchant_id=$1)",
-                            3),
+                            "          WHERE merchant_id=$1)"),
     /* for postgres_insert_transfer() */
     GNUNET_PQ_make_prepare ("insert_transfer",
                             "INSERT INTO merchant_transfers"
@@ -8532,8 +8456,7 @@ postgres_connect (void *cls)
                             "   AND merchant_serial="
                             "        (SELECT merchant_serial"
                             "           FROM merchant_instances"
-                            "          WHERE merchant_id=$7)",
-                            7),
+                            "          WHERE merchant_id=$7)"),
     /* for postgres_delete_transfer() */
     GNUNET_PQ_make_prepare ("delete_transfer",
                             "DELETE FROM merchant_transfers"
@@ -8545,8 +8468,7 @@ postgres_connect (void *cls)
                             "    WHERE merchant_serial="
                             "     (SELECT merchant_serial"
                             "        FROM merchant_instances"
-                            "       WHERE merchant_id=$1))",
-                            2),
+                            "       WHERE merchant_id=$1))"),
     /* for postgres_check_transfer_exists() */
     GNUNET_PQ_make_prepare ("check_transfer_exists",
                             "SELECT"
@@ -8560,8 +8482,7 @@ postgres_connect (void *cls)
                             "   merchant_serial="
                             "     (SELECT merchant_serial"
                             "        FROM merchant_instances"
-                            "       WHERE merchant_id=$1)",
-                            2),
+                            "       WHERE merchant_id=$1)"),
     /* for postgres_lookup_account() */
     GNUNET_PQ_make_prepare ("lookup_account",
                             "SELECT"
@@ -8571,8 +8492,7 @@ postgres_connect (void *cls)
                             "   AND merchant_serial="
                             "        (SELECT merchant_serial"
                             "           FROM merchant_instances"
-                            "          WHERE merchant_id=$1)",
-                            2),
+                            "          WHERE merchant_id=$1)"),
     /* for postgres_insert_transfer_details() */
     GNUNET_PQ_make_prepare ("lookup_credit_serial",
                             "SELECT"
@@ -8588,8 +8508,7 @@ postgres_connect (void *cls)
                             "            AND merchant_serial="
                             "            (SELECT merchant_serial"
                             "               FROM merchant_instances"
-                            "              WHERE merchant_id=$3))",
-                            4),
+                            "              WHERE merchant_id=$3))"),
     /* for postgres_insert_transfer_details() */
     GNUNET_PQ_make_prepare ("insert_transfer_signature",
                             "INSERT INTO merchant_transfer_signatures"
@@ -8605,8 +8524,7 @@ postgres_connect (void *cls)
                             " FROM merchant_exchange_signing_keys"
                             " WHERE exchange_pub=$8"
                             "  ORDER BY start_date DESC"
-                            "  LIMIT 1",
-                            8),
+                            "  LIMIT 1"),
     /* for postgres_insert_transfer_details() */
     GNUNET_PQ_make_prepare ("insert_transfer_to_coin_mapping",
                             "INSERT INTO merchant_transfer_to_coin"
@@ -8625,8 +8543,7 @@ postgres_connect (void *cls)
                             "   AND merchant_serial="
                             "     (SELECT merchant_serial"
                             "        FROM merchant_instances"
-                            "       WHERE merchant_id=$9)",
-                            9),
+                            "       WHERE merchant_id=$9)"),
     /* for postgres_insert_transfer_details() */
     GNUNET_PQ_make_prepare ("update_wired_by_coin_pub",
                             "WITH os AS" /* select orders affected by the coin 
*/
@@ -8646,8 +8563,7 @@ postgres_connect (void *cls)
                             "         JOIN os USING (order_serial)" /* filter 
early */
                             "         JOIN merchant_deposit_to_transfer USING 
(deposit_serial)"
                             "         JOIN merchant_transfers USING 
(credit_serial)"
-                            "        WHERE confirmed=TRUE)))",
-                            1),
+                            "        WHERE confirmed=TRUE)))"),
     /* for postgres_lookup_wire_fee() */
     GNUNET_PQ_make_prepare ("lookup_wire_fee",
                             "SELECT"
@@ -8664,8 +8580,7 @@ postgres_connect (void *cls)
                             " WHERE master_pub=$1"
                             "   AND h_wire_method=$2"
                             "   AND start_date <= $3"
-                            "   AND end_date > $3",
-                            3),
+                            "   AND end_date > $3"),
     /* for postgres_lookup_deposits_by_contract_and_coin() */
     GNUNET_PQ_make_prepare ("lookup_deposits_by_contract_and_coin",
                             "SELECT"
@@ -8692,8 +8607,7 @@ postgres_connect (void *cls)
                             "   AND merchant_contract_terms.merchant_serial="
                             "     (SELECT merchant_serial"
                             "        FROM merchant_instances"
-                            "       WHERE merchant_id=$1)",
-                            3),
+                            "       WHERE merchant_id=$1)"),
     /* for postgres_lookup_transfer() */
     GNUNET_PQ_make_prepare ("lookup_transfer",
                             "SELECT"
@@ -8711,15 +8625,13 @@ postgres_connect (void *cls)
                             "  LEFT JOIN merchant_transfer_signatures mts 
USING (credit_serial)"
                             " WHERE wtid=$2"
                             "   AND exchange_url=$1"
-                            "   AND merchant_id=$3;",
-                            3),
+                            "   AND merchant_id=$3;"),
     /* for postgres_set_transfer_status_to_verified() */
     GNUNET_PQ_make_prepare ("set_transfer_status_to_verified",
                             "UPDATE merchant_transfers SET"
                             " verified=TRUE"
                             " WHERE wtid=$1"
-                            "   AND exchange_url=$2",
-                            2),
+                            "   AND exchange_url=$2"),
     /* for postgres_lookup_transfer_summary() */
     GNUNET_PQ_make_prepare ("lookup_transfer_summary",
                             "SELECT"
@@ -8733,8 +8645,7 @@ postgres_connect (void *cls)
                             "  JOIN merchant_deposits USING (deposit_serial)"
                             "  JOIN merchant_contract_terms USING 
(order_serial)"
                             " WHERE wtid=$2"
-                            "   AND merchant_transfers.exchange_url=$1",
-                            2),
+                            "   AND merchant_transfers.exchange_url=$1"),
     /* for postgres_lookup_transfer_details() */
     GNUNET_PQ_make_prepare ("lookup_transfer_details",
                             "SELECT"
@@ -8750,8 +8661,7 @@ postgres_connect (void *cls)
                             "  JOIN merchant_contract_terms USING 
(order_serial)"
                             "  JOIN merchant_transfers USING (credit_serial)"
                             " WHERE merchant_transfers.wtid=$2"
-                            "   AND merchant_transfers.exchange_url=$1",
-                            2),
+                            "   AND merchant_transfers.exchange_url=$1"),
     /* for postgres_lookup_transfers() */
     GNUNET_PQ_make_prepare ("lookup_transfers_time_payto_asc",
                             "SELECT"
@@ -8776,8 +8686,7 @@ postgres_connect (void *cls)
                             "        FROM merchant_instances"
                             "       WHERE merchant_id=$1)"
                             " ORDER BY credit_serial ASC"
-                            " LIMIT $5",
-                            6),
+                            " LIMIT $5"),
     /* for postgres_lookup_transfers() */
     GNUNET_PQ_make_prepare ("lookup_transfers_time_asc",
                             "SELECT"
@@ -8801,8 +8710,7 @@ postgres_connect (void *cls)
                             "        FROM merchant_instances"
                             "       WHERE merchant_id=$1)"
                             " ORDER BY credit_serial ASC"
-                            " LIMIT $5",
-                            5),
+                            " LIMIT $5"),
     /* for postgres_lookup_transfers() */
     GNUNET_PQ_make_prepare ("lookup_transfers_payto_asc",
                             "SELECT"
@@ -8828,8 +8736,7 @@ postgres_connect (void *cls)
                             "        FROM merchant_instances"
                             "       WHERE merchant_id=$1)"
                             " ORDER BY credit_serial ASC"
-                            " LIMIT $3",
-                            4),
+                            " LIMIT $3"),
     /* for postgres_lookup_transfers() */
     GNUNET_PQ_make_prepare ("lookup_transfers_asc",
                             "SELECT"
@@ -8854,8 +8761,7 @@ postgres_connect (void *cls)
                             "        FROM merchant_instances"
                             "       WHERE merchant_id=$1)"
                             " ORDER BY credit_serial ASC"
-                            " LIMIT $3",
-                            3),
+                            " LIMIT $3"),
     /* for postgres_lookup_transfers() */
     GNUNET_PQ_make_prepare ("lookup_transfers_time_payto_desc",
                             "SELECT"
@@ -8880,8 +8786,7 @@ postgres_connect (void *cls)
                             "        FROM merchant_instances"
                             "       WHERE merchant_id=$1)"
                             " ORDER BY credit_serial DESC"
-                            " LIMIT $5",
-                            6),
+                            " LIMIT $5"),
     /* for postgres_lookup_transfers() */
     GNUNET_PQ_make_prepare ("lookup_transfers_time_desc",
                             "SELECT"
@@ -8905,8 +8810,7 @@ postgres_connect (void *cls)
                             "        FROM merchant_instances"
                             "       WHERE merchant_id=$1)"
                             " ORDER BY credit_serial DESC"
-                            " LIMIT $5",
-                            5),
+                            " LIMIT $5"),
     /* for postgres_lookup_transfers() */
     GNUNET_PQ_make_prepare ("lookup_transfers_payto_desc",
                             "SELECT"
@@ -8932,8 +8836,7 @@ postgres_connect (void *cls)
                             "        FROM merchant_instances"
                             "       WHERE merchant_id=$1)"
                             " ORDER BY credit_serial DESC"
-                            " LIMIT $3",
-                            4),
+                            " LIMIT $3"),
     /* for postgres_lookup_transfers() */
     GNUNET_PQ_make_prepare ("lookup_transfers_desc",
                             "SELECT"
@@ -8958,8 +8861,7 @@ postgres_connect (void *cls)
                             "        FROM merchant_instances"
                             "       WHERE merchant_id=$1)"
                             " ORDER BY credit_serial DESC"
-                            " LIMIT $3",
-                            3),
+                            " LIMIT $3"),
     /* For postgres_store_wire_fee_by_exchange() */
     GNUNET_PQ_make_prepare ("insert_wire_fee",
                             "INSERT INTO merchant_exchange_wire_fees"
@@ -8975,8 +8877,7 @@ postgres_connect (void *cls)
                             ",end_date"
                             ",master_sig)"
                             " VALUES "
-                            "($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11)",
-                            11),
+                            "($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11)"),
     /* For postgres_insert_reserve() */
     GNUNET_PQ_make_prepare ("insert_reserve",
                             "INSERT INTO merchant_tip_reserves"
@@ -8989,8 +8890,7 @@ postgres_connect (void *cls)
                             ")"
                             "SELECT $2, merchant_serial, $3, $4, $5, $6"
                             " FROM merchant_instances"
-                            " WHERE merchant_id=$1",
-                            6),
+                            " WHERE merchant_id=$1"),
     /* For postgres_activate_reserve() */
     GNUNET_PQ_make_prepare ("activate_reserve",
                             "UPDATE merchant_tip_reserves SET"
@@ -9000,8 +8900,7 @@ postgres_connect (void *cls)
                             " AND merchant_serial="
                             "   (SELECT merchant_serial"
                             "      FROM merchant_instances"
-                            "     WHERE merchant_id=$1)",
-                            4),
+                            "     WHERE merchant_id=$1)"),
     /* For postgres_insert_reserve() */
     GNUNET_PQ_make_prepare ("insert_reserve_key",
                             "INSERT INTO merchant_tip_reserve_keys"
@@ -9016,8 +8915,7 @@ postgres_connect (void *cls)
                             "   AND merchant_serial="
                             "     (SELECT merchant_serial"
                             "        FROM merchant_instances"
-                            "       WHERE merchant_id=$1)",
-                            5),
+                            "       WHERE merchant_id=$1)"),
     /* For postgres_lookup_reserves() */
     GNUNET_PQ_make_prepare ("lookup_reserves",
                             "SELECT"
@@ -9039,8 +8937,7 @@ postgres_connect (void *cls)
                             "   AND merchant_serial ="
                             "     (SELECT merchant_serial"
                             "        FROM merchant_instances"
-                            "       WHERE merchant_id=$1)",
-                            2),
+                            "       WHERE merchant_id=$1)"),
     /* For postgres_lookup_pending_reserves() */
     GNUNET_PQ_make_prepare ("lookup_pending_reserves",
                             "SELECT"
@@ -9053,8 +8950,7 @@ postgres_connect (void *cls)
                             " JOIN merchant_instances USING (merchant_serial)"
                             " JOIN merchant_tip_reserve_keys USING 
(reserve_serial)"
                             " WHERE exchange_initial_balance_val=0"
-                            "   AND exchange_initial_balance_frac=0",
-                            0),
+                            "   AND exchange_initial_balance_frac=0"),
     /* For postgres_lookup_reserve() */
     GNUNET_PQ_make_prepare ("lookup_reserve",
                             "SELECT"
@@ -9077,8 +8973,7 @@ postgres_connect (void *cls)
                             "   AND merchant_serial ="
                             "     (SELECT merchant_serial"
                             "        FROM merchant_instances"
-                            "       WHERE merchant_id=$1)",
-                            2),
+                            "       WHERE merchant_id=$1)"),
     /* For postgres_lookup_reserve() */
     GNUNET_PQ_make_prepare ("lookup_reserve_tips",
                             "SELECT"
@@ -9094,8 +8989,7 @@ postgres_connect (void *cls)
                             "        AND merchant_serial ="
                             "       (SELECT merchant_serial"
                             "          FROM merchant_instances"
-                            "         WHERE merchant_id=$1))",
-                            2),
+                            "         WHERE merchant_id=$1))"),
     /* for postgres_delete_reserve() */
     GNUNET_PQ_make_prepare ("delete_reserve",
                             "DELETE"
@@ -9107,8 +9001,7 @@ postgres_connect (void *cls)
                             "         AND merchant_serial="
                             "     (SELECT merchant_serial"
                             "        FROM merchant_instances"
-                            "       WHERE merchant_id=$1))",
-                            2),
+                            "       WHERE merchant_id=$1))"),
     /* for postgres_purge_reserve() */
     GNUNET_PQ_make_prepare ("purge_reserve",
                             "DELETE"
@@ -9117,8 +9010,7 @@ postgres_connect (void *cls)
                             "    AND merchant_serial="
                             "    (SELECT merchant_serial"
                             "       FROM merchant_instances"
-                            "      WHERE merchant_id=$1)",
-                            2),
+                            "      WHERE merchant_id=$1)"),
     /* For postgres_authorize_tip() */
     GNUNET_PQ_make_prepare ("lookup_reserve_for_tip",
                             "SELECT"
@@ -9133,8 +9025,7 @@ postgres_connect (void *cls)
                             "   merchant_serial ="
                             "     (SELECT merchant_serial"
                             "        FROM merchant_instances"
-                            "       WHERE merchant_id=$1)",
-                            1),
+                            "       WHERE merchant_id=$1)"),
 
     /* For postgres_authorize_tip() */
     GNUNET_PQ_make_prepare ("lookup_reserve_status",
@@ -9149,8 +9040,7 @@ postgres_connect (void *cls)
                             "   AND merchant_serial ="
                             "     (SELECT merchant_serial"
                             "        FROM merchant_instances"
-                            "       WHERE merchant_id=$1)",
-                            2),
+                            "       WHERE merchant_id=$1)"),
     /* For postgres_authorize_tip() */
     GNUNET_PQ_make_prepare ("update_reserve_tips_committed",
                             "UPDATE merchant_tip_reserves SET"
@@ -9160,8 +9050,7 @@ postgres_connect (void *cls)
                             "   AND merchant_serial ="
                             "     (SELECT merchant_serial"
                             "        FROM merchant_instances"
-                            "       WHERE merchant_id=$1)",
-                            4),
+                            "       WHERE merchant_id=$1)"),
     /* For postgres_authorize_tip() */
     GNUNET_PQ_make_prepare ("insert_tip",
                             "INSERT INTO merchant_tips"
@@ -9180,8 +9069,7 @@ postgres_connect (void *cls)
                             "  AND merchant_serial = "
                             "     (SELECT merchant_serial"
                             "        FROM merchant_instances"
-                            "       WHERE merchant_id=$1)",
-                            8),
+                            "       WHERE merchant_id=$1)"),
     /* For postgres_lookup_pickup() */
     GNUNET_PQ_make_prepare ("lookup_pickup",
                             "SELECT"
@@ -9197,16 +9085,14 @@ postgres_connect (void *cls)
                             "   AND merchant_serial ="
                             "     (SELECT merchant_serial"
                             "        FROM merchant_instances"
-                            "       WHERE merchant_id=$1)",
-                            2),
+                            "       WHERE merchant_id=$1)"),
     /* For postgres_lookup_pickup() */
     GNUNET_PQ_make_prepare ("lookup_pickup_signatures",
                             "SELECT"
                             " coin_offset"
                             ",blind_sig"
                             " FROM merchant_tip_pickup_signatures"
-                            " WHERE pickup_serial = $1",
-                            1),
+                            " WHERE pickup_serial = $1"),
 
     /* For postgres_lookup_tip() */
     GNUNET_PQ_make_prepare ("lookup_tip",
@@ -9225,8 +9111,7 @@ postgres_connect (void *cls)
                             "   AND merchant_serial ="
                             "     (SELECT merchant_serial"
                             "        FROM merchant_instances"
-                            "       WHERE merchant_id=$1)",
-                            2),
+                            "       WHERE merchant_id=$1)"),
     /* For postgres_lookup_tip() */
     GNUNET_PQ_make_prepare ("lookup_tips_inc",
                             "SELECT"
@@ -9245,8 +9130,7 @@ postgres_connect (void *cls)
                             "   AND"
                             "    tip_serial > $3"
                             " ORDER BY tip_serial ASC"
-                            " LIMIT $2",
-                            5),
+                            " LIMIT $2"),
     GNUNET_PQ_make_prepare ("lookup_tips_dec",
                             "SELECT"
                             " tip_serial"
@@ -9264,8 +9148,7 @@ postgres_connect (void *cls)
                             "   AND"
                             "    tip_serial < $3"
                             " ORDER BY tip_serial DESC"
-                            " LIMIT $2",
-                            5),
+                            " LIMIT $2"),
     GNUNET_PQ_make_prepare ("lookup_tips_inc_expired",
                             "SELECT"
                             " tip_serial"
@@ -9283,8 +9166,7 @@ postgres_connect (void *cls)
                             "   AND"
                             "    CAST($5 as BOOL) = (merchant_tips.expiration 
< $4)"
                             " ORDER BY tip_serial ASC"
-                            " LIMIT $2",
-                            5),
+                            " LIMIT $2"),
     GNUNET_PQ_make_prepare ("lookup_tips_dec_expired",
                             "SELECT"
                             " tip_serial"
@@ -9302,8 +9184,7 @@ postgres_connect (void *cls)
                             "   AND"
                             "    CAST($5 as BOOL) = (merchant_tips.expiration 
< $4)"
                             " ORDER BY tip_serial DESC"
-                            " LIMIT $2",
-                            5),
+                            " LIMIT $2"),
     /* for postgres_lookup_tip_details() */
     GNUNET_PQ_make_prepare ("lookup_tip_details",
                             "SELECT"
@@ -9321,8 +9202,7 @@ postgres_connect (void *cls)
                             "   AND merchant_serial ="
                             "     (SELECT merchant_serial"
                             "        FROM merchant_instances"
-                            "       WHERE merchant_id=$1)",
-                            2),
+                            "       WHERE merchant_id=$1)"),
     /* for postgres_lookup_tip_details() */
     GNUNET_PQ_make_prepare ("lookup_pickup_details",
                             "SELECT"
@@ -9333,8 +9213,7 @@ postgres_connect (void *cls)
                             " FROM merchant_tip_pickups"
                             " JOIN merchant_tip_pickup_signatures USING 
(pickup_serial)"
                             " WHERE tip_serial = $1"
-                            " GROUP BY pickup_serial",
-                            1),
+                            " GROUP BY pickup_serial"),
     /* for postgres_insert_pickup() */
     GNUNET_PQ_make_prepare ("insert_pickup",
                             "INSERT INTO merchant_tip_pickups"
@@ -9351,16 +9230,14 @@ postgres_connect (void *cls)
                             "  AND merchant_serial = "
                             "     (SELECT merchant_serial"
                             "        FROM merchant_instances"
-                            "       WHERE merchant_id=$1)",
-                            5),
+                            "       WHERE merchant_id=$1)"),
     /* for postgres_insert_pickup() */
     GNUNET_PQ_make_prepare ("update_picked_up_tip",
                             "UPDATE merchant_tips SET"
                             " picked_up_val=$2"
                             ",picked_up_frac=$3"
                             ",was_picked_up = ($2 = amount_val AND $3 = 
amount_frac)"
-                            " WHERE tip_id = $1",
-                            3),
+                            " WHERE tip_id = $1"),
     /* for postgres_insert_pickup() */
     GNUNET_PQ_make_prepare ("lookup_picked_up_reserve",
                             "SELECT"
@@ -9373,15 +9250,13 @@ postgres_connect (void *cls)
                             "   AND merchant_serial ="
                             "     (SELECT merchant_serial"
                             "        FROM merchant_instances"
-                            "       WHERE merchant_id=$1)",
-                            2),
+                            "       WHERE merchant_id=$1)"),
     /* for postgres_insert_pickup() */
     GNUNET_PQ_make_prepare ("update_picked_up_reserve",
                             "UPDATE merchant_tip_reserves SET"
                             " tips_picked_up_val=$2"
                             ",tips_picked_up_frac=$3"
-                            " WHERE reserve_serial = $1",
-                            3),
+                            " WHERE reserve_serial = $1"),
     /* for postgres_insert_pickup_blind_signature() */
     GNUNET_PQ_make_prepare ("insert_pickup_blind_signature",
                             "INSERT INTO merchant_tip_pickup_signatures"
@@ -9392,8 +9267,7 @@ postgres_connect (void *cls)
                             "SELECT"
                             " pickup_serial, $2, $3"
                             " FROM merchant_tip_pickups"
-                            " WHERE pickup_id=$1",
-                            3),
+                            " WHERE pickup_id=$1"),
     GNUNET_PQ_PREPARED_STATEMENT_END
   };
   struct GNUNET_PQ_ExecuteStatement es[] = {

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]