aboutsummaryrefslogtreecommitdiff
path: root/src/datacache/plugin_datacache_postgres.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/datacache/plugin_datacache_postgres.c')
-rw-r--r--src/datacache/plugin_datacache_postgres.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/datacache/plugin_datacache_postgres.c b/src/datacache/plugin_datacache_postgres.c
index c8d66ead1..6d7e28021 100644
--- a/src/datacache/plugin_datacache_postgres.c
+++ b/src/datacache/plugin_datacache_postgres.c
@@ -78,14 +78,14 @@ init_connection (struct Plugin *plugin)
78 " value BYTEA NOT NULL DEFAULT ''," 78 " value BYTEA NOT NULL DEFAULT '',"
79 " path BYTEA DEFAULT '')" 79 " path BYTEA DEFAULT '')"
80 "WITH OIDS"); 80 "WITH OIDS");
81 if ( (ret == NULL) || 81 if ( (ret == NULL) ||
82 ((PQresultStatus (ret) != PGRES_COMMAND_OK) && 82 ((PQresultStatus (ret) != PGRES_COMMAND_OK) &&
83 (0 != strcmp ("42P07", /* duplicate table */ 83 (0 != strcmp ("42P07", /* duplicate table */
84 PQresultErrorField 84 PQresultErrorField
85 (ret, 85 (ret,
86 PG_DIAG_SQLSTATE))))) 86 PG_DIAG_SQLSTATE)))))
87 { 87 {
88 (void) GNUNET_POSTGRES_check_result (plugin->dbh, ret, 88 (void) GNUNET_POSTGRES_check_result (plugin->dbh, ret,
89 PGRES_COMMAND_OK, "CREATE TABLE", 89 PGRES_COMMAND_OK, "CREATE TABLE",
90 "gn090dc"); 90 "gn090dc");
91 PQfinish (plugin->dbh); 91 PQfinish (plugin->dbh);
@@ -198,7 +198,7 @@ postgres_plugin_put (void *cls, const struct GNUNET_HashCode * key, size_t size,
198 PQexecPrepared (plugin->dbh, "put", 5, paramValues, paramLengths, 198 PQexecPrepared (plugin->dbh, "put", 5, paramValues, paramLengths,
199 paramFormats, 1); 199 paramFormats, 1);
200 if (GNUNET_OK != 200 if (GNUNET_OK !=
201 GNUNET_POSTGRES_check_result (plugin->dbh, ret, 201 GNUNET_POSTGRES_check_result (plugin->dbh, ret,
202 PGRES_COMMAND_OK, "PQexecPrepared", "put")) 202 PGRES_COMMAND_OK, "PQexecPrepared", "put"))
203 return -1; 203 return -1;
204 PQclear (ret); 204 PQclear (ret);
@@ -258,7 +258,7 @@ postgres_plugin_get (void *cls, const struct GNUNET_HashCode * key,
258 if (0 == (cnt = PQntuples (res))) 258 if (0 == (cnt = PQntuples (res)))
259 { 259 {
260 /* no result */ 260 /* no result */
261 LOG (GNUNET_ERROR_TYPE_DEBUG, 261 LOG (GNUNET_ERROR_TYPE_DEBUG,
262 "Ending iteration (no more results)\n"); 262 "Ending iteration (no more results)\n");
263 PQclear (res); 263 PQclear (res);
264 return 0; 264 return 0;
@@ -289,7 +289,7 @@ postgres_plugin_get (void *cls, const struct GNUNET_HashCode * key,
289 } 289 }
290 path_len %= sizeof (struct GNUNET_PeerIdentity); 290 path_len %= sizeof (struct GNUNET_PeerIdentity);
291 path = (const struct GNUNET_PeerIdentity *) PQgetvalue (res, i, 3); 291 path = (const struct GNUNET_PeerIdentity *) PQgetvalue (res, i, 3);
292 LOG (GNUNET_ERROR_TYPE_DEBUG, 292 LOG (GNUNET_ERROR_TYPE_DEBUG,
293 "Found result of size %u bytes and type %u in database\n", 293 "Found result of size %u bytes and type %u in database\n",
294 (unsigned int) size, (unsigned int) type); 294 (unsigned int) size, (unsigned int) type);
295 if (GNUNET_SYSERR == 295 if (GNUNET_SYSERR ==
@@ -299,7 +299,7 @@ postgres_plugin_get (void *cls, const struct GNUNET_HashCode * key,
299 path_len, 299 path_len,
300 path)) 300 path))
301 { 301 {
302 LOG (GNUNET_ERROR_TYPE_DEBUG, 302 LOG (GNUNET_ERROR_TYPE_DEBUG,
303 "Ending iteration (client error)\n"); 303 "Ending iteration (client error)\n");
304 PQclear (res); 304 PQclear (res);
305 return cnt; 305 return cnt;
@@ -330,14 +330,14 @@ postgres_plugin_del (void *cls)
330 if (GNUNET_OK != 330 if (GNUNET_OK !=
331 GNUNET_POSTGRES_check_result (plugin->dbh, res, PGRES_TUPLES_OK, "PQexecPrepared", "getm")) 331 GNUNET_POSTGRES_check_result (plugin->dbh, res, PGRES_TUPLES_OK, "PQexecPrepared", "getm"))
332 { 332 {
333 LOG (GNUNET_ERROR_TYPE_DEBUG, 333 LOG (GNUNET_ERROR_TYPE_DEBUG,
334 "Ending iteration (postgres error)\n"); 334 "Ending iteration (postgres error)\n");
335 return 0; 335 return 0;
336 } 336 }
337 if (0 == PQntuples (res)) 337 if (0 == PQntuples (res))
338 { 338 {
339 /* no result */ 339 /* no result */
340 LOG (GNUNET_ERROR_TYPE_DEBUG, 340 LOG (GNUNET_ERROR_TYPE_DEBUG,
341 "Ending iteration (no more results)\n"); 341 "Ending iteration (no more results)\n");
342 PQclear (res); 342 PQclear (res);
343 return GNUNET_SYSERR; 343 return GNUNET_SYSERR;
@@ -388,7 +388,7 @@ libgnunet_plugin_datacache_postgres_init (void *cls)
388 api->get = &postgres_plugin_get; 388 api->get = &postgres_plugin_get;
389 api->put = &postgres_plugin_put; 389 api->put = &postgres_plugin_put;
390 api->del = &postgres_plugin_del; 390 api->del = &postgres_plugin_del;
391 LOG (GNUNET_ERROR_TYPE_INFO, 391 LOG (GNUNET_ERROR_TYPE_INFO,
392 _("Postgres datacache running\n")); 392 _("Postgres datacache running\n"));
393 return api; 393 return api;
394} 394}