1

在模拟器中重新安装我的应用程序后,我在数据库 Sqlite 中找不到我的数据,所以我该怎么办(注意:我从文件 .txt 填充数据库)。这是从 SqliteOpenHelper 扩展的类的一些代码

private static final String CREATE_TABLE_CATEGORIE = "CREATE TABLE " + TABLE_CATEGORIE + " ("
        + COL_ID_CATEGORIE + " INTEGER PRIMARY KEY AUTOINCREMENT, " + COL_INTITULE + " TEXT NOT NULL);";


private static final String CREATE_TABLE_BLAGUE = "CREATE TABLE " + TABLE_BLAGUE + " ("
        + COL_ID_BLAGUE + " INTEGER PRIMARY KEY AUTOINCREMENT, " + COL_TITRE_BLAGUE + " TEXT NOT NULL, "
        + COL_DESC_BLAGUE + " TEXT NOT NULL, "+ COL_FAVORIS+" INTEGER DEFAULT 0, "
        +COL_ID_CATEGBLAGUE+" INTEGER NOT NULL, FOREIGN KEY (" 
        + COL_ID_CATEGBLAGUE+") REFERENCES "+TABLE_CATEGORIE+"("+COL_ID_CATEGORIE+"));";





public DbBlague(Context context, String name, CursorFactory factory,int version) {

    super(context, name, factory, version);

}

@Override
public void onCreate(SQLiteDatabase db) {

    db.execSQL(CREATE_TABLE_CATEGORIE);
    db.execSQL(CREATE_TABLE_BLAGUE);


}

@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
    // TODO Auto-generated method stub

}
4

0 回答 0