diff options
author | Gabor X Toth <*@tg-x.net> | 2016-10-12 16:41:36 +0000 |
---|---|---|
committer | Gabor X Toth <*@tg-x.net> | 2016-10-12 16:41:36 +0000 |
commit | dc9705745ba0118859be9b547491fc5d2d5cba09 (patch) | |
tree | aa6124b1da240ae25c2f8d36c1dfc72a9a3071d9 /src | |
parent | 7b0570f80f6d176f760fca0a79e439ee84e7c5a9 (diff) | |
download | gnunet-dc9705745ba0118859be9b547491fc5d2d5cba09.tar.gz gnunet-dc9705745ba0118859be9b547491fc5d2d5cba09.zip |
psycstore/postgres: fix return value checks, use template1 db for tests
Diffstat (limited to 'src')
-rw-r--r-- | src/psycstore/plugin_psycstore_postgres.c | 50 | ||||
-rw-r--r-- | src/psycstore/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, | |||
713 | if (GNUNET_OK != | 713 | if (GNUNET_OK != |
714 | GNUNET_POSTGRES_check_result (plugin->dbh, | 714 | GNUNET_POSTGRES_check_result (plugin->dbh, |
715 | res, | 715 | res, |
716 | PGRES_COMMAND_OK, | 716 | PGRES_TUPLES_OK, |
717 | "PQexecPrepared", "select_membership")) | 717 | "PQexecPrepared", "select_membership")) |
718 | { | 718 | { |
719 | return GNUNET_SYSERR; | 719 | return GNUNET_SYSERR; |
@@ -835,9 +835,9 @@ message_add_flags (void *cls, | |||
835 | 835 | ||
836 | res = GNUNET_PQ_exec_prepared (plugin->dbh, "update_message_flags", params_update); | 836 | res = GNUNET_PQ_exec_prepared (plugin->dbh, "update_message_flags", params_update); |
837 | if (GNUNET_OK != GNUNET_POSTGRES_check_result (plugin->dbh, | 837 | if (GNUNET_OK != GNUNET_POSTGRES_check_result (plugin->dbh, |
838 | res, | 838 | res, |
839 | PGRES_COMMAND_OK, | 839 | PGRES_COMMAND_OK, |
840 | "PQexecPrepared", "update_message_flags")) | 840 | "PQexecPrepared","update_message_flags")) |
841 | return ret; | 841 | return ret; |
842 | 842 | ||
843 | PQclear (res); | 843 | PQclear (res); |
@@ -952,7 +952,7 @@ fragment_select (struct Plugin *plugin, | |||
952 | if (GNUNET_YES == | 952 | if (GNUNET_YES == |
953 | GNUNET_POSTGRES_check_result (plugin->dbh, | 953 | GNUNET_POSTGRES_check_result (plugin->dbh, |
954 | res, | 954 | res, |
955 | PGRES_COMMAND_OK, | 955 | PGRES_TUPLES_OK, |
956 | "PQexecPrepared", stmt)) | 956 | "PQexecPrepared", stmt)) |
957 | { | 957 | { |
958 | if (PQntuples (res) == 0) | 958 | if (PQntuples (res) == 0) |
@@ -1118,9 +1118,9 @@ message_get_fragment (void *cls, | |||
1118 | 1118 | ||
1119 | res = GNUNET_PQ_exec_prepared (plugin->dbh, stmt, params_select); | 1119 | res = GNUNET_PQ_exec_prepared (plugin->dbh, stmt, params_select); |
1120 | if (GNUNET_OK == GNUNET_POSTGRES_check_result (plugin->dbh, | 1120 | if (GNUNET_OK == GNUNET_POSTGRES_check_result (plugin->dbh, |
1121 | res, | 1121 | res, |
1122 | PGRES_COMMAND_OK, | 1122 | PGRES_TUPLES_OK, |
1123 | "PQexecPrepared", stmt)) | 1123 | "PQexecPrepared", stmt)) |
1124 | { | 1124 | { |
1125 | if (PQntuples (res) == 0) | 1125 | if (PQntuples (res) == 0) |
1126 | ret = GNUNET_NO; | 1126 | ret = GNUNET_NO; |
@@ -1159,9 +1159,9 @@ counters_message_get (void *cls, | |||
1159 | 1159 | ||
1160 | res = GNUNET_PQ_exec_prepared (plugin->dbh, stmt, params_select); | 1160 | res = GNUNET_PQ_exec_prepared (plugin->dbh, stmt, params_select); |
1161 | if (GNUNET_OK != GNUNET_POSTGRES_check_result (plugin->dbh, | 1161 | if (GNUNET_OK != GNUNET_POSTGRES_check_result (plugin->dbh, |
1162 | res, | 1162 | res, |
1163 | PGRES_COMMAND_OK, | 1163 | PGRES_TUPLES_OK, |
1164 | "PQexecPrepared", stmt)) | 1164 | "PQexecPrepared", stmt)) |
1165 | { | 1165 | { |
1166 | return GNUNET_SYSERR; | 1166 | return GNUNET_SYSERR; |
1167 | } | 1167 | } |
@@ -1212,9 +1212,9 @@ counters_state_get (void *cls, | |||
1212 | 1212 | ||
1213 | res = GNUNET_PQ_exec_prepared (plugin->dbh, stmt, params_select); | 1213 | res = GNUNET_PQ_exec_prepared (plugin->dbh, stmt, params_select); |
1214 | if (GNUNET_OK != GNUNET_POSTGRES_check_result (plugin->dbh, | 1214 | if (GNUNET_OK != GNUNET_POSTGRES_check_result (plugin->dbh, |
1215 | res, | 1215 | res, |
1216 | PGRES_COMMAND_OK, | 1216 | PGRES_TUPLES_OK, |
1217 | "PQexecPrepared", stmt)) | 1217 | "PQexecPrepared", stmt)) |
1218 | { | 1218 | { |
1219 | return GNUNET_SYSERR; | 1219 | return GNUNET_SYSERR; |
1220 | } | 1220 | } |
@@ -1261,9 +1261,9 @@ state_assign (struct Plugin *plugin, const char *stmt, | |||
1261 | 1261 | ||
1262 | res = GNUNET_PQ_exec_prepared (plugin->dbh, stmt, params); | 1262 | res = GNUNET_PQ_exec_prepared (plugin->dbh, stmt, params); |
1263 | if (GNUNET_OK != GNUNET_POSTGRES_check_result (plugin->dbh, | 1263 | if (GNUNET_OK != GNUNET_POSTGRES_check_result (plugin->dbh, |
1264 | res, | 1264 | res, |
1265 | PGRES_COMMAND_OK, | 1265 | PGRES_COMMAND_OK, |
1266 | "PQexecPrepared", stmt)) | 1266 | "PQexecPrepared", stmt)) |
1267 | { | 1267 | { |
1268 | return GNUNET_SYSERR; | 1268 | return GNUNET_SYSERR; |
1269 | } | 1269 | } |
@@ -1289,9 +1289,9 @@ update_message_id (struct Plugin *plugin, const char *stmt, | |||
1289 | 1289 | ||
1290 | res = GNUNET_PQ_exec_prepared (plugin->dbh, stmt, params); | 1290 | res = GNUNET_PQ_exec_prepared (plugin->dbh, stmt, params); |
1291 | if (GNUNET_OK != GNUNET_POSTGRES_check_result (plugin->dbh, | 1291 | if (GNUNET_OK != GNUNET_POSTGRES_check_result (plugin->dbh, |
1292 | res, | 1292 | res, |
1293 | PGRES_COMMAND_OK, | 1293 | PGRES_COMMAND_OK, |
1294 | "PQexecPrepared", stmt)) | 1294 | "PQexecPrepared", stmt)) |
1295 | { | 1295 | { |
1296 | return GNUNET_SYSERR; | 1296 | return GNUNET_SYSERR; |
1297 | } | 1297 | } |
@@ -1529,9 +1529,9 @@ state_get (void *cls, const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key, | |||
1529 | 1529 | ||
1530 | res = GNUNET_PQ_exec_prepared (plugin->dbh, stmt, params_select); | 1530 | res = GNUNET_PQ_exec_prepared (plugin->dbh, stmt, params_select); |
1531 | if (GNUNET_OK != GNUNET_POSTGRES_check_result (plugin->dbh, | 1531 | if (GNUNET_OK != GNUNET_POSTGRES_check_result (plugin->dbh, |
1532 | res, | 1532 | res, |
1533 | PGRES_COMMAND_OK, | 1533 | PGRES_TUPLES_OK, |
1534 | "PQexecPrepared", stmt)) | 1534 | "PQexecPrepared", stmt)) |
1535 | { | 1535 | { |
1536 | return GNUNET_SYSERR; | 1536 | return GNUNET_SYSERR; |
1537 | } | 1537 | } |
@@ -1604,7 +1604,7 @@ state_get_prefix (void *cls, const struct GNUNET_CRYPTO_EddsaPublicKey *channel_ | |||
1604 | res = GNUNET_PQ_exec_prepared (plugin->dbh, stmt, params_select); | 1604 | res = GNUNET_PQ_exec_prepared (plugin->dbh, stmt, params_select); |
1605 | if (GNUNET_OK != GNUNET_POSTGRES_check_result (plugin->dbh, | 1605 | if (GNUNET_OK != GNUNET_POSTGRES_check_result (plugin->dbh, |
1606 | res, | 1606 | res, |
1607 | PGRES_COMMAND_OK, | 1607 | PGRES_TUPLES_OK, |
1608 | "PQexecPrepared", stmt)) | 1608 | "PQexecPrepared", stmt)) |
1609 | { | 1609 | { |
1610 | break; | 1610 | break; |
@@ -1674,7 +1674,7 @@ state_get_signed (void *cls, | |||
1674 | res = GNUNET_PQ_exec_prepared (plugin->dbh, stmt, params_select); | 1674 | res = GNUNET_PQ_exec_prepared (plugin->dbh, stmt, params_select); |
1675 | if (GNUNET_OK != GNUNET_POSTGRES_check_result (plugin->dbh, | 1675 | if (GNUNET_OK != GNUNET_POSTGRES_check_result (plugin->dbh, |
1676 | res, | 1676 | res, |
1677 | PGRES_COMMAND_OK, | 1677 | PGRES_TUPLES_OK, |
1678 | "PQexecPrepared", stmt)) | 1678 | "PQexecPrepared", stmt)) |
1679 | { | 1679 | { |
1680 | break; | 1680 | 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 @@ | |||
1 | [psycstore-postgres] | 1 | [psycstore-postgres] |
2 | CONFIG = connect_timeout=10; dbname=gnunet | 2 | CONFIG = connect_timeout=10; dbname=template1 |