dbadca58e89af64f5497ccff38c71824c9c9de64
[unical.git] / src / ro / ieval / unical / MySQLiteHelper.java
1 package ro.ieval.unical;
2
3 import android.content.Context;
4 import android.database.sqlite.SQLiteDatabase;
5 import android.database.sqlite.SQLiteOpenHelper;
6 import android.util.Log;
7
8 public class MySQLiteHelper extends SQLiteOpenHelper {
9 public static final String Name="Events";
10
11 public static final String ID = "_id";
12 public static final String title = "Title";
13 public static final String description = "Description";
14 public static final String date = "Date";
15 public static final String duration = "Duration";
16 public static final String repeat = "repeat";
17 public static final String repeatIn = "repeatInterval";
18 public static final String location = "Location";
19
20 private static final int dbversion=1;
21
22 private static final String Database_create = "create table " + Name + "(" +
23 //ID + " integer primary key autoincrement, " +
24 ID + " text primary key, " +
25 title + " text not null, " +
26 description + " text, " +
27 date + " integer, " +
28 duration + " integer, " +
29 repeat + " integer, "+
30 repeatIn + " integer, " +
31 location + " text);"
32 ;
33
34 public MySQLiteHelper(Context context) {
35 super(context,Name, null, dbversion);
36 // TODO Auto-generated constructor stub
37 }
38
39 @Override
40 public void onCreate(SQLiteDatabase db) {
41 // TODO Auto-generated method stub
42 db.execSQL(Database_create);
43
44 }
45
46 @Override
47 public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
48 // TODO Auto-generated method stub
49 Log.w(MySQLiteHelper.class.getName(),
50 "Upgrading database from version " + oldVersion + " to "
51 + newVersion + ", which will destroy all old data");
52 db.execSQL("DROP TABLE IF EXISTS " + Name);
53 onCreate(db);
54 }
55
56 }
This page took 0.021998 seconds and 3 git commands to generate.