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