/*
  * params
  * email: primary key
  */
 public UserDAO getUser(String email) {
   String query =
       "SELECT "
           + COLUMN_U_USERID
           + ","
           + COLUMN_U_FNAME
           + ","
           + COLUMN_U_LNAME
           + " FROM "
           + TABLE_USER
           + " WHERE "
           + COLUMN_U_EMAIL
           + "='"
           + email
           + "';";
   UserDAO user = null;
   long userid = -1;
   String fname = null, lname = null;
   SQLiteDatabase db = getWritableDatabase();
   Cursor c = db.rawQuery(query, null);
   if (c != null && c.moveToFirst()) {
     userid = c.getLong(c.getColumnIndex(COLUMN_U_USERID));
     fname = c.getString(c.getColumnIndex(COLUMN_U_FNAME));
     lname = c.getString(c.getColumnIndex(COLUMN_U_LNAME));
     c.close();
   }
   try {
     if (userid != -1 || fname.equals(null) || lname.equals(null)) {
       user = new UserDAO(userid, email, fname, lname);
       System.out.println("From DB " + user.getEmail());
     }
   } catch (Exception e) {
     System.out.println("oopsy");
   }
   return user;
 }
 public void addUser(UserDAO user) {
   ContentValues cv = new ContentValues();
   cv.put(COLUMN_U_EMAIL, user.getEmail());
   cv.put(COLUMN_U_FNAME, user.getFname());
   cv.put(COLUMN_U_LNAME, user.getLname());
   cv.put(COLUMN_U_PASSWORD, user.getPassword());
   cv.put(COLUMN_U_USERID, user.getUserid());
   cv.put(COLUMN_U_STATE, user.getState());
   SQLiteDatabase db = getWritableDatabase();
   db.insert(TABLE_USER, null, cv);
   System.out.println("supposedly user is added");
 }