Android Open Source - WAIDRecognizer Database Open Helper






From Project

Back to project page WAIDRecognizer.

License

The source code is released under:

GNU General Public License

If you think the Android project WAIDRecognizer 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 it.unibo.cs.jonus.waidrec;
//from   ww  w.j av a 2s.  co  m
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public class DatabaseOpenHelper extends SQLiteOpenHelper {

  private static final int DATABASE_VERSION = 7;
  public static final String DATABASE_NAME = "waid.db";
  public static final String TABLE_EVALUATIONS = "evaluations";
  public static final String TABLE_TRAINING_DATA = "training_data";
  public static final String TABLE_VEHICLES = "vehicles";

  public static final String COLUMN_ID = "_id";
  // evaluations table columns
  public static final String COLUMN_CATEGORY = "category";
  public static final String COLUMN_TIMESTAMP = "timestamp";
  public static final String COLUMN_AVGA = "avga";
  public static final String COLUMN_MINA = "mina";
  public static final String COLUMN_MAXA = "maxa";
  public static final String COLUMN_STDA = "stda";
  public static final String COLUMN_AVGG = "avgg";
  public static final String COLUMN_MING = "ming";
  public static final String COLUMN_MAXG = "maxg";
  public static final String COLUMN_STDG = "stdg";
  public static final String COLUMN_ICON = "icon";

  // history table creation query
  private static final String CREATE_TABLE_EVALUATIONS = "CREATE TABLE IF NOT EXISTS "
      + TABLE_EVALUATIONS
      + " ("
      + COLUMN_ID
      + " INTEGER PRIMARY KEY AUTOINCREMENT, "
      + COLUMN_TIMESTAMP
      + " INT NOT NULL, "
      + COLUMN_CATEGORY
      + " TEXT, "
      + COLUMN_AVGA
      + " REAL, "
      + COLUMN_MINA
      + " REAL, "
      + COLUMN_MAXA
      + " REAL, "
      + COLUMN_STDA
      + " REAL, "
      + COLUMN_AVGG
      + " REAL, "
      + COLUMN_MING
      + " REAL, " + COLUMN_MAXG + " REAL, " + COLUMN_STDG + " REAL);";

  // training data table creation query
  private static final String CREATE_TABLE_TRAINING_DATA = "CREATE TABLE IF NOT EXISTS "
      + TABLE_TRAINING_DATA
      + " ("
      + COLUMN_ID
      + " INTEGER PRIMARY KEY AUTOINCREMENT, "
      + COLUMN_TIMESTAMP
      + " INT, "
      + COLUMN_CATEGORY
      + " TEXT, "
      + COLUMN_AVGA
      + " REAL, "
      + COLUMN_MINA
      + " REAL, "
      + COLUMN_MAXA
      + " REAL, "
      + COLUMN_STDA
      + " REAL, "
      + COLUMN_AVGG
      + " REAL, "
      + COLUMN_MING
      + " REAL, "
      + COLUMN_MAXG + " REAL, " + COLUMN_STDG + " REAL);";

  // vehicles table creation query
  private static final String CREATE_TABLE_VEHICLES = "CREATE TABLE IF NOT EXISTS "
      + TABLE_VEHICLES
      + " ("
      + COLUMN_ID
      + " INTEGER PRIMARY KEY AUTOINCREMENT, "
      + COLUMN_CATEGORY
      + " TEXT, "
      + COLUMN_ICON
      + " BLOB);";

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

  }

  @Override
  public void onCreate(SQLiteDatabase db) {
    db.execSQL(CREATE_TABLE_EVALUATIONS);
    db.execSQL(CREATE_TABLE_TRAINING_DATA);
    db.execSQL(CREATE_TABLE_VEHICLES);
  }

  @Override
  public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
    db.execSQL("DROP TABLE IF EXISTS " + TABLE_EVALUATIONS);
    db.execSQL("DROP TABLE IF EXISTS " + TABLE_TRAINING_DATA);
    db.execSQL("DROP TABLE IF EXISTS " + TABLE_VEHICLES);
    onCreate(db);
  }

}




Java Source Code List

it.unibo.cs.jonus.waidrec.AddVehicleDialog.java
it.unibo.cs.jonus.waidrec.DatabaseOpenHelper.java
it.unibo.cs.jonus.waidrec.EvaluationsProvider.java
it.unibo.cs.jonus.waidrec.HistoryFragment.java
it.unibo.cs.jonus.waidrec.HistoryListAdapter.java
it.unibo.cs.jonus.waidrec.HistorySelectorAdapter.java
it.unibo.cs.jonus.waidrec.MagnitudeFeatures.java
it.unibo.cs.jonus.waidrec.MagnitudeListener.java
it.unibo.cs.jonus.waidrec.MainActivity.java
it.unibo.cs.jonus.waidrec.MainPrefsActivity.java
it.unibo.cs.jonus.waidrec.ModelManager.java
it.unibo.cs.jonus.waidrec.RecognizerFragment.java
it.unibo.cs.jonus.waidrec.RecognizerService.java
it.unibo.cs.jonus.waidrec.TrainingFragment.java
it.unibo.cs.jonus.waidrec.TrainingService.java
it.unibo.cs.jonus.waidrec.VIListAdapter.java
it.unibo.cs.jonus.waidrec.VehicleInstance.java
it.unibo.cs.jonus.waidrec.VehicleItem.java
it.unibo.cs.jonus.waidrec.VehicleManager.java
it.unibo.cs.jonus.waidrec.VehicleObserver.java
it.unibo.cs.jonus.waidrec.VehicleRecognizer.java
it.unibo.cs.jonus.waidrec.VehicleTrainer.java
it.unibo.cs.jonus.waidrec.VehiclesFragment.java
it.unibo.cs.jonus.waidrec.VehiclesListAdapter.java