Exemplo n.º 1
0
 public void updateLoginUserInfo(User user) {
   SQLiteDatabase db = helper.getWritableDatabase();
   ContentValues values = new ContentValues();
   values.put(LoginUserTable.AVATAR, user.getAvatar());
   values.put(LoginUserTable.UNAME, user.getUname());
   db.update(LoginUserTable.TABLE_NAME, values, "uid=?", new String[] {user.getUid()});
   db.close();
 }
Exemplo n.º 2
0
 /**
  * 更新QQ用户绑定信息
  *
  * @param user
  */
 public void updateQQInfo(LoginUser user) {
   SQLiteDatabase db = helper.getWritableDatabase();
   ContentValues values = new ContentValues();
   values.put(LoginUserTable.QQ_ACCESSTOKEN, user.getQq_accesstoken());
   values.put(LoginUserTable.QQ_UID, user.getQq_uid());
   db.update(LoginUserTable.TABLE_NAME, values, "uid=?", new String[] {user.getUid()});
   db.close();
 }
Exemplo n.º 3
0
 /** 添加用户 */
 public void insert(LoginUser user) {
   SQLiteDatabase db = helper.getWritableDatabase();
   ContentValues values = new ContentValues();
   values.put(LoginUserTable.UID, user.getUid());
   values.put(LoginUserTable.UNAME, user.getUname());
   values.put(LoginUserTable.AVATAR, user.getAvatar());
   values.put(LoginUserTable.SESSIONID, user.getSessionid());
   db.insert(LoginUserTable.TABLE_NAME, null, values);
   db.close();
 }
Exemplo n.º 4
0
 public String getSessionId() {
   SQLiteDatabase db = helper.getWritableDatabase();
   Cursor cursor = db.rawQuery("select * from loginuser ", null);
   String sessionid = null;
   if (cursor.moveToNext()) {
     sessionid = cursor.getString(cursor.getColumnIndex("sina_accesstoken"));
   }
   cursor.close();
   db.close();
   return sessionid;
 }
Exemplo n.º 5
0
 public LoginUser getLoginUser() {
   LoginUser user = new LoginUser();
   SQLiteDatabase db = helper.getWritableDatabase();
   Cursor cursor = db.rawQuery("select * from loginuser ", null);
   if (cursor.moveToNext()) {
     user.setUid(cursor.getString(cursor.getColumnIndex("uid")));
     user.setUname(cursor.getString(cursor.getColumnIndex("uname")));
     user.setAvatar(cursor.getString(cursor.getColumnIndex("avatar")));
     user.setSessionid(cursor.getString(cursor.getColumnIndex("sessionid")));
     user.setSina_accesstoken(cursor.getString(cursor.getColumnIndex("sina_accesstoken")));
     user.setSina_uid(cursor.getString(cursor.getColumnIndex("sina_uid")));
     user.setQq_accesstoken(cursor.getString(cursor.getColumnIndex("qq_accesstoken")));
     user.setQq_uid(cursor.getString(cursor.getColumnIndex("qq_uid")));
   }
   cursor.close();
   db.close();
   return user;
 }
Exemplo n.º 6
0
 public void delete(User user) {
   SQLiteDatabase db = helper.getWritableDatabase();
   db.execSQL("delete from loginuser where uid=?", new String[] {user.getUid()});
 }