Android Open Source - Easy_Sound_Board Inventory S Q L Helper






From Project

Back to project page Easy_Sound_Board.

License

The source code is released under:

Copyright (c) 2011, 2012, Hunter Davis All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are m...

If you think the Android project Easy_Sound_Board 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.hunterdavis.easysoundboard;
/*w w w  .j a  v a2  s. co  m*/
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.provider.BaseColumns;


public class InventorySQLHelper extends android.database.sqlite.SQLiteOpenHelper {
  private static final String DATABASE_NAME = "easysoundboard.db";
  private static final int DATABASE_VERSION = 1;

  // Table name
  public static final String TABLE = "easysoundboard";

  // Columns
  public static final String URI = "uri";
  public static final String NUM = "num";

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

  @Override
  public void onCreate(SQLiteDatabase db) {
    String sql = "create table " + TABLE + "( " + BaseColumns._ID
        + " integer primary key autoincrement,"+ NUM +" integer, "+ URI + " text not null);";
    db.execSQL(sql);
  }

  @Override
  public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
    if (oldVersion >= newVersion)
      return;

    String sql = null;
    if (oldVersion == 1)
      sql = "alter table " + TABLE + " add note text;";
    if (oldVersion == 2)
      sql = "";

    if (sql != null)
      db.execSQL(sql);
  }

}




Java Source Code List

com.hunterdavis.easysoundboard.EasySoundBoard.java
com.hunterdavis.easysoundboard.InventorySQLHelper.java