i have "food_db.sql" file stored in /res/raw folder, it has tons of 'insert' in it.
my question is how to i exec the file and get the data into sqlite databse in my android app?
here is the database code of mine. any sugguestions?
private static class DbHelper extends SQLiteOpenHelper{
public DbHelper(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION);
// TODO Auto-generated constructor stub
}
@Override
public void onCreate(SQLiteDatabase db) {
db.execSQL("CREATE TABLE " + DATABASE_TABLE + " (" +
KEY_ROWID + " INTEGER PRIMARY KEY AUTOINCREMENT, " +
KEY_NAME + " TEXT NOT NULL, " +
KEY_HOTNESS + " TEXT NOT NULL);");
// how do i exec the sql file and get the data into this DB table?
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
// TODO Auto-generated method stub
db.execSQL("DROP TABLE IF EXISTS" + DATABASE_TABLE);
db.execSQL("DROP TABLE IF EXISTS" + RECORD_TABLE);
onCreate(db);
}
}