// Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/provider/ShoprContract.java
// public static class Items implements ItemsColumns, BaseColumns {
//     public static final Uri CONTENT_URI = BASE_CONTENT_URI.buildUpon()
//             .appendPath(PATH_ITEMS).build();
// 
//     /** Use if multiple items get returned */
//     public static final String CONTENT_TYPE = "vnd.android.cursor.dir/vnd.shopr.item";
// 
//     /** Use if a single item is returned */
//     public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/vnd.shopr.item";
// 
//     public static Uri buildItemUri(int itemId) {
//         return CONTENT_URI.buildUpon().appendPath(String.valueOf(itemId))
//                 .build();
//     }
// 
//     public static String getItemId(Uri uri) {
//         return uri.getLastPathSegment();
//     }
// }
// 
// Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/provider/ShoprContract.java
// public static class Shops implements ShopsColumns, BaseColumns {
//     public static final Uri CONTENT_URI = BASE_CONTENT_URI.buildUpon()
//             .appendPath(PATH_SHOPS).build();
// 
//     /** Use if multiple items get returned */
//     public static final String CONTENT_TYPE = "vnd.android.cursor.dir/vnd.shopr.shop";
// 
//     /** Use if a single item is returned */
//     public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/vnd.shopr.shop";
// 
//     public static Uri buildShopUri(int shopId) {
//         return CONTENT_URI.buildUpon().appendPath(String.valueOf(shopId))
//                 .build();
//     }
// 
//     public static String getShopId(Uri uri) {
//         return uri.getLastPathSegment();
//     }
// }
// 
// Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/provider/ShoprContract.java
// public static class Stats implements StatsColumns, BaseColumns {
//     public static final Uri CONTENT_URI = BASE_CONTENT_URI.buildUpon()
//             .appendPath(PATH_STATS).build();
// 
//     /** Use if multiple items get returned */
//     public static final String CONTENT_TYPE = "vnd.android.cursor.dir/vnd.shopr.stats";
// 
//     /** Use if a single item is returned */
//     public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/vnd.shopr.stats";
// 
//     public static Uri buildStatUri(int statId) {
//         return CONTENT_URI.buildUpon().appendPath(String.valueOf(statId))
//                 .build();
//     }
// 
//     public static String getStatId(Uri uri) {
//         return uri.getLastPathSegment();
//     }
// }


import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;
import com.uwetrottmann.shopr.provider.ShoprContract.Items;
import com.uwetrottmann.shopr.provider.ShoprContract.Shops;
import com.uwetrottmann.shopr.provider.ShoprContract.Stats;
            + ");";

    private static final String TAG = "ShoprDatabase";

    public ShoprDatabase(Context context) {
        super(context, DATABASE_NAME, null, DATABASE_VERSION);
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
        db.execSQL(CREATE_SHOPS_TABLE);

        // items refs shop ids, so create shops table first
        db.execSQL(CREATE_ITEMS_TABLE);

        db.execSQL(CREATE_STATS_TABLE);
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
        // always start from scratch
        onResetDatabase(db);
    }

    /**
     * Drops all tables and creates an empty database.
     */
    private void onResetDatabase(SQLiteDatabase db) {
        Log.w(TAG, "Database has incompatible version, starting from scratch");

// Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/provider/ShoprContract.java
// public static class Items implements ItemsColumns, BaseColumns {
//     public static final Uri CONTENT_URI = BASE_CONTENT_URI.buildUpon()
//             .appendPath(PATH_ITEMS).build();
// 
//     /** Use if multiple items get returned */
//     public static final String CONTENT_TYPE = "vnd.android.cursor.dir/vnd.shopr.item";
// 
//     /** Use if a single item is returned */
//     public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/vnd.shopr.item";
// 
//     public static Uri buildItemUri(int itemId) {
//         return CONTENT_URI.buildUpon().appendPath(String.valueOf(itemId))
//                 .build();
//     }
// 
//     public static String getItemId(Uri uri) {
//         return uri.getLastPathSegment();
//     }
// }
// 
// Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/provider/ShoprContract.java
// public static class Shops implements ShopsColumns, BaseColumns {
//     public static final Uri CONTENT_URI = BASE_CONTENT_URI.buildUpon()
//             .appendPath(PATH_SHOPS).build();
// 
//     /** Use if multiple items get returned */
//     public static final String CONTENT_TYPE = "vnd.android.cursor.dir/vnd.shopr.shop";
// 
//     /** Use if a single item is returned */
//     public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/vnd.shopr.shop";
// 
//     public static Uri buildShopUri(int shopId) {
//         return CONTENT_URI.buildUpon().appendPath(String.valueOf(shopId))
//                 .build();
//     }
// 
//     public static String getShopId(Uri uri) {
//         return uri.getLastPathSegment();
//     }
// }
// 
// Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/provider/ShoprContract.java
// public static class Stats implements StatsColumns, BaseColumns {
//     public static final Uri CONTENT_URI = BASE_CONTENT_URI.buildUpon()
//             .appendPath(PATH_STATS).build();
// 
//     /** Use if multiple items get returned */
//     public static final String CONTENT_TYPE = "vnd.android.cursor.dir/vnd.shopr.stats";
// 
//     /** Use if a single item is returned */
//     public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/vnd.shopr.stats";
// 
//     public static Uri buildStatUri(int statId) {
//         return CONTENT_URI.buildUpon().appendPath(String.valueOf(statId))
//                 .build();
//     }
// 
//     public static String getStatId(Uri uri) {
//         return uri.getLastPathSegment();
//     }
// }


// Path: Android/Shopr/src/main/java/com/uwetrottmann/shopr/provider/ShoprDatabase.java
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;
import com.uwetrottmann.shopr.provider.ShoprContract.Items;
import com.uwetrottmann.shopr.provider.ShoprContract.Shops;
import com.uwetrottmann.shopr.provider.ShoprContract.Stats;

            + ");";

    private static final String TAG = "ShoprDatabase";

    public ShoprDatabase(Context context) {
        super(context, DATABASE_NAME, null, DATABASE_VERSION);
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
        db.execSQL(CREATE_SHOPS_TABLE);

        // items refs shop ids, so create shops table first
        db.execSQL(CREATE_ITEMS_TABLE);

        db.execSQL(CREATE_STATS_TABLE);
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
        // always start from scratch
        onResetDatabase(db);
    }

    /**
     * Drops all tables and creates an empty database.
     */
    private void onResetDatabase(SQLiteDatabase db) {
        Log.w(TAG, "Database has incompatible version, starting from scratch");

        db.execSQL("DROP TABLE IF EXISTS " + Tables.ITEMS);