Android Open Source - Easy_Positive_Audio Inventory S Q L Helper






From Project

Back to project page Easy_Positive_Audio.

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_Positive_Audio 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.easypositiveaudio;
//from w ww.  j a  va 2  s .  c o 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 = "positiveaudio.db";
  private static final int DATABASE_VERSION = 1;

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

  // Columns
  public static final String AUDIOURI = "audiouri";

  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, "+ AUDIOURI + " 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.easypositiveaudio.EasyPositivAudio.java
com.hunterdavis.easypositiveaudio.InventorySQLHelper.java