我正在尝试在 Phonegap 上使用 Sqlite 对 SQL 排序数据进行排序,但结果不正确!这将是:abcçdeéě
我的代码:
db.transaction(function(tx){
tx.executeSql('SELECT id,keyword FROM Glossary ORDER BY lower(keyword) COLLATE NOCASE',[] , function(tx, results){
var lastAlpha = "*";
for(i=0;i<results.rows.length;i++){
var firstChr = results.rows.item(i).keyword.substring(0,1).toUpperCase();
if(firstChr!=lastAlpha){
console.log(firstChr);
lastAlpha = firstChr;
}
}
},errorCB2);
});
结果 :
2012-11-22 17:14:14.641[15032:c07] [LOG] A
2012-11-22 17:14:14.641[15032:c07] [LOG] B
2012-11-22 17:14:14.642[15032:c07] [LOG] C
2012-11-22 17:14:14.644[15032:c07] [LOG] D
2012-11-22 17:14:14.645[15032:c07] [LOG] E
2012-11-22 17:14:14.646[15032:c07] [LOG] F
2012-11-22 17:14:14.647[15032:c07] [LOG] G
2012-11-22 17:14:14.648[15032:c07] [LOG] H
2012-11-22 17:14:14.649[15032:c07] [LOG] I
2012-11-22 17:14:14.650[15032:c07] [LOG] J
2012-11-22 17:14:14.651[15032:c07] [LOG] K
2012-11-22 17:14:14.652[15032:c07] [LOG] L
2012-11-22 17:14:14.654[15032:c07] [LOG] M
2012-11-22 17:14:14.655[15032:c07] [LOG] N
2012-11-22 17:14:14.656[15032:c07] [LOG] O
2012-11-22 17:14:14.657[15032:c07] [LOG] P
2012-11-22 17:14:14.658[15032:c07] [LOG] Q
2012-11-22 17:14:14.659[15032:c07] [LOG] R
2012-11-22 17:14:14.660[15032:c07] [LOG] S
2012-11-22 17:14:14.661[15032:c07] [LOG] T
2012-11-22 17:14:14.662[15032:c07] [LOG] U
2012-11-22 17:14:14.664[15032:c07] [LOG] V
2012-11-22 17:14:14.665[15032:c07] [LOG] W
2012-11-22 17:14:14.666[15032:c07] [LOG] X
2012-11-22 17:14:14.668[15032:c07] [LOG] Y
2012-11-22 17:14:14.669[15032:c07] [LOG] Z
2012-11-22 17:14:14.671[15032:c07] [LOG] Ç
2012-11-22 17:14:14.672[15032:c07] [LOG] É
2012-11-22 17:14:14.673[15032:c07] [LOG] Ö
2012-11-22 17:14:14.674[15032:c07] [LOG] Ü
2012-11-22 17:14:14.674[15032:c07] [LOG] İ
2012-11-22 17:14:14.676[15032:c07] [LOG] Ş
我在 The Last 看过像“拉丁人物”这样的作品。!你有什么想法吗?