diff options
author | grothoff <grothoff@140774ce-b5e7-0310-ab8b-a85725594a96> | 2011-04-04 16:33:35 +0000 |
---|---|---|
committer | grothoff <grothoff@140774ce-b5e7-0310-ab8b-a85725594a96> | 2011-04-04 16:33:35 +0000 |
commit | bdc01fd155a622cd45cc9894bba5cf3ea0b9a5ed (patch) | |
tree | f37ac3df0333ebe310cccbeaa9ab1d82ebed2329 /src/datastore/plugin_datastore_sqlite.c | |
parent | a77380767bb43318e35cbe121cac6a17cc5edd11 (diff) |
removing dead API calls
git-svn-id: https://gnunet.org/svn/gnunet@14850 140774ce-b5e7-0310-ab8b-a85725594a96
Diffstat (limited to 'src/datastore/plugin_datastore_sqlite.c')
-rw-r--r-- | src/datastore/plugin_datastore_sqlite.c | 136 |
1 files changed, 0 insertions, 136 deletions
diff --git a/src/datastore/plugin_datastore_sqlite.c b/src/datastore/plugin_datastore_sqlite.c index f14855219c..501c9f2926 100644 --- a/src/datastore/plugin_datastore_sqlite.c +++ b/src/datastore/plugin_datastore_sqlite.c @@ -1079,141 +1079,6 @@ sqlite_plugin_iter_zero_anonymity (void *cls, /** - * Closure for 'all_next_prepare'. - */ -struct IterateAllContext -{ - - /** - * Offset for the current result. - */ - unsigned int off; - - /** - * Requested block type. - */ - enum GNUNET_BLOCK_Type type; - - /** - * Our prepared statement. - */ - sqlite3_stmt *stmt; -}; - - -/** - * Call sqlite using the already prepared query to get - * the next result. - * - * @param cls context with the prepared query (of type 'struct IterateAllContext') - * @param nc generic context with the prepared query - * @return GNUNET_OK on success, GNUNET_SYSERR on error, GNUNET_NO if - * there are no more results - */ -static int -all_next_prepare (void *cls, - struct NextContext *nc) -{ - struct IterateAllContext *iac = cls; - struct Plugin *plugin; - int ret; - unsigned int sqoff; - - if (nc == NULL) - { -#if DEBUG_SQLITE - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Asked to clean up iterator state.\n"); -#endif - if (NULL != iac->stmt) - { - sqlite3_finalize (iac->stmt); - iac->stmt = NULL; - } - return GNUNET_SYSERR; - } - plugin = nc->plugin; - sqoff = 1; - ret = SQLITE_OK; - if (iac->type != 0) - ret = sqlite3_bind_int (nc->stmt, sqoff++, iac->type); - if (SQLITE_OK == ret) - ret = sqlite3_bind_int64 (nc->stmt, sqoff++, iac->off++); - if (ret != SQLITE_OK) - { - LOG_SQLITE (plugin, NULL, - GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, "sqlite3_bind_XXXX"); - return GNUNET_SYSERR; - } - ret = sqlite3_step (nc->stmt); - switch (ret) - { - case SQLITE_ROW: - return GNUNET_OK; - case SQLITE_DONE: - return GNUNET_NO; - default: - LOG_SQLITE (plugin, NULL, - GNUNET_ERROR_TYPE_ERROR | - GNUNET_ERROR_TYPE_BULK, - "sqlite3_step"); - return GNUNET_SYSERR; - } -} - - -/** - * Select a subset of the items in the datastore and call - * the given iterator for each of them. - * - * @param cls our plugin context - * @param type entries of which type should be considered? - * Use 0 for any type. - * @param iter function to call on each matching value; - * will be called once with a NULL value at the end - * @param iter_cls closure for iter - */ -static void -sqlite_plugin_iter_all_now (void *cls, - enum GNUNET_BLOCK_Type type, - PluginIterator iter, - void *iter_cls) -{ - struct Plugin *plugin = cls; - struct NextContext *nc; - struct IterateAllContext *iac; - sqlite3_stmt *stmt; - const char *q; - - if (type == 0) - q = "SELECT type,prio,anonLevel,expire,hash,value,_ROWID_ FROM gn090 ORDER BY _ROWID_ ASC LIMIT 1 OFFSET ?"; - else - q = "SELECT type,prio,anonLevel,expire,hash,value,_ROWID_ FROM gn090 WHERE type=? ORDER BY _ROWID_ ASC LIMIT 1 OFFSET ?"; - if (sq_prepare (plugin->dbh, q, &stmt) != SQLITE_OK) - { - LOG_SQLITE (plugin, NULL, - GNUNET_ERROR_TYPE_ERROR | - GNUNET_ERROR_TYPE_BULK, "sqlite3_prepare_v2"); - iter (iter_cls, NULL, NULL, 0, NULL, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS, 0); - return; - } - nc = GNUNET_malloc (sizeof(struct NextContext) + - sizeof(struct IterateAllContext)); - iac = (struct IterateAllContext*) &nc[1]; - nc->plugin = plugin; - nc->iter = iter; - nc->iter_cls = iter_cls; - nc->stmt = stmt; - nc->prep = &all_next_prepare; - nc->prep_cls = iac; - iac->off = 0; - iac->type = type; - iac->stmt = stmt; /* alias used for freeing at the end */ - sqlite_next_request (nc, GNUNET_NO); -} - - -/** * Context for get_next_prepare. */ struct GetNextContext @@ -1732,7 +1597,6 @@ libgnunet_plugin_datastore_sqlite_init (void *cls) api->expiration_get = &sqlite_plugin_expiration_get; api->update = &sqlite_plugin_update; api->iter_zero_anonymity = &sqlite_plugin_iter_zero_anonymity; - api->iter_all_now = &sqlite_plugin_iter_all_now; api->drop = &sqlite_plugin_drop; GNUNET_log_from (GNUNET_ERROR_TYPE_INFO, "sqlite", _("Sqlite database running\n")); |