Created
February 2, 2020 12:45
-
-
Save thanhnh98/fc673ec320fefc9463afc933e3c99f78 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class FeedReaderDbHelper extends SQLiteOpenHelper { | |
// If you change the database schema, you must increment the database version. | |
public static final int DATABASE_VERSION = 1; | |
public static final String DATABASE_NAME = "FeedReader.db"; | |
public FeedReaderDbHelper(Context context) { | |
super(context, DATABASE_NAME, null, DATABASE_VERSION); | |
} | |
public void onCreate(SQLiteDatabase db) { | |
db.execSQL(SQL_CREATE_ENTRIES); | |
} | |
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { | |
// This database is only a cache for online data, so its upgrade policy is | |
// to simply to discard the data and start over | |
db.execSQL(SQL_DELETE_ENTRIES); | |
onCreate(db); | |
} | |
public void onDowngrade(SQLiteDatabase db, int oldVersion, int newVersion) { | |
onUpgrade(db, oldVersion, newVersion); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment