aboutsummaryrefslogtreecommitdiff
path: root/src/datacache/plugin_datacache_sqlite.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/datacache/plugin_datacache_sqlite.c')
-rw-r--r--src/datacache/plugin_datacache_sqlite.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/datacache/plugin_datacache_sqlite.c b/src/datacache/plugin_datacache_sqlite.c
index db27de3e2..26792e1fb 100644
--- a/src/datacache/plugin_datacache_sqlite.c
+++ b/src/datacache/plugin_datacache_sqlite.c
@@ -37,7 +37,7 @@
37 * How much overhead do we assume per entry in the 37 * How much overhead do we assume per entry in the
38 * datacache? 38 * datacache?
39 */ 39 */
40#define OVERHEAD (sizeof(GNUNET_HashCode) + 32) 40#define OVERHEAD (sizeof(struct GNUNET_HashCode) + 32)
41 41
42/** 42/**
43 * Context for all functions in this plugin. 43 * Context for all functions in this plugin.
@@ -98,7 +98,7 @@ sq_prepare (sqlite3 * dbh, const char *zSql, /* SQL statement, UTF-8 encoded
98 * @return 0 on error, number of bytes used otherwise 98 * @return 0 on error, number of bytes used otherwise
99 */ 99 */
100static size_t 100static size_t
101sqlite_plugin_put (void *cls, const GNUNET_HashCode * key, size_t size, 101sqlite_plugin_put (void *cls, const struct GNUNET_HashCode * key, size_t size,
102 const char *data, enum GNUNET_BLOCK_Type type, 102 const char *data, enum GNUNET_BLOCK_Type type,
103 struct GNUNET_TIME_Absolute discard_time) 103 struct GNUNET_TIME_Absolute discard_time)
104{ 104{
@@ -126,7 +126,7 @@ sqlite_plugin_put (void *cls, const GNUNET_HashCode * key, size_t size,
126 if ((SQLITE_OK != sqlite3_bind_int (stmt, 1, type)) || 126 if ((SQLITE_OK != sqlite3_bind_int (stmt, 1, type)) ||
127 (SQLITE_OK != sqlite3_bind_int64 (stmt, 2, dval)) || 127 (SQLITE_OK != sqlite3_bind_int64 (stmt, 2, dval)) ||
128 (SQLITE_OK != 128 (SQLITE_OK !=
129 sqlite3_bind_blob (stmt, 3, key, sizeof (GNUNET_HashCode), 129 sqlite3_bind_blob (stmt, 3, key, sizeof (struct GNUNET_HashCode),
130 SQLITE_TRANSIENT)) || 130 SQLITE_TRANSIENT)) ||
131 (SQLITE_OK != sqlite3_bind_blob (stmt, 4, data, size, SQLITE_TRANSIENT))) 131 (SQLITE_OK != sqlite3_bind_blob (stmt, 4, data, size, SQLITE_TRANSIENT)))
132 { 132 {
@@ -161,7 +161,7 @@ sqlite_plugin_put (void *cls, const GNUNET_HashCode * key, size_t size,
161 * @return the number of results found 161 * @return the number of results found
162 */ 162 */
163static unsigned int 163static unsigned int
164sqlite_plugin_get (void *cls, const GNUNET_HashCode * key, 164sqlite_plugin_get (void *cls, const struct GNUNET_HashCode * key,
165 enum GNUNET_BLOCK_Type type, GNUNET_DATACACHE_Iterator iter, 165 enum GNUNET_BLOCK_Type type, GNUNET_DATACACHE_Iterator iter,
166 void *iter_cls) 166 void *iter_cls)
167{ 167{
@@ -192,7 +192,7 @@ sqlite_plugin_get (void *cls, const GNUNET_HashCode * key,
192 ntime = (int64_t) now.abs_value; 192 ntime = (int64_t) now.abs_value;
193 GNUNET_assert (ntime >= 0); 193 GNUNET_assert (ntime >= 0);
194 if ((SQLITE_OK != 194 if ((SQLITE_OK !=
195 sqlite3_bind_blob (stmt, 1, key, sizeof (GNUNET_HashCode), 195 sqlite3_bind_blob (stmt, 1, key, sizeof (struct GNUNET_HashCode),
196 SQLITE_TRANSIENT)) || 196 SQLITE_TRANSIENT)) ||
197 (SQLITE_OK != sqlite3_bind_int (stmt, 2, type)) || 197 (SQLITE_OK != sqlite3_bind_int (stmt, 2, type)) ||
198 (SQLITE_OK != sqlite3_bind_int64 (stmt, 3, now.abs_value))) 198 (SQLITE_OK != sqlite3_bind_int64 (stmt, 3, now.abs_value)))
@@ -239,7 +239,7 @@ sqlite_plugin_get (void *cls, const GNUNET_HashCode * key,
239 return cnt; 239 return cnt;
240 } 240 }
241 if ((SQLITE_OK != 241 if ((SQLITE_OK !=
242 sqlite3_bind_blob (stmt, 1, key, sizeof (GNUNET_HashCode), 242 sqlite3_bind_blob (stmt, 1, key, sizeof (struct GNUNET_HashCode),
243 SQLITE_TRANSIENT)) || 243 SQLITE_TRANSIENT)) ||
244 (SQLITE_OK != sqlite3_bind_int (stmt, 2, type)) || 244 (SQLITE_OK != sqlite3_bind_int (stmt, 2, type)) ||
245 (SQLITE_OK != sqlite3_bind_int64 (stmt, 3, now.abs_value))) 245 (SQLITE_OK != sqlite3_bind_int64 (stmt, 3, now.abs_value)))
@@ -287,7 +287,7 @@ sqlite_plugin_del (void *cls)
287 unsigned int dsize; 287 unsigned int dsize;
288 sqlite3_stmt *stmt; 288 sqlite3_stmt *stmt;
289 sqlite3_stmt *dstmt; 289 sqlite3_stmt *dstmt;
290 GNUNET_HashCode hc; 290 struct GNUNET_HashCode hc;
291 291
292 LOG (GNUNET_ERROR_TYPE_DEBUG, "Processing `%s'\n", "DEL"); 292 LOG (GNUNET_ERROR_TYPE_DEBUG, "Processing `%s'\n", "DEL");
293 stmt = NULL; 293 stmt = NULL;
@@ -311,8 +311,8 @@ sqlite_plugin_del (void *cls)
311 return GNUNET_SYSERR; 311 return GNUNET_SYSERR;
312 } 312 }
313 rowid = sqlite3_column_int64 (stmt, 0); 313 rowid = sqlite3_column_int64 (stmt, 0);
314 GNUNET_assert (sqlite3_column_bytes (stmt, 1) == sizeof (GNUNET_HashCode)); 314 GNUNET_assert (sqlite3_column_bytes (stmt, 1) == sizeof (struct GNUNET_HashCode));
315 memcpy (&hc, sqlite3_column_blob (stmt, 1), sizeof (GNUNET_HashCode)); 315 memcpy (&hc, sqlite3_column_blob (stmt, 1), sizeof (struct GNUNET_HashCode));
316 dsize = sqlite3_column_bytes (stmt, 2); 316 dsize = sqlite3_column_bytes (stmt, 2);
317 if (SQLITE_OK != sqlite3_finalize (stmt)) 317 if (SQLITE_OK != sqlite3_finalize (stmt))
318 LOG_SQLITE (plugin->dbh, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, 318 LOG_SQLITE (plugin->dbh, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK,