Android Open Source - inotes D B Creator






From Project

Back to project page inotes.

License

The source code is released under:

GNU General Public License

If you think the Android project inotes listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.codeminders.inotes.db;
/*ww  w .  jav a 2s  . c  o  m*/
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;
import com.codeminders.inotes.Constants;

public class DBCreator extends SQLiteOpenHelper {
    private static final String DATABASE_NAME = "inotes.db";
    private static final int DATABASE_VERSION = 2;

    private static final String CREATE_TABLE_NOTES =
            "create table notes"
                    + " (_id integer primary key autoincrement, "
                    + "date integer, "
                    + "title text, "
                    + "note text, "
                    + "account text, "
                    + "headers text, "
                    + "newNote integer);";

    private static final String CREATE_TABLE_SYNC_INFO =
            "create table syncinfo"
                    + " (_id integer primary key autoincrement, "
                    + "account text, "
                    + "date integer);";

    private static final String CREATE_TABLE_NOTES_TO_DELETE =
            "create table clear"
                    + " (_id integer primary key autoincrement, "
                    + "date integer, "
                    + "account text, "
                    + "identifier text);";

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


    @Override
    public void onCreate(SQLiteDatabase db) {
        db.execSQL(CREATE_TABLE_NOTES);
        db.execSQL(CREATE_TABLE_SYNC_INFO);
        db.execSQL(CREATE_TABLE_NOTES_TO_DELETE);
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
        DBUpgradeHelper upgradeHelper = new DBUpgradeHelper(db);
        try {
            upgradeHelper.exportNotesFromDB();
        } catch (Exception e) {
            Log.e(Constants.LOCAL_ACCOUNT_NAME, e.getMessage());
        }
        db.execSQL("drop table if exists notes");
        db.execSQL("drop table if exists syncinfo");
        db.execSQL("drop table if exists clear");
        onCreate(db);

        upgradeHelper.importNotesToDB();
    }

}




Java Source Code List

com.codeminders.inotes.AccountReceiver.java
com.codeminders.inotes.Constants.java
com.codeminders.inotes.Utils.java
com.codeminders.inotes.auth.AuthenticationService.java
com.codeminders.inotes.auth.AuthenticatorActivity.java
com.codeminders.inotes.auth.Authenticator.java
com.codeminders.inotes.auth.ConfigurationActivity.java
com.codeminders.inotes.db.DBCreator.java
com.codeminders.inotes.db.DBManager.java
com.codeminders.inotes.db.DBUpgradeHelper.java
com.codeminders.inotes.imap.HeaderUtils.java
com.codeminders.inotes.imap.ImapService.java
com.codeminders.inotes.imap.ImapSession.java
com.codeminders.inotes.model.AccountInfo.java
com.codeminders.inotes.model.Note.java
com.codeminders.inotes.sync.NotesProvider.java
com.codeminders.inotes.sync.NotesSyncService.java
com.codeminders.inotes.sync.SyncAccountInfo.java
com.codeminders.inotes.sync.SyncAdapter.java
com.codeminders.inotes.sync.SyncAllAccountsInfo.java
com.codeminders.inotes.sync.SyncHelper.java
com.codeminders.inotes.sync.SyncInfo.java
com.codeminders.inotes.ui.AccountsListActivity.java
com.codeminders.inotes.ui.LinedEditText.java
com.codeminders.inotes.ui.NoteEditorActivity.java
com.codeminders.inotes.ui.NotesListActivity.java
com.codeminders.inotes.ui.SettingsActivity.java