Android Open Source - com.abcdabcd987.timesquared D B Helper






From Project

Back to project page com.abcdabcd987.timesquared.

License

The source code is released under:

MIT License

If you think the Android project com.abcdabcd987.timesquared 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.abcdabcd987.timesquared;
/*  w  ww  .  ja va  2s.c om*/
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDatabase.CursorFactory;
import android.database.sqlite.SQLiteOpenHelper;

public class DBHelper extends SQLiteOpenHelper {

    public DBHelper(Context context, String name, CursorFactory factory, int version) {
        super(context, name, factory, version);
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
        String sql = "CREATE TABLE record (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, category VARCHAR NOT NULL, content VARCHAR, date INTEGER NOT NULL, status VARCHAR DEFAULT \"enabled\" NOT NULL)";
        db.execSQL(sql);
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
        if (newVersion != oldVersion) {
            db.execSQL("DROP TABLE IF EXISTS record");
            onCreate(db);
        }
    }

}




Java Source Code List

com.abcdabcd987.timesquared.DBHelper.java
com.abcdabcd987.timesquared.RecordActivity.java