public Boolean UpdateUserInfo(UserInfo user) { StringBuilder strSql = new StringBuilder(); strSql.append("Update " + WeiBoSqliteOpenHelper.tbl_UserInfo); strSql.append(" Set uid=" + user.getUid().toString()); strSql.append(",name='" + user.getName() + "'"); strSql.append(",nick='" + user.getNick() + "'"); strSql.append(",sex=" + user.getSex().toString()); _db.execSQL(strSql.toString()); return true; }
public Boolean DeleteUserInfo(UserInfo user) { String sql = "Delete From " + WeiBoSqliteOpenHelper.tbl_UserInfo + " Where id=" + user.getId().toString(); _db.execSQL(sql); return true; }
public List<UserInfo> GetUserInfo() { List<UserInfo> list = new ArrayList<UserInfo>(); StringBuilder strSql = new StringBuilder(); strSql.append("Select * From " + WeiBoSqliteOpenHelper.tbl_UserInfo); Cursor _cursor = _db.rawQuery(strSql.toString(), null); UserInfo item = null; while (_cursor.moveToNext()) { item = new UserInfo(); item.setId(_cursor.getInt(0)); item.setUid(_cursor.getInt(1)); item.setName(_cursor.getString(2)); item.setNick(_cursor.getString(3)); item.setSex(_cursor.getInt(4)); item.setHead(_cursor.getString(5)); item.setWeiboType(_cursor.getInt(6)); list.add(item); } return list; }
/* * @see weibocon.org.database.IWeiBoDB#AddUser(weibocon.org.data.UserInfo) */ public Boolean AddUser(UserInfo user) { StringBuilder strSql = new StringBuilder(); strSql.append("Insert Into "); strSql.append(WeiBoSqliteOpenHelper.tbl_UserInfo); strSql.append("(uid,name,nick,sex,head,weibotype)"); strSql.append(" Values(\r\n"); strSql.append(user.getUid().toString()); strSql.append("," + user.getName()); strSql.append("," + user.getNick()); strSql.append("," + user.getSex().toString()); strSql.append("," + user.getHead()); strSql.append("," + user.getWeiboType().toString()); strSql.append(")"); _db.execSQL(strSql.toString()); return true; }