psycstore/postgres: fix return value checks, use template1 db for tests
authorGabor X Toth <*@tg-x.net>
Wed, 12 Oct 2016 16:41:36 +0000 (16:41 +0000)
committerGabor X Toth <*@tg-x.net>
Wed, 12 Oct 2016 16:41:36 +0000 (16:41 +0000)
src/psycstore/plugin_psycstore_postgres.c
src/psycstore/test_plugin_psycstore_postgres.conf

index 2bf7e894e52b5b10017b2021f9bc85e779e811a1..244b582a80ec7e9e2a277e1411fac09dad6e0f69 100644 (file)
@@ -713,7 +713,7 @@ membership_test (void *cls,
   if (GNUNET_OK !=
       GNUNET_POSTGRES_check_result (plugin->dbh,
                                     res,
-                                    PGRES_COMMAND_OK,
+                                    PGRES_TUPLES_OK,
                                     "PQexecPrepared", "select_membership"))
   {
     return GNUNET_SYSERR;
@@ -835,9 +835,9 @@ message_add_flags (void *cls,
 
   res = GNUNET_PQ_exec_prepared (plugin->dbh, "update_message_flags", params_update);
   if (GNUNET_OK != GNUNET_POSTGRES_check_result (plugin->dbh,
-                                      res,
-                                      PGRES_COMMAND_OK,
-                                      "PQexecPrepared", "update_message_flags"))
+                                                 res,
+                                                 PGRES_COMMAND_OK,
+                                                 "PQexecPrepared","update_message_flags"))
     return ret;
 
   PQclear (res);
@@ -952,7 +952,7 @@ fragment_select (struct Plugin *plugin,
   if (GNUNET_YES ==
       GNUNET_POSTGRES_check_result (plugin->dbh,
                                     res,
-                                    PGRES_COMMAND_OK,
+                                    PGRES_TUPLES_OK,
                                     "PQexecPrepared", stmt))
   {
     if (PQntuples (res) == 0)
@@ -1118,9 +1118,9 @@ message_get_fragment (void *cls,
 
   res = GNUNET_PQ_exec_prepared (plugin->dbh, stmt, params_select);
   if (GNUNET_OK == GNUNET_POSTGRES_check_result (plugin->dbh,
-                                      res,
-                                      PGRES_COMMAND_OK,
-                                      "PQexecPrepared", stmt))
+                                                 res,
+                                                 PGRES_TUPLES_OK,
+                                                 "PQexecPrepared", stmt))
   {
     if (PQntuples (res) == 0)
       ret = GNUNET_NO;
@@ -1159,9 +1159,9 @@ counters_message_get (void *cls,
 
   res = GNUNET_PQ_exec_prepared (plugin->dbh, stmt, params_select);
   if (GNUNET_OK != GNUNET_POSTGRES_check_result (plugin->dbh,
-                                      res,
-                                      PGRES_COMMAND_OK,
-                                      "PQexecPrepared", stmt))
+                                                 res,
+                                                 PGRES_TUPLES_OK,
+                                                 "PQexecPrepared", stmt))
   {
     return GNUNET_SYSERR;
   }
@@ -1212,9 +1212,9 @@ counters_state_get (void *cls,
 
   res = GNUNET_PQ_exec_prepared (plugin->dbh, stmt, params_select);
   if (GNUNET_OK != GNUNET_POSTGRES_check_result (plugin->dbh,
-                                      res,
-                                      PGRES_COMMAND_OK,
-                                      "PQexecPrepared", stmt))
+                                                 res,
+                                                 PGRES_TUPLES_OK,
+                                                 "PQexecPrepared", stmt))
   {
     return GNUNET_SYSERR;
   }
@@ -1261,9 +1261,9 @@ state_assign (struct Plugin *plugin, const char *stmt,
 
   res = GNUNET_PQ_exec_prepared (plugin->dbh, stmt, params);
   if (GNUNET_OK != GNUNET_POSTGRES_check_result (plugin->dbh,
-                                      res,
-                                      PGRES_COMMAND_OK,
-                                      "PQexecPrepared", stmt))
+                                                 res,
+                                                 PGRES_COMMAND_OK,
+                                                 "PQexecPrepared", stmt))
   {
     return GNUNET_SYSERR;
   }
@@ -1289,9 +1289,9 @@ update_message_id (struct Plugin *plugin, const char *stmt,
 
   res = GNUNET_PQ_exec_prepared (plugin->dbh, stmt, params);
   if (GNUNET_OK != GNUNET_POSTGRES_check_result (plugin->dbh,
-                                      res,
-                                      PGRES_COMMAND_OK,
-                                      "PQexecPrepared", stmt))
+                                                 res,
+                                                 PGRES_COMMAND_OK,
+                                                 "PQexecPrepared", stmt))
   {
     return GNUNET_SYSERR;
   }
@@ -1529,9 +1529,9 @@ state_get (void *cls, const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key,
 
   res = GNUNET_PQ_exec_prepared (plugin->dbh, stmt, params_select);
   if (GNUNET_OK != GNUNET_POSTGRES_check_result (plugin->dbh,
-                                      res,
-                                      PGRES_COMMAND_OK,
-                                      "PQexecPrepared", stmt))
+                                                 res,
+                                                 PGRES_TUPLES_OK,
+                                                 "PQexecPrepared", stmt))
   {
     return GNUNET_SYSERR;
   }
@@ -1604,7 +1604,7 @@ state_get_prefix (void *cls, const struct GNUNET_CRYPTO_EddsaPublicKey *channel_
     res = GNUNET_PQ_exec_prepared (plugin->dbh, stmt, params_select);
     if (GNUNET_OK != GNUNET_POSTGRES_check_result (plugin->dbh,
                                       res,
-                                      PGRES_COMMAND_OK,
+                                      PGRES_TUPLES_OK,
                                       "PQexecPrepared", stmt))
     {
       break;
@@ -1674,7 +1674,7 @@ state_get_signed (void *cls,
     res = GNUNET_PQ_exec_prepared (plugin->dbh, stmt, params_select);
     if (GNUNET_OK != GNUNET_POSTGRES_check_result (plugin->dbh,
                                       res,
-                                      PGRES_COMMAND_OK,
+                                      PGRES_TUPLES_OK,
                                       "PQexecPrepared", stmt))
     {
       break;
index 55d12005c3b8dfcc36050bb78178944a0604a90a..4b870dd0270030aa7c43ef38fb61e31500db5273 100644 (file)
@@ -1,2 +1,2 @@
 [psycstore-postgres]
-CONFIG = connect_timeout=10; dbname=gnunet
+CONFIG = connect_timeout=10; dbname=template1