Android Open Source - Easy_Hidden_Notepad Inventory S Q L Helper






From Project

Back to project page Easy_Hidden_Notepad.

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_Hidden_Notepad 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.easyhiddennotepad;
//from w  w w.  ja  v  a  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 = "easyhiddennotepad.db";
  private static final int DATABASE_VERSION = 1;

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

  // Columns
  public static final String NOTES = "notes";

  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, "+ NOTES + " 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.easyhiddennotepad.EasyHiddenNotepad.java
com.hunterdavis.easyhiddennotepad.InventorySQLHelper.java