- /*
- * This file is part of GNUnet
- * Copyright (C) 2009-2017 GNUnet e.V.
- *
- * GNUnet is free software: you can redistribute it and/or modify it
- * under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License,
- * or (at your option) any later version.
- *
- * GNUnet is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
+/*
+ * This file is part of GNUnet
+ * Copyright (C) 2009-2017 GNUnet e.V.
+ *
+ * GNUnet is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published
+ * by the Free Software Foundation, either version 3 of the License,
+ * or (at your option) any later version.
+ *
+ * GNUnet is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
/**
* @file namestore/plugin_namestore_sqlite.c
&sqlite_filename))
{
GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
- "namestore-sqlite",
+ "namestore-sqlite",
"FILENAME");
return GNUNET_SYSERR;
}
&plugin->dbh))
{
LOG (GNUNET_ERROR_TYPE_ERROR,
- _("Unable to initialize SQLite: %s.\n"),
- sqlite3_errmsg (plugin->dbh));
+ _("Unable to initialize SQLite: %s.\n"),
+ sqlite3_errmsg (plugin->dbh));
return GNUNET_SYSERR;
}
GNUNET_break (SQLITE_OK ==
{
GNUNET_break (0);
LOG (GNUNET_ERROR_TYPE_ERROR,
- _("Failed to setup database at `%s'\n"),
- plugin->fn);
+ _("Failed to setup database at `%s'\n"),
+ plugin->fn);
return GNUNET_SYSERR;
}
{
GNUNET_break (0);
LOG (GNUNET_ERROR_TYPE_ERROR,
- _("Failed to setup database at `%s'\n"),
- plugin->fn);
+ _("Failed to setup database at `%s'\n"),
+ plugin->fn);
return GNUNET_SYSERR;
}
return GNUNET_OK;
if (result == SQLITE_BUSY)
{
LOG (GNUNET_ERROR_TYPE_WARNING,
- _("Tried to close sqlite without finalizing all prepared statements.\n"));
+ _("Tried to close sqlite without finalizing all prepared statements.\n"));
stmt = sqlite3_next_stmt (plugin->dbh,
NULL);
while (NULL != stmt)
*/
static int
namestore_sqlite_store_records (void *cls,
- const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone_key,
- const char *label,
- unsigned int rd_count,
- const struct GNUNET_GNSRECORD_Data *rd)
+ const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone_key,
+ const char *label,
+ unsigned int rd_count,
+ const struct GNUNET_GNSRECORD_Data *rd)
{
struct Plugin *plugin = cls;
int n;
ssize_t data_size;
memset (&pkey,
- 0,
- sizeof (pkey));
+ 0,
+ sizeof (pkey));
for (unsigned int i=0;i<rd_count;i++)
if (GNUNET_GNSRECORD_TYPE_PKEY == rd[i].record_type)
{
ssize_t ret;
ret = GNUNET_GNSRECORD_records_serialize (rd_count,
- rd,
- data_size,
- data);
+ rd,
+ data_size,
+ data);
if ( (ret < 0) ||
- (data_size != ret) )
+ (data_size != ret) )
{
GNUNET_break (0);
return GNUNET_SYSERR;
dparams))
{
LOG_SQLITE (plugin,
- GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK,
- "sqlite3_bind_XXXX");
+ GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK,
+ "sqlite3_bind_XXXX");
GNUNET_SQ_reset (plugin->dbh,
plugin->delete_records);
return GNUNET_SYSERR;
GNUNET_SQ_bind (plugin->store_records,
sparams))
{
- LOG_SQLITE (plugin,
- GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK,
- "sqlite3_bind_XXXX");
+ LOG_SQLITE (plugin,
+ GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK,
+ "sqlite3_bind_XXXX");
GNUNET_SQ_reset (plugin->dbh,
plugin->store_records);
- return GNUNET_SYSERR;
+ return GNUNET_SYSERR;
}
n = sqlite3_step (plugin->store_records);
GNUNET_SQ_reset (plugin->dbh,
}
switch (n)
{
- case SQLITE_DONE:
- if (0 != rd_count)
- GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG,
- "sqlite",
- "Record stored\n");
- else
- GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG,
- "sqlite",
- "Record deleted\n");
- return GNUNET_OK;
- case SQLITE_BUSY:
- LOG_SQLITE (plugin,
- GNUNET_ERROR_TYPE_WARNING | GNUNET_ERROR_TYPE_BULK,
- "sqlite3_step");
- return GNUNET_NO;
- default:
- LOG_SQLITE (plugin,
- GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK,
- "sqlite3_step");
- return GNUNET_SYSERR;
+ case SQLITE_DONE:
+ if (0 != rd_count)
+ GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG,
+ "sqlite",
+ "Record stored\n");
+ else
+ GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG,
+ "sqlite",
+ "Record deleted\n");
+ return GNUNET_OK;
+ case SQLITE_BUSY:
+ LOG_SQLITE (plugin,
+ GNUNET_ERROR_TYPE_WARNING | GNUNET_ERROR_TYPE_BULK,
+ "sqlite3_step");
+ return GNUNET_NO;
+ default:
+ LOG_SQLITE (plugin,
+ GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK,
+ "sqlite3_step");
+ return GNUNET_SYSERR;
}
}
if (SQLITE_DONE == sret)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Iteration done (no results)\n");
+ "Iteration done (no results)\n");
ret = GNUNET_NO;
break;
}
if (SQLITE_ROW != sret)
{
LOG_SQLITE (plugin,
- GNUNET_ERROR_TYPE_ERROR,
- "sqlite_step");
+ GNUNET_ERROR_TYPE_ERROR,
+ "sqlite_step");
ret = GNUNET_SYSERR;
break;
}
GNUNET_SQ_result_spec_uint64 (&seq),
GNUNET_SQ_result_spec_uint32 (&record_count),
GNUNET_SQ_result_spec_variable_size (&data,
- &data_size),
+ &data_size),
GNUNET_SQ_result_spec_string (&label),
GNUNET_SQ_result_spec_end
};
GNUNET_SQ_result_spec_uint64 (&seq),
GNUNET_SQ_result_spec_uint32 (&record_count),
GNUNET_SQ_result_spec_variable_size (&data,
- &data_size),
+ &data_size),
GNUNET_SQ_result_spec_string (&label),
GNUNET_SQ_result_spec_auto_from_type (&zk),
GNUNET_SQ_result_spec_end
zk = *zone_key;
if (NULL != iter)
iter (iter_cls,
- seq,
+ seq,
&zk,
label,
record_count,
*/
static int
namestore_sqlite_iterate_records (void *cls,
- const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone,
- uint64_t serial,
+ const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone,
+ uint64_t serial,
uint64_t limit,
- GNUNET_NAMESTORE_RecordIterator iter,
+ GNUNET_NAMESTORE_RecordIterator iter,
void *iter_cls)
{
struct Plugin *plugin = cls;
{
LOG_SQLITE (plugin,
GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK,
- "sqlite3_bind_XXXX");
+ "sqlite3_bind_XXXX");
GNUNET_SQ_reset (plugin->dbh,
stmt);
return GNUNET_SYSERR;
*/
static int
namestore_sqlite_zone_to_name (void *cls,
- const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone,
- const struct GNUNET_CRYPTO_EcdsaPublicKey *value_zone,
- GNUNET_NAMESTORE_RecordIterator iter,
- void *iter_cls)
+ const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone,
+ const struct GNUNET_CRYPTO_EcdsaPublicKey *value_zone,
+ GNUNET_NAMESTORE_RecordIterator iter,
+ void *iter_cls)
{
struct Plugin *plugin = cls;
struct GNUNET_SQ_QueryParam params[] = {
{
LOG_SQLITE (plugin,
GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK,
- "sqlite3_bind_XXXX");
+ "sqlite3_bind_XXXX");
GNUNET_SQ_reset (plugin->dbh,
plugin->zone_to_name);
return GNUNET_SYSERR;