package es.craftsmanship.toledo.katangapp.db;

import android.provider.BaseColumns;

/**
 * @author Manuel de la Peña
 */
public final class FavoritesContract {

    public FavoritesContract() {}

    private static final String TEXT_TYPE = " TEXT";
    private static final String COMMA_SEP = ",";
    private static final String SQL_CREATE_FAVORITES =
        "CREATE TABLE " + Favorite.TABLE_NAME + " (" +
            Favorite._ID + " INTEGER PRIMARY KEY" + COMMA_SEP + " " +
            Favorite.COLUMN_NAME_BUS_STOP_ID + " " + TEXT_TYPE +
        " )";

    private static final String SQL_DELETE_FAVORITES =
        "DROP TABLE IF EXISTS " + Favorite.TABLE_NAME;

    public static abstract class Favorite implements BaseColumns {

        public static final String TABLE_NAME = "favorite";
        public static final String COLUMN_NAME_BUS_STOP_ID = "busStopId";

    }

}
@@ -59,140 +59,871 @@
 oid.
-provider.BaseColumns;%0A%0A/**%0A * @author Manuel de la Pe%C3%B1a%0A */%0Apublic final class FavoritesContract %7B%0A%0A    public FavoritesContract() %7B
+content.Context;%0A%0Aimport android.database.sqlite.SQLiteDatabase;%0Aimport android.database.sqlite.SQLiteOpenHelper;%0A%0Aimport android.provider.BaseColumns;%0A%0A/**%0A * @author Manuel de la Pe%C3%B1a%0A */%0Apublic final class FavoritesContract extends SQLiteOpenHelper %7B%0A%0A    public static final int DATABASE_VERSION = 1;%0A    public static final String DATABASE_NAME = %22Katanga.db%22;%0A%0A    public FavoritesContract(Context context) %7B%0A        super(context, DATABASE_NAME, null, DATABASE_VERSION);%0A    %7D%0A%0A    public void onCreate(SQLiteDatabase db) %7B%0A        db.execSQL(SQL_CREATE_FAVORITES);%0A    %7D%0A%0A    public void onDowngrade(SQLiteDatabase db, int oldVersion, int newVersion) %7B%0A        onUpgrade(db, oldVersion, newVersion);%0A    %7D%0A%0A    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) %7B%0A        db.execSQL(SQL_DELETE_FAVORITES);%0A%0A        onCreate(db);%0A    
 %7D%0A%0A 

Extend SQLiteOpenHelper to manage db lifecycle