+
+ if ( (SQLITE_OK !=
+ sq_prepare (plugin->dbh,
+ "INSERT INTO ds091 (type, expire, key, prox, value, path) "
+ "VALUES (?, ?, ?, ?, ?, ?)",
+ &plugin->insert_stmt)) ||
+ (SQLITE_OK !=
+ sq_prepare (plugin->dbh,
+ "SELECT count(*) FROM ds091 "
+ "WHERE key=? AND type=? AND expire >= ?",
+ &plugin->get_count_stmt)) ||
+ (SQLITE_OK !=
+ sq_prepare (plugin->dbh,
+ "SELECT value,expire,path FROM ds091"
+ " WHERE key=? AND type=? AND expire >= ? LIMIT 1 OFFSET ?",
+ &plugin->get_stmt)) ||
+ (SQLITE_OK !=
+ sq_prepare (plugin->dbh,
+ "SELECT _ROWID_,key,value FROM ds091"
+ " WHERE expire < ?"
+ " ORDER BY expire ASC LIMIT 1",
+ &plugin->del_expired_stmt)) ||
+ (SQLITE_OK !=
+ sq_prepare (plugin->dbh,
+ "SELECT _ROWID_,key,value FROM ds091"
+ " ORDER BY prox ASC, expire ASC LIMIT 1",
+ &plugin->del_select_stmt)) ||
+ (SQLITE_OK !=
+ sq_prepare (plugin->dbh,
+ "DELETE FROM ds091 WHERE _ROWID_=?",
+ &plugin->del_stmt)) ||
+ (SQLITE_OK !=
+ sq_prepare (plugin->dbh,
+ "SELECT value,expire,path,key,type FROM ds091 "
+ "ORDER BY key LIMIT 1 OFFSET ?",
+ &plugin->get_random_stmt)) ||
+ (SQLITE_OK !=
+ sq_prepare (plugin->dbh,
+ "SELECT value,expire,path,type,key FROM ds091 "
+ "WHERE key>=? AND expire >= ? ORDER BY KEY ASC LIMIT ?",
+ &plugin->get_closest_stmt))
+ )
+ {
+ LOG_SQLITE (plugin->dbh,
+ GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK,
+ "sq_prepare");
+ GNUNET_break (SQLITE_OK ==
+ sqlite3_close (plugin->dbh));
+ GNUNET_free (plugin);
+ return NULL;
+ }
+