sql_exec (plugin->dbh,
"CREATE TABLE IF NOT EXISTS channels (\n"
" id INTEGER PRIMARY KEY,\n"
- " pub_key BLOB UNIQUE,\n"
+ " pub_key BLOB(32) UNIQUE,\n"
" max_state_message_id INTEGER,\n" // last applied state message ID
" state_hash_message_id INTEGER\n" // last message ID with a state hash
");");
sql_exec (plugin->dbh,
"CREATE TABLE IF NOT EXISTS slaves (\n"
" id INTEGER PRIMARY KEY,\n"
- " pub_key BLOB UNIQUE\n"
+ " pub_key BLOB(32) UNIQUE\n"
");");
sql_exec (plugin->dbh,
"SELECT name, value_current\n"
"FROM state\n"
"WHERE channel_id = (SELECT id FROM channels WHERE pub_key = ?)\n"
- " AND (name = ? OR substr(name, 1, ?) = ? || '_');",
+ " AND (name = ? OR substr(name, 1, ?) = ?);",
&plugin->select_state_prefix);
sql_prepare (plugin->dbh,
message_add_flags (void *cls,
const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key,
uint64_t message_id,
- uint64_t psycstore_flags)
+ uint32_t psycstore_flags)
{
struct Plugin *plugin = cls;
sqlite3_stmt *stmt = plugin->update_message_flags;
msg->header.size = htons (sizeof (*msg) + data_size);
msg->header.type = htons (GNUNET_MESSAGE_TYPE_MULTICAST_MESSAGE);
msg->hop_counter = htonl ((uint32_t) sqlite3_column_int64 (stmt, 0));
- memcpy (&msg->signature,
+ GNUNET_memcpy (&msg->signature,
sqlite3_column_blob (stmt, 1),
sqlite3_column_bytes (stmt, 1));
- memcpy (&msg->purpose,
+ GNUNET_memcpy (&msg->purpose,
sqlite3_column_blob (stmt, 2),
sqlite3_column_bytes (stmt, 2));
msg->fragment_id = GNUNET_htonll (sqlite3_column_int64 (stmt, 3));
msg->message_id = GNUNET_htonll (sqlite3_column_int64 (stmt, 5));
msg->group_generation = GNUNET_htonll (sqlite3_column_int64 (stmt, 6));
msg->flags = htonl (sqlite3_column_int64 (stmt, 7));
- memcpy (&msg[1], sqlite3_column_blob (stmt, 9), data_size);
+ GNUNET_memcpy (&msg[1], sqlite3_column_blob (stmt, 9), data_size);
return cb (cb_cls, (void *) msg, sqlite3_column_int64 (stmt, 8));
}
|| SQLITE_OK != sqlite3_bind_int64 (stmt, 4,
(0 != fragment_limit)
? fragment_limit
- : -1))
+ : INT64_MAX))
{
LOG_SQLITE (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK,
"sqlite3_bind");
if (SQLITE_OK != sqlite3_bind_blob (stmt, 1, channel_key,
sizeof (*channel_key), SQLITE_STATIC)
|| SQLITE_OK != sqlite3_bind_text (stmt, 2, name, name_len, SQLITE_STATIC)
- || SQLITE_OK != sqlite3_bind_int (stmt, 3, name_len + 1)
+ || SQLITE_OK != sqlite3_bind_int (stmt, 3, name_len)
|| SQLITE_OK != sqlite3_bind_text (stmt, 4, name, name_len, SQLITE_STATIC))
{
LOG_SQLITE (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK,