diff options
Diffstat (limited to 'src/datastore/plugin_datastore_postgres.c')
-rw-r--r-- | src/datastore/plugin_datastore_postgres.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/src/datastore/plugin_datastore_postgres.c b/src/datastore/plugin_datastore_postgres.c index 6dec3146d..83fc423da 100644 --- a/src/datastore/plugin_datastore_postgres.c +++ b/src/datastore/plugin_datastore_postgres.c | |||
@@ -270,14 +270,14 @@ postgres_plugin_estimate_size (void *cls) | |||
270 | * @return GNUNET_OK on success | 270 | * @return GNUNET_OK on success |
271 | */ | 271 | */ |
272 | static int | 272 | static int |
273 | postgres_plugin_put (void *cls, const GNUNET_HashCode * key, uint32_t size, | 273 | postgres_plugin_put (void *cls, const struct GNUNET_HashCode * key, uint32_t size, |
274 | const void *data, enum GNUNET_BLOCK_Type type, | 274 | const void *data, enum GNUNET_BLOCK_Type type, |
275 | uint32_t priority, uint32_t anonymity, | 275 | uint32_t priority, uint32_t anonymity, |
276 | uint32_t replication, | 276 | uint32_t replication, |
277 | struct GNUNET_TIME_Absolute expiration, char **msg) | 277 | struct GNUNET_TIME_Absolute expiration, char **msg) |
278 | { | 278 | { |
279 | struct Plugin *plugin = cls; | 279 | struct Plugin *plugin = cls; |
280 | GNUNET_HashCode vhash; | 280 | struct GNUNET_HashCode vhash; |
281 | PGresult *ret; | 281 | PGresult *ret; |
282 | uint32_t btype = htonl (type); | 282 | uint32_t btype = htonl (type); |
283 | uint32_t bprio = htonl (priority); | 283 | uint32_t bprio = htonl (priority); |
@@ -301,8 +301,8 @@ postgres_plugin_put (void *cls, const GNUNET_HashCode * key, uint32_t size, | |||
301 | sizeof (bprio), | 301 | sizeof (bprio), |
302 | sizeof (banon), | 302 | sizeof (banon), |
303 | sizeof (bexpi), | 303 | sizeof (bexpi), |
304 | sizeof (GNUNET_HashCode), | 304 | sizeof (struct GNUNET_HashCode), |
305 | sizeof (GNUNET_HashCode), | 305 | sizeof (struct GNUNET_HashCode), |
306 | size | 306 | size |
307 | }; | 307 | }; |
308 | const int paramFormats[] = { 1, 1, 1, 1, 1, 1, 1, 1 }; | 308 | const int paramFormats[] = { 1, 1, 1, 1, 1, 1, 1, 1 }; |
@@ -345,7 +345,7 @@ process_result (struct Plugin *plugin, PluginDatumProcessor proc, | |||
345 | uint32_t size; | 345 | uint32_t size; |
346 | unsigned int rowid; | 346 | unsigned int rowid; |
347 | struct GNUNET_TIME_Absolute expiration_time; | 347 | struct GNUNET_TIME_Absolute expiration_time; |
348 | GNUNET_HashCode key; | 348 | struct GNUNET_HashCode key; |
349 | 349 | ||
350 | if (GNUNET_OK != | 350 | if (GNUNET_OK != |
351 | GNUNET_POSTGRES_check_result_ (plugin->dbh, res, PGRES_TUPLES_OK, "PQexecPrepared", "select", | 351 | GNUNET_POSTGRES_check_result_ (plugin->dbh, res, PGRES_TUPLES_OK, "PQexecPrepared", "select", |
@@ -380,7 +380,7 @@ process_result (struct Plugin *plugin, PluginDatumProcessor proc, | |||
380 | (sizeof (uint32_t) != PQfsize (res, 1)) || | 380 | (sizeof (uint32_t) != PQfsize (res, 1)) || |
381 | (sizeof (uint32_t) != PQfsize (res, 2)) || | 381 | (sizeof (uint32_t) != PQfsize (res, 2)) || |
382 | (sizeof (uint64_t) != PQfsize (res, 3)) || | 382 | (sizeof (uint64_t) != PQfsize (res, 3)) || |
383 | (sizeof (GNUNET_HashCode) != PQgetlength (res, 0, 4))) | 383 | (sizeof (struct GNUNET_HashCode) != PQgetlength (res, 0, 4))) |
384 | { | 384 | { |
385 | GNUNET_break (0); | 385 | GNUNET_break (0); |
386 | PQclear (res); | 386 | PQclear (res); |
@@ -394,7 +394,7 @@ process_result (struct Plugin *plugin, PluginDatumProcessor proc, | |||
394 | anonymity = ntohl (*(uint32_t *) PQgetvalue (res, 0, 2)); | 394 | anonymity = ntohl (*(uint32_t *) PQgetvalue (res, 0, 2)); |
395 | expiration_time.abs_value = | 395 | expiration_time.abs_value = |
396 | GNUNET_ntohll (*(uint64_t *) PQgetvalue (res, 0, 3)); | 396 | GNUNET_ntohll (*(uint64_t *) PQgetvalue (res, 0, 3)); |
397 | memcpy (&key, PQgetvalue (res, 0, 4), sizeof (GNUNET_HashCode)); | 397 | memcpy (&key, PQgetvalue (res, 0, 4), sizeof (struct GNUNET_HashCode)); |
398 | size = PQgetlength (res, 0, 5); | 398 | size = PQgetlength (res, 0, 5); |
399 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "datastore-postgres", | 399 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "datastore-postgres", |
400 | "Found result of size %u bytes and type %u in database\n", | 400 | "Found result of size %u bytes and type %u in database\n", |
@@ -443,8 +443,8 @@ process_result (struct Plugin *plugin, PluginDatumProcessor proc, | |||
443 | */ | 443 | */ |
444 | static void | 444 | static void |
445 | postgres_plugin_get_key (void *cls, uint64_t offset, | 445 | postgres_plugin_get_key (void *cls, uint64_t offset, |
446 | const GNUNET_HashCode * key, | 446 | const struct GNUNET_HashCode * key, |
447 | const GNUNET_HashCode * vhash, | 447 | const struct GNUNET_HashCode * vhash, |
448 | enum GNUNET_BLOCK_Type type, PluginDatumProcessor proc, | 448 | enum GNUNET_BLOCK_Type type, PluginDatumProcessor proc, |
449 | void *proc_cls) | 449 | void *proc_cls) |
450 | { | 450 | { |
@@ -461,14 +461,14 @@ postgres_plugin_get_key (void *cls, uint64_t offset, | |||
461 | 461 | ||
462 | GNUNET_assert (key != NULL); | 462 | GNUNET_assert (key != NULL); |
463 | paramValues[0] = (const char *) key; | 463 | paramValues[0] = (const char *) key; |
464 | paramLengths[0] = sizeof (GNUNET_HashCode); | 464 | paramLengths[0] = sizeof (struct GNUNET_HashCode); |
465 | btype = htonl (type); | 465 | btype = htonl (type); |
466 | if (type != 0) | 466 | if (type != 0) |
467 | { | 467 | { |
468 | if (vhash != NULL) | 468 | if (vhash != NULL) |
469 | { | 469 | { |
470 | paramValues[1] = (const char *) vhash; | 470 | paramValues[1] = (const char *) vhash; |
471 | paramLengths[1] = sizeof (GNUNET_HashCode); | 471 | paramLengths[1] = sizeof (struct GNUNET_HashCode); |
472 | paramValues[2] = (const char *) &btype; | 472 | paramValues[2] = (const char *) &btype; |
473 | paramLengths[2] = sizeof (btype); | 473 | paramLengths[2] = sizeof (btype); |
474 | paramValues[3] = (const char *) &blimit_off; | 474 | paramValues[3] = (const char *) &blimit_off; |
@@ -499,7 +499,7 @@ postgres_plugin_get_key (void *cls, uint64_t offset, | |||
499 | if (vhash != NULL) | 499 | if (vhash != NULL) |
500 | { | 500 | { |
501 | paramValues[1] = (const char *) vhash; | 501 | paramValues[1] = (const char *) vhash; |
502 | paramLengths[1] = sizeof (GNUNET_HashCode); | 502 | paramLengths[1] = sizeof (struct GNUNET_HashCode); |
503 | paramValues[2] = (const char *) &blimit_off; | 503 | paramValues[2] = (const char *) &blimit_off; |
504 | paramLengths[2] = sizeof (blimit_off); | 504 | paramLengths[2] = sizeof (blimit_off); |
505 | nparams = 3; | 505 | nparams = 3; |
@@ -628,7 +628,7 @@ struct ReplCtx | |||
628 | * GNUNET_NO to delete the item and continue (if supported) | 628 | * GNUNET_NO to delete the item and continue (if supported) |
629 | */ | 629 | */ |
630 | static int | 630 | static int |
631 | repl_proc (void *cls, const GNUNET_HashCode * key, uint32_t size, | 631 | repl_proc (void *cls, const struct GNUNET_HashCode * key, uint32_t size, |
632 | const void *data, enum GNUNET_BLOCK_Type type, uint32_t priority, | 632 | const void *data, enum GNUNET_BLOCK_Type type, uint32_t priority, |
633 | uint32_t anonymity, struct GNUNET_TIME_Absolute expiration, | 633 | uint32_t anonymity, struct GNUNET_TIME_Absolute expiration, |
634 | uint64_t uid) | 634 | uint64_t uid) |
@@ -792,16 +792,16 @@ postgres_plugin_get_keys (void *cls, | |||
792 | struct Plugin *plugin = cls; | 792 | struct Plugin *plugin = cls; |
793 | int ret; | 793 | int ret; |
794 | int i; | 794 | int i; |
795 | GNUNET_HashCode key; | 795 | struct GNUNET_HashCode key; |
796 | PGresult * res; | 796 | PGresult * res; |
797 | 797 | ||
798 | res = PQexecPrepared (plugin->dbh, "get_keys", 0, NULL, NULL, NULL, 1); | 798 | res = PQexecPrepared (plugin->dbh, "get_keys", 0, NULL, NULL, NULL, 1); |
799 | ret = PQntuples (res); | 799 | ret = PQntuples (res); |
800 | for (i=0;i<ret;i++) | 800 | for (i=0;i<ret;i++) |
801 | { | 801 | { |
802 | if (sizeof (GNUNET_HashCode) != PQgetlength (res, i, 0)) | 802 | if (sizeof (struct GNUNET_HashCode) != PQgetlength (res, i, 0)) |
803 | { | 803 | { |
804 | memcpy (&key, PQgetvalue (res, i, 0), sizeof (GNUNET_HashCode)); | 804 | memcpy (&key, PQgetvalue (res, i, 0), sizeof (struct GNUNET_HashCode)); |
805 | proc (proc_cls, &key, 1); | 805 | proc (proc_cls, &key, 1); |
806 | } | 806 | } |
807 | } | 807 | } |