diff options
Diffstat (limited to 'src/datastore/plugin_datastore_sqlite.c')
-rw-r--r-- | src/datastore/plugin_datastore_sqlite.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/src/datastore/plugin_datastore_sqlite.c b/src/datastore/plugin_datastore_sqlite.c index e77e8b9fa..9a4b40255 100644 --- a/src/datastore/plugin_datastore_sqlite.c +++ b/src/datastore/plugin_datastore_sqlite.c | |||
@@ -488,11 +488,12 @@ sqlite_plugin_put (void *cls, const struct GNUNET_HashCode * key, uint32_t size, | |||
488 | if (size > MAX_ITEM_SIZE) | 488 | if (size > MAX_ITEM_SIZE) |
489 | return GNUNET_SYSERR; | 489 | return GNUNET_SYSERR; |
490 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "sqlite", | 490 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "sqlite", |
491 | "Storing in database block with type %u/key `%s'/priority %u/expiration in %llu ms (%lld).\n", | 491 | "Storing in database block with type %u/key `%s'/priority %u/expiration in %s (%s).\n", |
492 | type, GNUNET_h2s (key), priority, | 492 | type, GNUNET_h2s (key), priority, |
493 | (unsigned long long) | 493 | (unsigned long long) |
494 | GNUNET_TIME_absolute_get_remaining (expiration).rel_value, | 494 | GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_remaining (expiration), |
495 | (long long) expiration.abs_value); | 495 | GNUNET_YES), |
496 | GNUNET_STRINGS_absolute_time_to_string (expiration)); | ||
496 | GNUNET_CRYPTO_hash (data, size, &vhash); | 497 | GNUNET_CRYPTO_hash (data, size, &vhash); |
497 | stmt = plugin->insertContent; | 498 | stmt = plugin->insertContent; |
498 | rvalue = GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK, UINT64_MAX); | 499 | rvalue = GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK, UINT64_MAX); |
@@ -500,7 +501,7 @@ sqlite_plugin_put (void *cls, const struct GNUNET_HashCode * key, uint32_t size, | |||
500 | (SQLITE_OK != sqlite3_bind_int (stmt, 2, type)) || | 501 | (SQLITE_OK != sqlite3_bind_int (stmt, 2, type)) || |
501 | (SQLITE_OK != sqlite3_bind_int (stmt, 3, priority)) || | 502 | (SQLITE_OK != sqlite3_bind_int (stmt, 3, priority)) || |
502 | (SQLITE_OK != sqlite3_bind_int (stmt, 4, anonymity)) || | 503 | (SQLITE_OK != sqlite3_bind_int (stmt, 4, anonymity)) || |
503 | (SQLITE_OK != sqlite3_bind_int64 (stmt, 5, expiration.abs_value)) || | 504 | (SQLITE_OK != sqlite3_bind_int64 (stmt, 5, expiration.abs_value_us)) || |
504 | (SQLITE_OK != sqlite3_bind_int64 (stmt, 6, rvalue)) || | 505 | (SQLITE_OK != sqlite3_bind_int64 (stmt, 6, rvalue)) || |
505 | (SQLITE_OK != | 506 | (SQLITE_OK != |
506 | sqlite3_bind_blob (stmt, 7, key, sizeof (struct GNUNET_HashCode), | 507 | sqlite3_bind_blob (stmt, 7, key, sizeof (struct GNUNET_HashCode), |
@@ -583,7 +584,7 @@ sqlite_plugin_update (void *cls, uint64_t uid, int delta, | |||
583 | int n; | 584 | int n; |
584 | 585 | ||
585 | if ((SQLITE_OK != sqlite3_bind_int (plugin->updPrio, 1, delta)) || | 586 | if ((SQLITE_OK != sqlite3_bind_int (plugin->updPrio, 1, delta)) || |
586 | (SQLITE_OK != sqlite3_bind_int64 (plugin->updPrio, 2, expire.abs_value)) | 587 | (SQLITE_OK != sqlite3_bind_int64 (plugin->updPrio, 2, expire.abs_value_us)) |
587 | || (SQLITE_OK != sqlite3_bind_int64 (plugin->updPrio, 3, uid))) | 588 | || (SQLITE_OK != sqlite3_bind_int64 (plugin->updPrio, 3, uid))) |
588 | { | 589 | { |
589 | LOG_SQLITE (plugin, msg, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, | 590 | LOG_SQLITE (plugin, msg, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, |
@@ -655,10 +656,10 @@ execute_get (struct Plugin *plugin, sqlite3_stmt * stmt, | |||
655 | -(size + GNUNET_DATASTORE_ENTRY_OVERHEAD)); | 656 | -(size + GNUNET_DATASTORE_ENTRY_OVERHEAD)); |
656 | break; | 657 | break; |
657 | } | 658 | } |
658 | expiration.abs_value = sqlite3_column_int64 (stmt, 3); | 659 | expiration.abs_value_us = sqlite3_column_int64 (stmt, 3); |
659 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "sqlite", | 660 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "sqlite", |
660 | "Found reply in database with expiration %llu\n", | 661 | "Found reply in database with expiration %s\n", |
661 | (unsigned long long) expiration.abs_value); | 662 | GNUNET_STRINGS_absolute_time_to_string (expiration)); |
662 | ret = proc (proc_cls, sqlite3_column_blob (stmt, 4) /* key */ , | 663 | ret = proc (proc_cls, sqlite3_column_blob (stmt, 4) /* key */ , |
663 | size, sqlite3_column_blob (stmt, 5) /* data */ , | 664 | size, sqlite3_column_blob (stmt, 5) /* data */ , |
664 | sqlite3_column_int (stmt, 0) /* type */ , | 665 | sqlite3_column_int (stmt, 0) /* type */ , |
@@ -1040,7 +1041,7 @@ sqlite_plugin_get_expiration (void *cls, PluginDatumProcessor proc, | |||
1040 | "Getting random block based on expiration and priority order.\n"); | 1041 | "Getting random block based on expiration and priority order.\n"); |
1041 | now = GNUNET_TIME_absolute_get (); | 1042 | now = GNUNET_TIME_absolute_get (); |
1042 | stmt = plugin->selExpi; | 1043 | stmt = plugin->selExpi; |
1043 | if (SQLITE_OK != sqlite3_bind_int64 (stmt, 1, now.abs_value)) | 1044 | if (SQLITE_OK != sqlite3_bind_int64 (stmt, 1, now.abs_value_us)) |
1044 | { | 1045 | { |
1045 | LOG_SQLITE (plugin, NULL, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, | 1046 | LOG_SQLITE (plugin, NULL, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, |
1046 | "sqlite3_bind_XXXX"); | 1047 | "sqlite3_bind_XXXX"); |