@@ -0,0 +1,1707 @@
+/*%0A * %5BNayati%5D DbHelper.java%0A *%0A * Implements helper for database operations.%0A *%0A * (c) 2015 Sanjeev Premi (spremi@ymail.com)%0A *%0A * SPDX-License-Identifier: BSD-3-Clause%0A *                          (http://spdx.org/licenses/BSD-3-Clause.html)%0A *%0A */%0A%0A%0Apackage self.premi.sanjeev.nayati.db;%0A%0Aimport android.content.Context;%0Aimport android.database.sqlite.SQLiteDatabase;%0Aimport android.database.sqlite.SQLiteOpenHelper;%0A%0A%0A/**%0A * Helper for database operations. Uses singleton pattern.%0A */%0Apublic class DbHelper extends SQLiteOpenHelper %7B%0A    /**%0A     * Name of database%0A     */%0A    private static final String DATABASE_NAME = %22Nayati.db%22;%0A%0A    /**%0A     * Version of database%0A     */%0A    private static final int DATABASE_VERSION = 1;%0A%0A    /**%0A     * Instance of %22this%22 class%0A     */%0A    private static DbHelper self;%0A%0A%0A    /**%0A     * Constructor%0A     */%0A    private DbHelper(Context context) %7B%0A        super(context, DATABASE_NAME , null, DATABASE_VERSION);%0A    %7D%0A%0A    /**%0A     * Get instance of this object.%0A     */%0A    public static synchronized DbHelper getInstance(Context context)%0A    %7B%0A        if (self == null) %7B%0A            self = new DbHelper(context.getApplicationContext());%0A        %7D%0A%0A        return self;%0A    %7D%0A%0A    @Override%0A    public synchronized void close() %7B%0A        super.close();%0A    %7D%0A%0A    @Override%0A    public synchronized void onCreate(SQLiteDatabase db)%0A    %7B%0A    %7D%0A%0A    @Override%0A    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) %7B%0A        /*%0A         * TODO:%0A         * 1) Export data from existing tables%0A         * 2) Drop tables%0A         * 3) Create new tables%0A         * 4) Import data exported in step 1.%0A         */%0A%0A        onCreate(db);%0A    %7D%0A%0A%7D%0A

Add a helper for database operations