]> iEval git - unical.git/blobdiff - src/ro/ieval/unical/DatabaseInteract.java
Remove database classes, ic_launcher-web and more cleanups
[unical.git] / src / ro / ieval / unical / DatabaseInteract.java
diff --git a/src/ro/ieval/unical/DatabaseInteract.java b/src/ro/ieval/unical/DatabaseInteract.java
deleted file mode 100644 (file)
index 520eba8..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-package ro.ieval.unical;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import android.content.ContentValues;
-import android.content.Context;
-import android.database.Cursor;
-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);
-               database=dbHelper.getWritableDatabase();
-       }
-       
-       public void open() throws SQLException {
-               database=dbHelper.getWritableDatabase();
-       }
-       
-       public void close() {
-               dbHelper.close();
-       }
-       
-       //Insert event
-       public void insertEvent(Event e) {
-               ContentValues values = new ContentValues();
-               values.put(allColumns[0], e._id);
-               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
-       public void deleteEvent(String id) {
-               database.delete(MySQLiteHelper.Name, MySQLiteHelper.ID + "=" + id, null);
-       }
-       //Search event
-       //Get all events
-       public List<Event> getAllEvents() {
-               List<Event> events=new ArrayList<Event>();
-               Cursor cursor=database.query(MySQLiteHelper.Name,allColumns,null,null,null,null,null);
-               
-               for(cursor.moveToFirst();!cursor.isAfterLast();cursor.moveToNext()) {
-                       Event ev=cursorToEvent(cursor);
-                       events.add(ev);
-               }
-               return events;
-       }
-
-       private Event cursorToEvent(Cursor cursor) {
-               // TODO Auto-generated method stub
-               Event e = new Event();
-               e._id=cursor.getString(0);
-               e.title=cursor.getString(1);
-               e.description=cursor.getString(2);
-               e.date=cursor.getInt(3);
-               e.duration=cursor.getInt(4);
-               if(cursor.getInt(5)==1) e.repeat=true;
-               else e.repeat=false;
-               e.repeatInterval=cursor.getInt(6);
-               e.location=cursor.getString(7);
-               return e;
-       }
-}
This page took 0.025617 seconds and 4 git commands to generate.