From dc9705745ba0118859be9b547491fc5d2d5cba09 Mon Sep 17 00:00:00 2001 From: Gabor X Toth <*@tg-x.net> Date: Wed, 12 Oct 2016 16:41:36 +0000 Subject: [PATCH] psycstore/postgres: fix return value checks, use template1 db for tests --- src/psycstore/plugin_psycstore_postgres.c | 50 +++++++++---------- .../test_plugin_psycstore_postgres.conf | 2 +- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/psycstore/plugin_psycstore_postgres.c b/src/psycstore/plugin_psycstore_postgres.c index 2bf7e894e..244b582a8 100644 --- a/src/psycstore/plugin_psycstore_postgres.c +++ b/src/psycstore/plugin_psycstore_postgres.c @@ -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; diff --git a/src/psycstore/test_plugin_psycstore_postgres.conf b/src/psycstore/test_plugin_psycstore_postgres.conf index 55d12005c..4b870dd02 100644 --- a/src/psycstore/test_plugin_psycstore_postgres.conf +++ b/src/psycstore/test_plugin_psycstore_postgres.conf @@ -1,2 +1,2 @@ [psycstore-postgres] -CONFIG = connect_timeout=10; dbname=gnunet +CONFIG = connect_timeout=10; dbname=template1 -- 2.25.1