]>
iEval git - unical.git/blob - MySQLiteHelper.java
dc3595157db2a37f9040b810d286a2f90b290b54
1 package ro
.ieval
.unical
;
3 import java
.sql
.SQLClientInfoException
;
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
;
11 public class MySQLiteHelper
extends SQLiteOpenHelper
{
12 public static final String Name
="Events";
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";
23 private static final int dbversion
=1;
25 private static final String Database_create
= "create table " + Name
+ "(" +
26 ID
+ " integer primary key autoincrement, " +
27 title
+ " text not null, " +
28 description
+ " text, " +
30 duration
+ " integer, " +
31 repeat
+ " integer, "+
32 repeatIn
+ " integer, " +
36 public MySQLiteHelper(Context context
) {
37 super(context
,Name
, null, dbversion
);
38 // TODO Auto-generated constructor stub
42 public void onCreate(SQLiteDatabase db
) {
43 // TODO Auto-generated method stub
44 db
.execSQL(Database_create
);
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
);
This page took 0.042581 seconds and 3 git commands to generate.