我制作了一个包含 3 列的 SQLite 高分;排名(整数),分数(长)和百分比(整数)。我正在尝试从列中提取所有数据,并将它们与用户刚刚获得的分数进行比较,以查看他们的新分数是否进入了前 10 名的高分列表。
我希望先按百分比对高分进行优先排序,然后再得分以打破任何平局。下面是我开始这样做的地方。我在正确的轨道上吗?即使在 Java 之外,我也从未使用过 SQLite,所以这对我来说都是全新的。
预先感谢您的帮助。
//Check if new record makes the top 10.
public boolean check(int rank, long score, int percentage) {
//SQL query to get last score/percentage if highscores has 10 records...
long[] scores = new long[9];
int[] percentages = new int[9];
scores = db.execSQL("SELECT " + SCORE + " FROM " + TABLE + ";"); //Error: Type mismatch
percentages = db.execSQL("SELECT " + PERCENTAGE + " FROM " + TABLE + ";"); //Error: Type mismatch
//Algorithms to compare scores and percentages go here...
}