Android Open Source - imslpdroid Data Storage Helper






From Project

Back to project page imslpdroid.

License

The source code is released under:

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, includin...

If you think the Android project imslpdroid 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.imslpdroid.data;
/*  w w  w  . j  a va2s. c  o m*/
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;

public class DataStorageHelper extends SQLiteOpenHelper {

  private static final String DB_NAME = "IMSLPDROID_DB";
  private static int DB_VERSION = 5;

  public DataStorageHelper(Context context) {
    super(context, DB_NAME, null, DB_VERSION);
  }

  @Override
  public void onCreate(SQLiteDatabase db) {
    db.execSQL("create table fileDownloaded(filename text, info text)");
    db.execSQL("create table genericlist(pageurl text, entry text)"); // from 4
  }

  @Override
  public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
    Log.i("datastoragehelper", String.format("onupgrade called with oldversion = %d and newversion =%d", oldVersion, newVersion));
    if (oldVersion < 1) { // just for history reference
      db.execSQL("create table composers(composername text primary key)"); 
    }
    if (oldVersion < 3) {
      db.execSQL("create table timeperiod(period text primary key)");
      db.execSQL("create table nationality(nation text primary key)");
      db.execSQL("create table worktypes(worktype text primary key)");
    }
    if (oldVersion < 4) {
      db.execSQL("create table genericlist(pageurl text, entry text)");
    }
    if (oldVersion < 5) {
      db.execSQL("drop table composers");
      db.execSQL("drop table timeperiod");
      db.execSQL("drop table instrumentations");
      db.execSQL("drop table nationality");
      db.execSQL("drop table worktypes");
    }

  }

}




Java Source Code List

com.imslpdroid.AboutAppActivity.java
com.imslpdroid.ComposersActivity.java
com.imslpdroid.DownloadedActivity.java
com.imslpdroid.ImslpdroidActivity.java
com.imslpdroid.InstrumentationActivity.java
com.imslpdroid.NationalityActivity.java
com.imslpdroid.PiecesActivity.java
com.imslpdroid.RestrictedComposersActivity.java
com.imslpdroid.ScoreDownloadActivity.java
com.imslpdroid.ScoresActivity.java
com.imslpdroid.TimePeriodActivity.java
com.imslpdroid.WorkTypesActivity.java
com.imslpdroid.data.DataStorageHelper.java
com.imslpdroid.data.DataStorage.java
com.imslpdroid.data.ExternalStorageUnavailableException.java
com.imslpdroid.data.Score.java
com.imslpdroid.gui.IntentUtils.java
com.imslpdroid.gui.RestrictableListView.java
com.imslpdroid.gui.ScoreAdapter.java
com.imslpdroid.gui.StorableRestrictableListView.java