Exemplo n.º 1
0
  public long create(LotteryApp accessInfo) {
    ContentValues values = new ContentValues();

    values.put(AccessInfoColumn.USERID, accessInfo.getWeiboUserID());
    values.put(AccessInfoColumn.ACCESS_TOKEN, accessInfo.getAccessToken());
    values.put(AccessInfoColumn.ACCESS_SECRET, accessInfo.getAccessSecret());

    return newsDB.insert(DBHelper.ACCESSLIB_TABLE, null, values);
  }
Exemplo n.º 2
0
  public boolean update(LotteryApp accessInfo) {
    ContentValues values = new ContentValues();

    values.put(AccessInfoColumn.USERID, accessInfo.getWeiboUserID());
    values.put(AccessInfoColumn.ACCESS_TOKEN, accessInfo.getAccessToken());
    values.put(AccessInfoColumn.ACCESS_SECRET, accessInfo.getAccessSecret());

    String whereClause = AccessInfoColumn.USERID + "=" + accessInfo.getWeiboUserID();

    return newsDB.update(DBHelper.ACCESSLIB_TABLE, values, whereClause, null) > 0;
  }
Exemplo n.º 3
0
  public ArrayList<LotteryApp> getAccessInfos() {
    ArrayList<LotteryApp> list = new ArrayList<LotteryApp>();

    LotteryApp accessInfo = null;
    Cursor cursor =
        newsDB.query(
            DBHelper.ACCESSLIB_TABLE, AccessInfoColumn.PROJECTION, null, null, null, null, null);

    if (cursor.getCount() > 0) {
      for (cursor.moveToFirst(); !cursor.isAfterLast(); cursor.moveToNext()) {
        accessInfo = new LotteryApp();

        accessInfo.setWeiboUserID(cursor.getString(AccessInfoColumn.USERID_COLUMN));
        accessInfo.setAccessToken(cursor.getString(AccessInfoColumn.ACCESS_TOKEN_COLUMN));
        accessInfo.setAccessSecret(cursor.getString(AccessInfoColumn.ACCESS_SECRET_COLUMN));
        list.add(accessInfo);
      }
    }

    cursor.close();
    cursor = null;

    return list;
  }