标题解释了这一切。
String method = String.format(
"SELECT studymap.id,studymap.title,studymap.zorder,studymap.hierarchy_id,studymap.book_id," +
"studymap.abstract,studymap.type,studymap.free_view,studymap.localpath,studymap.flags," +
"studymap.visit_status,downloads.status as download_status,downloads.studymap_id,studymap.publish_status "+
"FROM studymap LEFT JOIN downloads ON studymap.id = downloads.studymap_id" +
" WHERE studymap.book_id = %d ORDER BY studymap.zorder", book.ID);
book.ID是整数,但我仍然在某些设备上出现此错误:
android.database.sqlite.SQLiteException: no such column: ۵۴۵ (code 1): , while compiling: SELECT studymap.id,studymap.title,studymap.zorder,studymap.hierarchy_id,studymap.book_id,studymap.abstract,studymap.type,studymap.free_view,studymap.localpath,studymap.flags,studymap.visit_status,downloads.status as download_status,downloads.studymap_id,studymap.publish_status,hierarchy.is_owned FROM studymap LEFT JOIN downloads ON studymap.id = downloads.studymap_id LEFT JOIN hierarchy ON hierarchy.id = studymap.hierarchy_id WHERE studymap.hierarchy_id = ۵۴۵ ORDER BY studymap.zorder at com.nemo.kaman_android.core.ag.run(SqliteKit.java:303)
SqliteKit.java(303):
Cursor cursor = KamanDatabase.rawQuery(query, null);
我甚至在MyApplication.java中设置了应用程序默认语言环境
Locale locale = new Locale(Locale.ENGLISH.getLanguage());
Locale.setDefault(locale);
Configuration config = new Configuration();
config.locale = locale;
getBaseContext().getResources().updateConfiguration(config,
getBaseContext().getResources().getDisplayMetrics());
但这些显然还不够
我之前正在构建这样的查询:
"SELECT sum(badge) ... " + year_filter + ...
它在某些设备上崩溃并出现相同的错误。 但在使用格式后,一些调用得到修复,有些则没有。 我不知道我在想什么。
编辑2: 我想也许我在查询的中间放了一个utf8波斯字符,使得整数变成波斯语,但是现在我可以在崩溃日志中看到,同样的异常发生在不同设备上的不同查询中,我就是不能将所有东西放在一 其中一个设备有默认的“波斯语”语言环境,另一个设备有“en”,至少这是Acralyzer认为的。