]>
iEval git - unical.git/blob - DatabaseInteract.java
dd2dde10d17643e6365b78c8c964de7b8959a73f
1 package ro
.ieval
.unical
;
3 import android
.content
.ContentValues
;
4 import android
.content
.Context
;
5 import android
.database
.SQLException
;
6 import android
.database
.sqlite
.SQLiteDatabase
;
8 public class DatabaseInteract
{
9 private SQLiteDatabase database
;
10 private MySQLiteHelper dbHelper
;
11 private String
[] allColumns
= {
12 MySQLiteHelper
.ID
, MySQLiteHelper
.title
,
13 MySQLiteHelper
.description
, MySQLiteHelper
.date
,
14 MySQLiteHelper
.duration
, MySQLiteHelper
.repeat
,
15 MySQLiteHelper
.repeatIn
, MySQLiteHelper
.location
18 public DatabaseInteract(Context context
) {
19 dbHelper
= new MySQLiteHelper(context
);
22 public void open() throws SQLException
{
23 database
=dbHelper
.getWritableDatabase();
31 public void insertEvent(Event e
) {
32 ContentValues values
= new ContentValues();
33 values
.put(allColumns
[1],e
.title
);
34 values
.put(allColumns
[2],e
.description
);
35 values
.put(allColumns
[3],e
.date
);
36 values
.put(allColumns
[4],e
.duration
);
37 values
.put(allColumns
[5], e
.repeat
);
38 values
.put(allColumns
[6], e
.repeatInterval
);
39 values
.put(allColumns
[7], e
.location
);
40 database
.insert(MySQLiteHelper
.Name
, null, values
);
This page took 0.039988 seconds and 3 git commands to generate.