android.database.sqlite.SQLiteException:没有这样的列:存在
android.database.sqlite.SQLiteException: no such column: exist
应用程序在非常特殊的情况下崩溃
如果我在本地设备是英语的情况下安装应用程序,则不会发生崩溃,并且一切正常。
如果我在安装英文版应用程序后将本地设备更改为阿拉伯语,也不会崩溃。
- 如果我卸载应用程序而不是将设备更改为本地阿拉伯语而不是第一次安装应用程序,则应用程序崩溃并且 logcat 不显示位置或哪一行,即使我不要在启动画面中调用本地数据库。
错误日志是:
android.database.sqlite.SQLiteException: no such column: ١٥٦٤٤١٠١٢٩٥٤٢ (code 1): , while compiling: DELETE FROM workspec WHERE state IN (2, 3, 5) AND (period_start_time + minimum_retention_duration) < ١٥٦٤٤١٠١٢٩٥٤٢ AND(SELECT COUNT(*)=0 FROM dependency WHERE prerequisite_id=id AND work_spec_id NOT IN (SELECT id FROM workspec WHERE state IN (2, 3, 5)))
#################################################################
Error Code : 1 (SQLITE_ERROR)
Caused By : SQL(query) error or missing database.
(no such column: ١٥٦٤٤١٠١٢٩٥٤٢ (code 1): , while compiling: DELETE FROM workspec WHERE state IN (2, 3, 5) AND (period_start_time + minimum_retention_duration) < ١٥٦٤٤١٠١٢٩٥٤٢ AND(SELECT COUNT(*)=0 FROM dependency WHERE prerequisite_id=id AND work_spec_id NOT IN (SELECT id FROM workspec WHERE state IN (2, 3, 5))))
#################################################################
at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method)
at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:1221)
at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:695)
at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:588)
at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:59)
at android.database.sqlite.SQLiteStatement.<init>(SQLiteStatement.java:31)
at android.database.sqlite.SQLiteDatabase.executeSql(SQLiteDatabase.java:2213)
at android.database.sqlite.SQLiteDatabase.execSQL(SQLiteDatabase.java:2142)
at android.arch.persistence.db.framework.FrameworkSQLiteDatabase.execSQL(FrameworkSQLiteDatabase.java:240)
at androidx.work.impl.WorkDatabase.onOpen(WorkDatabase.java:114)
at androidx.work.impl.WorkDatabase_Impl.onOpen(WorkDatabase_Impl.java:82)
at android.arch.persistence.room.RoomOpenHelper.onOpen(RoomOpenHelper.java:101)
at android.arch.persistence.db.framework.FrameworkSQLiteOpenHelper$OpenHelper.onOpen(FrameworkSQLiteOpenHelper.java:133)
at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:349)
at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:238)
at android.arch.persistence.db.framework.FrameworkSQLiteOpenHelper$OpenHelper.getWritableSupportDatabase(FrameworkSQLiteOpenHelper.java:93)
at android.arch.persistence.db.framework.FrameworkSQLiteOpenHelper.getWritableDatabase(FrameworkSQLiteOpenHelper.java:54)
at android.arch.persistence.room.RoomDatabase.compileStatement(RoomDatabase.java:204)
at android.arch.persistence.room.SharedSQLiteStatement.createNewStatement(SharedSQLiteStatement.java:65)
at android.arch.persistence.room.SharedSQLiteStatement.getStmt(SharedSQLiteStatement.java:72)
at android.arch.persistence.room.SharedSQLiteStatement.acquire(SharedSQLiteStatement.java:87)
at androidx.work.impl.model.WorkSpecDao_Impl.resetScheduledState(WorkSpecDao_Impl.java:326)
at androidx.work.impl.WorkManagerImpl.rescheduleEligibleWork(WorkManagerImpl.java:393)
at androidx.work.impl.utils.ForceStopRunnable.run(ForceStopRunnable.java:66)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
at java.lang.Thread.run(Thread.java:764)
我有 multi-able 数据库,但它们都与以下代码相同:
public static String getSqlCreation() {
return "CREATE TABLE IF NOT EXISTS " + TB_NAME + " (" + "id INTEGER PRIMARY KEY AUTOINCREMENT," +
Prodcut_id + " TEXT, " +
Prodcut_code + " TEXT, " +
Prodcut_name + " TEXT, " +
Prodcut_new_price + " TEXT, " +
Prodcut_old_price + " TEXT, " +
Prodcut_image + " TEXT, " +
Product_rating + " TEXT, " +
Product_quantity + " TEXT NOT NULL)";
}
public DBRecentViewHelper(Context context) {
super(context, DB_NAME, null, DB_VERSION);
}
@Override
public void onCreate(SQLiteDatabase db) {
try {
db.execSQL(DBRecentViewConstants.getSqlCreation());
} catch (SQLException e) {
e.printStackTrace();
}
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
db.execSQL("DROP TABLE IF EXISTS " + DBRecentViewConstants.TB_NAME);
onCreate(db);
}
更新
private DB_Tags_Helper DBhelper;
private SQLiteDatabase db;
public DB_Tags_Adapter(Context ctx) {
this.context = ctx;
DBhelper = new DB_Tags_Helper(context);
}
public DB_Tags_Adapter openDB() {
try {
db = DBhelper.getWritableDatabase();
} catch (SQLException e) {
e.printStackTrace();
}
return this;
}
public DB_Tags_Adapter open() throws SQLiteException {
db = DBhelper.getWritableDatabase();
return this;
}
public boolean isCreated() {
if (db != null) {
return db.isOpen();
}
return false;
}
public boolean isOpen() {
return db.isOpen();
}
public void close() {
try {
DBhelper.close();
db.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
public Cursor getAllData() {
String[] columns = {DB_Tags_Constants.ROW_ID, DB_Tags_Constants.Tag_name_Ar, DB_Tags_Constants.Tag_name_EN,
DB_Tags_Constants.Tag_Code};
return db.query(DB_Tags_Constants.TB_NAME, columns, null, null, null, null, null);
}
public void clear() { /// to clear whole DB
db.execSQL("delete from " + DB_Tags_Constants.TB_NAME);
}
public void Delete(String tablename, String pos) {
try {
db.delete(tablename, "tag_code" + "='" + pos + "'", null);
} catch (SQLException e) {
e.printStackTrace();
错误消息清晰明了
android.database.sqlite.SQLiteException: no such column: ١٥٦٤٤١٠١٢٩٥٤٢
以下情况为问题
(period_start_time + minimum_retention_duration) < ١٥٦٤٤١٠١٢٩٥٤٢
SQLite 需要比较列或数字 (0123456789)。这里你给出了阿拉伯语的数字(١٥٦٤٤١٠١٢٩٥٤٢)。确保它是英文的
我设法跟踪了这个问题,它在 android.arch.work
库中 implementation "android.arch.work:work-runtime:1.0.0-alpha01"
似乎他们使用本地数据库并且他们使用默认的本地查询而不是英语
应用程序在非常特殊的情况下崩溃
如果我在本地设备是英语的情况下安装应用程序,则不会发生崩溃,并且一切正常。
如果我在安装英文版应用程序后将本地设备更改为阿拉伯语,也不会崩溃。
- 如果我卸载应用程序而不是将设备更改为本地阿拉伯语而不是第一次安装应用程序,则应用程序崩溃并且 logcat 不显示位置或哪一行,即使我不要在启动画面中调用本地数据库。
错误日志是:
android.database.sqlite.SQLiteException: no such column: ١٥٦٤٤١٠١٢٩٥٤٢ (code 1): , while compiling: DELETE FROM workspec WHERE state IN (2, 3, 5) AND (period_start_time + minimum_retention_duration) < ١٥٦٤٤١٠١٢٩٥٤٢ AND(SELECT COUNT(*)=0 FROM dependency WHERE prerequisite_id=id AND work_spec_id NOT IN (SELECT id FROM workspec WHERE state IN (2, 3, 5)))
#################################################################
Error Code : 1 (SQLITE_ERROR)
Caused By : SQL(query) error or missing database.
(no such column: ١٥٦٤٤١٠١٢٩٥٤٢ (code 1): , while compiling: DELETE FROM workspec WHERE state IN (2, 3, 5) AND (period_start_time + minimum_retention_duration) < ١٥٦٤٤١٠١٢٩٥٤٢ AND(SELECT COUNT(*)=0 FROM dependency WHERE prerequisite_id=id AND work_spec_id NOT IN (SELECT id FROM workspec WHERE state IN (2, 3, 5))))
#################################################################
at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method)
at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:1221)
at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:695)
at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:588)
at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:59)
at android.database.sqlite.SQLiteStatement.<init>(SQLiteStatement.java:31)
at android.database.sqlite.SQLiteDatabase.executeSql(SQLiteDatabase.java:2213)
at android.database.sqlite.SQLiteDatabase.execSQL(SQLiteDatabase.java:2142)
at android.arch.persistence.db.framework.FrameworkSQLiteDatabase.execSQL(FrameworkSQLiteDatabase.java:240)
at androidx.work.impl.WorkDatabase.onOpen(WorkDatabase.java:114)
at androidx.work.impl.WorkDatabase_Impl.onOpen(WorkDatabase_Impl.java:82)
at android.arch.persistence.room.RoomOpenHelper.onOpen(RoomOpenHelper.java:101)
at android.arch.persistence.db.framework.FrameworkSQLiteOpenHelper$OpenHelper.onOpen(FrameworkSQLiteOpenHelper.java:133)
at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:349)
at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:238)
at android.arch.persistence.db.framework.FrameworkSQLiteOpenHelper$OpenHelper.getWritableSupportDatabase(FrameworkSQLiteOpenHelper.java:93)
at android.arch.persistence.db.framework.FrameworkSQLiteOpenHelper.getWritableDatabase(FrameworkSQLiteOpenHelper.java:54)
at android.arch.persistence.room.RoomDatabase.compileStatement(RoomDatabase.java:204)
at android.arch.persistence.room.SharedSQLiteStatement.createNewStatement(SharedSQLiteStatement.java:65)
at android.arch.persistence.room.SharedSQLiteStatement.getStmt(SharedSQLiteStatement.java:72)
at android.arch.persistence.room.SharedSQLiteStatement.acquire(SharedSQLiteStatement.java:87)
at androidx.work.impl.model.WorkSpecDao_Impl.resetScheduledState(WorkSpecDao_Impl.java:326)
at androidx.work.impl.WorkManagerImpl.rescheduleEligibleWork(WorkManagerImpl.java:393)
at androidx.work.impl.utils.ForceStopRunnable.run(ForceStopRunnable.java:66)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
at java.lang.Thread.run(Thread.java:764)
我有 multi-able 数据库,但它们都与以下代码相同:
public static String getSqlCreation() {
return "CREATE TABLE IF NOT EXISTS " + TB_NAME + " (" + "id INTEGER PRIMARY KEY AUTOINCREMENT," +
Prodcut_id + " TEXT, " +
Prodcut_code + " TEXT, " +
Prodcut_name + " TEXT, " +
Prodcut_new_price + " TEXT, " +
Prodcut_old_price + " TEXT, " +
Prodcut_image + " TEXT, " +
Product_rating + " TEXT, " +
Product_quantity + " TEXT NOT NULL)";
}
public DBRecentViewHelper(Context context) {
super(context, DB_NAME, null, DB_VERSION);
}
@Override
public void onCreate(SQLiteDatabase db) {
try {
db.execSQL(DBRecentViewConstants.getSqlCreation());
} catch (SQLException e) {
e.printStackTrace();
}
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
db.execSQL("DROP TABLE IF EXISTS " + DBRecentViewConstants.TB_NAME);
onCreate(db);
}
更新
private DB_Tags_Helper DBhelper;
private SQLiteDatabase db;
public DB_Tags_Adapter(Context ctx) {
this.context = ctx;
DBhelper = new DB_Tags_Helper(context);
}
public DB_Tags_Adapter openDB() {
try {
db = DBhelper.getWritableDatabase();
} catch (SQLException e) {
e.printStackTrace();
}
return this;
}
public DB_Tags_Adapter open() throws SQLiteException {
db = DBhelper.getWritableDatabase();
return this;
}
public boolean isCreated() {
if (db != null) {
return db.isOpen();
}
return false;
}
public boolean isOpen() {
return db.isOpen();
}
public void close() {
try {
DBhelper.close();
db.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
public Cursor getAllData() {
String[] columns = {DB_Tags_Constants.ROW_ID, DB_Tags_Constants.Tag_name_Ar, DB_Tags_Constants.Tag_name_EN,
DB_Tags_Constants.Tag_Code};
return db.query(DB_Tags_Constants.TB_NAME, columns, null, null, null, null, null);
}
public void clear() { /// to clear whole DB
db.execSQL("delete from " + DB_Tags_Constants.TB_NAME);
}
public void Delete(String tablename, String pos) {
try {
db.delete(tablename, "tag_code" + "='" + pos + "'", null);
} catch (SQLException e) {
e.printStackTrace();
错误消息清晰明了
android.database.sqlite.SQLiteException: no such column: ١٥٦٤٤١٠١٢٩٥٤٢
以下情况为问题
(period_start_time + minimum_retention_duration) < ١٥٦٤٤١٠١٢٩٥٤٢
SQLite 需要比较列或数字 (0123456789)。这里你给出了阿拉伯语的数字(١٥٦٤٤١٠١٢٩٥٤٢)。确保它是英文的
我设法跟踪了这个问题,它在 android.arch.work
库中 implementation "android.arch.work:work-runtime:1.0.0-alpha01"
似乎他们使用本地数据库并且他们使用默认的本地查询而不是英语