我做了一个有3列的SQLite高分:rank(整型),score(长整型)和percentage(整型)。我正在尝试从列中提取所有数据,并将它们与用户刚刚获得的分数进行比较,看看他们的新分数是否进入了包含前10名的高分数列表。
我希望高分优先按百分比,然后得分,以打破任何平局。下面是我开始做这件事的地方。我是在正确的轨道上吗?我从来没有使用过SQLite,甚至在Java之外,所以这对我来说都是全新的。
提前感谢您的帮助。
//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...
}https://stackoverflow.com/questions/14058520
复制相似问题