]>
iEval git - unical.git/blob - unical/MySQLiteHelper.java
1 package ro
.ieval
.unical
;
3 import android
.content
.Context
;
4 import android
.database
.sqlite
.SQLiteDatabase
;
5 import android
.database
.sqlite
.SQLiteOpenHelper
;
6 import android
.util
.Log
;
8 public class MySQLiteHelper
extends SQLiteOpenHelper
{
9 public static final String Name
="Events";
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";
20 private static final int dbversion
=1;
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, " +
28 duration
+ " integer, " +
29 repeat
+ " integer, "+
30 repeatIn
+ " integer, " +
34 public MySQLiteHelper(Context context
) {
35 super(context
,Name
, null, dbversion
);
36 // TODO Auto-generated constructor stub
40 public void onCreate(SQLiteDatabase db
) {
41 // TODO Auto-generated method stub
42 db
.execSQL(Database_create
);
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
);
This page took 0.047979 seconds and 4 git commands to generate.