package ro.ieval.unical;
+import android.content.ContentValues;
import android.content.Context;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
public class DatabaseInteract {
private SQLiteDatabase database;
private MySQLiteHelper dbHelper;
+ private String[] allColumns = {
+ MySQLiteHelper.ID, MySQLiteHelper.title,
+ MySQLiteHelper.description, MySQLiteHelper.date,
+ MySQLiteHelper.duration, MySQLiteHelper.repeat,
+ MySQLiteHelper.repeatIn, MySQLiteHelper.location
+ };
public DatabaseInteract(Context context) {
dbHelper = new MySQLiteHelper(context);
dbHelper.close();
}
- //Add event
+ //Insert event
+ public void insertEvent(Event e) {
+ ContentValues values = new ContentValues();
+ values.put(allColumns[1],e.title);
+ values.put(allColumns[2],e.description);
+ values.put(allColumns[3],e.date);
+ values.put(allColumns[4],e.duration);
+ values.put(allColumns[5], e.repeat);
+ values.put(allColumns[6], e.repeatInterval);
+ values.put(allColumns[7], e.location);
+ database.insert(MySQLiteHelper.Name, null, values);
+ }
//Delete event
//Search event
}