我正在尝试更新我的数据库,以添加另一个名为Visible的列。我希望整个列都填充假值。当我运行代码时,它会到达update函数并抛出以下错误:
android.database.sqlite.SQLiteException: no such column: true: UPDATE Themes2 SET Visibility = true;
private static final String TABLE_THEMES_V2 = "Themes2";
public static final String KEY_VISIBLE = "Visibility";
if (oldVersion < 8) {
db.execSQL("ALTER TABLE " + TABLE_THEMES_V2 + " ADD COLUMN " + KEY_VISIBLE + " text");
db.execSQL("UPDATE " + TABLE_THEMES_V2 + " SET " + KEY_VISIBLE + " = true;");
db.setTransactionSuccessful();
}
有人知道怎么了吗?我很久以前用过这个函数在列中输入“1”。。。