*/
#include "platform.h"
-#include "plugin_datastore.h"
+#include "gnunet_datastore_plugin.h"
#include <sqlite3.h>
-#define DEBUG_SQLITE GNUNET_NO
+#define DEBUG_SQLITE GNUNET_YES
/**
-#if 1
+#if 0
#define CHECK(a) GNUNET_break(a)
#define ENULL NULL
#else
#define ENULL &e
#define ENULL_DEFINED 1
-#define CHECK(a) if (! a) { GNUNET_log(GNUNET_ERROR_TYPE_ERRROR, "%s\n", e); sqlite3_free(e); }
+#define CHECK(a) if (! a) { GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "%s\n", e); sqlite3_free(e); }
#endif
/* database is new or got deleted, reset payload to zero! */
plugin->env->duc (plugin->env->cls, 0);
}
- plugin->fn = GNUNET_STRINGS_to_utf8 (afsdir, strlen (afsdir),
#ifdef ENABLE_NLS
- nl_langinfo (CODESET)
+ plugin->fn = GNUNET_STRINGS_to_utf8 (afsdir, strlen (afsdir),
+ nl_langinfo (CODESET));
#else
- "UTF-8" /* good luck */
+ plugin->fn = GNUNET_STRINGS_to_utf8 (afsdir, strlen (afsdir),
+ "UTF-8"); /* good luck */
#endif
- );
GNUNET_free (afsdir);
/* Open database and precompile statements */
priority = sqlite3_column_int (nc->stmt, 2);
anonymity = sqlite3_column_int (nc->stmt, 3);
- expiration.value = sqlite3_column_int64 (nc->stmt, 4);
+ expiration.abs_value = sqlite3_column_int64 (nc->stmt, 4);
key = sqlite3_column_blob (nc->stmt, 5);
nc->lastPriority = priority;
nc->lastExpiration = expiration;
if (GNUNET_YES == end_it)
nc->end_it = GNUNET_YES;
nc->plugin->next_task_nc = nc;
- nc->plugin->next_task = GNUNET_SCHEDULER_add_now (nc->plugin->env->sched,
- &sqlite_next_request_cont,
+ nc->plugin->next_task = GNUNET_SCHEDULER_add_now (&sqlite_next_request_cont,
nc);
}
type,
GNUNET_h2s(key),
priority,
- (unsigned long long) GNUNET_TIME_absolute_get_remaining (expiration).value,
- (long long) expiration.value);
+ (unsigned long long) GNUNET_TIME_absolute_get_remaining (expiration).rel_value,
+ (long long) expiration.abs_value);
#endif
GNUNET_CRYPTO_hash (data, size, &vhash);
stmt = plugin->insertContent;
(SQLITE_OK != sqlite3_bind_int (stmt, 2, type)) ||
(SQLITE_OK != sqlite3_bind_int (stmt, 3, priority)) ||
(SQLITE_OK != sqlite3_bind_int (stmt, 4, anonymity)) ||
- (SQLITE_OK != sqlite3_bind_int64 (stmt, 5, expiration.value)) ||
+ (SQLITE_OK != sqlite3_bind_int64 (stmt, 5, expiration.abs_value)) ||
(SQLITE_OK !=
sqlite3_bind_blob (stmt, 6, key, sizeof (GNUNET_HashCode),
SQLITE_TRANSIENT)) ||
int n;
sqlite3_bind_int (plugin->updPrio, 1, delta);
- sqlite3_bind_int64 (plugin->updPrio, 2, expire.value);
+ sqlite3_bind_int64 (plugin->updPrio, 2, expire.abs_value);
sqlite3_bind_int64 (plugin->updPrio, 3, uid);
n = sqlite3_step (plugin->updPrio);
if (n != SQLITE_DONE)
#if DEBUG_SQLITE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Restricting to results larger than the last expiration %llu\n",
- (unsigned long long) nc->lastExpiration.value);
+ (unsigned long long) nc->lastExpiration.abs_value);
#endif
- sqlite3_bind_int64 (ic->stmt_1, 1, nc->lastExpiration.value);
- sqlite3_bind_int64 (ic->stmt_2, 1, nc->lastExpiration.value);
+ sqlite3_bind_int64 (ic->stmt_1, 1, nc->lastExpiration.abs_value);
+ sqlite3_bind_int64 (ic->stmt_2, 1, nc->lastExpiration.abs_value);
}
#if DEBUG_SQLITE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
#if DEBUG_SQLITE
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"At %llu, using queries `%s' and `%s'\n",
- (unsigned long long) GNUNET_TIME_absolute_get ().value,
+ (unsigned long long) GNUNET_TIME_absolute_get ().abs_value,
stmt_str_1,
stmt_str_2);
#endif
if (is_asc)
{
nc->lastPriority = 0;
- nc->lastExpiration.value = 0;
+ nc->lastExpiration.abs_value = 0;
memset (&nc->lastKey, 0, sizeof (GNUNET_HashCode));
}
else
{
nc->lastPriority = 0x7FFFFFFF;
- nc->lastExpiration.value = 0x7FFFFFFFFFFFFFFFLL;
+ nc->lastExpiration.abs_value = 0x7FFFFFFFFFFFFFFFLL;
memset (&nc->lastKey, 255, sizeof (GNUNET_HashCode));
}
sqlite_next_request (nc, GNUNET_NO);
now = GNUNET_TIME_absolute_get ();
GNUNET_asprintf (&q1, SELECT_IT_NON_ANONYMOUS_1,
- (unsigned long long) now.value);
+ (unsigned long long) now.abs_value);
GNUNET_asprintf (&q2, SELECT_IT_NON_ANONYMOUS_2,
- (unsigned long long) now.value);
+ (unsigned long long) now.abs_value);
basic_iter (cls,
type,
GNUNET_NO, GNUNET_YES,
now = GNUNET_TIME_absolute_get ();
GNUNET_asprintf (&q1, SELECT_IT_EXPIRATION_TIME_1,
- (unsigned long long) 0*now.value);
+ (unsigned long long) 0*now.abs_value);
GNUNET_asprintf (&q2, SELECT_IT_EXPIRATION_TIME_2,
- (unsigned long long) 0*now.value);
+ (unsigned long long) 0*now.abs_value);
basic_iter (cls,
type,
GNUNET_YES, GNUNET_NO,
now = GNUNET_TIME_absolute_get ();
GNUNET_asprintf (&q, SELECT_IT_MIGRATION_ORDER_2,
- (unsigned long long) now.value);
+ (unsigned long long) now.abs_value);
basic_iter (cls,
type,
GNUNET_NO, GNUNET_NO,
sqlite3_stmt *stmt;
uint64_t pages;
uint64_t page_size;
+#if ENULL_DEFINED
+ char *e;
+#endif
if (SQLITE_VERSION_NUMBER < 3006000)
{
if (plugin->next_task != GNUNET_SCHEDULER_NO_TASK)
{
- GNUNET_SCHEDULER_cancel (plugin->env->sched,
- plugin->next_task);
+ GNUNET_SCHEDULER_cancel (plugin->next_task);
plugin->next_task = GNUNET_SCHEDULER_NO_TASK;
plugin->next_task_nc->prep (plugin->next_task_nc->prep_cls, NULL);
GNUNET_free (plugin->next_task_nc);