Back to project page Now_Manager.
The source code is released under:
Apache License
If you think the Android project Now_Manager listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.collinguarino.nowmanager.provider; //ww w . ja v a2 s . com import android.content.Context; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; /** * Helper class that actually creates and manages the provider's underlying data repository. */ public final class MainDatabaseHelper extends SQLiteOpenHelper { // Defines the database name static final String DBNAME = "nowManagerDb"; /* * Instantiates an open helper for the provider's SQLite data repository * Do not do database creation and upgrade here. */ public MainDatabaseHelper(Context context) { super(context, DBNAME, null, 7); // increment database version (last param) } /* * Creates the data repository. This is called when the provider attempts to open the * repository and SQLite reports that it doesn't exist. */ public void onCreate(SQLiteDatabase db) { // Creates the main table db.execSQL(Contracts.TimeCards.SQL_CREATE_MAIN); } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { if (oldVersion == 6 && newVersion >= 7) { db.execSQL("ALTER TABLE " + "timeCards" + " ADD COLUMN " + "address" + " string"); db.execSQL("UPDATE " + "timeCards" + " SET " + "address" + "= null"); } } }