org.greenrobot.greendao.query.DeleteQuery Java Examples

The following examples show how to use org.greenrobot.greendao.query.DeleteQuery. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ContactHelper.java    From Android with MIT License 5 votes vote down vote up
/**
 * remove friend
 *
 * @param pubKey
 */
public void deleteRequestEntity(String pubKey) {
    QueryBuilder<FriendRequestEntity> qb = friendRequestEntityDao.queryBuilder();
    DeleteQuery<FriendRequestEntity> bd = qb.where(FriendRequestEntityDao.Properties.Pub_key.eq(pubKey))
            .buildDelete();
    bd.executeDeleteWithoutDetachingEntities();
}
 
Example #2
Source File: ContactHelper.java    From Android with MIT License 5 votes vote down vote up
/**
 * remove member
 *
 * @param groupkey
 * @param pubkey
 */
public void removeMemberEntity(String groupkey, String pubkey) {
    QueryBuilder<GroupMemberEntity> qb = groupMemberEntityDao.queryBuilder();
    DeleteQuery<GroupMemberEntity> bd = qb.where(GroupMemberEntityDao.Properties.Identifier.eq(groupkey),
            qb.or(GroupMemberEntityDao.Properties.Identifier.eq(pubkey), GroupMemberEntityDao.Properties.Address.eq(pubkey))).buildDelete();
    bd.executeDeleteWithoutDetachingEntities();
}
 
Example #3
Source File: SLSDatabaseManager.java    From aliyun-log-android-sdk with MIT License 5 votes vote down vote up
public void deleteTwoThousandRecords() {
    Query tableSelectQuery = daoSession.getLogEntityDao().queryBuilder().where(LogEntityDao.Properties.Timestamp.le(new Long(new Date().getTime()))).orderAsc(LogEntityDao.Properties.Timestamp).limit(2000).build();
    List<LogEntity> records = tableSelectQuery.list();
    List ids = new ArrayList();
    for(LogEntity log : records){
        ids.add(log.getId());
    }

    DeleteQuery tableDeleteQuery = daoSession.getLogEntityDao().queryBuilder().where(LogEntityDao.Properties.Id.in(ids)).buildDelete();
    tableDeleteQuery.executeDeleteWithoutDetachingEntities();
    daoSession.clear();
    DbUtils.vacuum(daoSession.getDatabase());
}
 
Example #4
Source File: ContactHelper.java    From Android with MIT License 4 votes vote down vote up
public void deleteEntity(String address) {
    QueryBuilder<ContactEntity> qb = contactEntityDao.queryBuilder();
    DeleteQuery<ContactEntity> bd = qb.where(ContactEntityDao.Properties.Address.eq(address))
            .buildDelete();
    bd.executeDeleteWithoutDetachingEntities();
}
 
Example #5
Source File: ContactHelper.java    From Android with MIT License 4 votes vote down vote up
/**
 * remove group
 *
 * @param groupkey
 */
public void removeGroupEntity(String groupkey) {
    QueryBuilder<GroupEntity> qb = groupEntityDao.queryBuilder();
    DeleteQuery<GroupEntity> bd = qb.where(GroupEntityDao.Properties.Identifier.eq(groupkey)).buildDelete();
    bd.executeDeleteWithoutDetachingEntities();
}
 
Example #6
Source File: ContactHelper.java    From Android with MIT License 4 votes vote down vote up
/**
 * remove all member
 *
 * @param groupkey
 */
public void removeMemberEntity(String groupkey) {
    QueryBuilder<GroupMemberEntity> qb = groupMemberEntityDao.queryBuilder();
    DeleteQuery<GroupMemberEntity> bd = qb.where(GroupMemberEntityDao.Properties.Identifier.eq(groupkey)).buildDelete();
    bd.executeDeleteWithoutDetachingEntities();
}
 
Example #7
Source File: ContactHelper.java    From Android with MIT License 4 votes vote down vote up
/**
 * remove recommend entity
 *
 * @param pubkey
 */
public void removeRecommendEntity(String pubkey) {
    QueryBuilder<RecommandFriendEntity> qb = recommandFriendEntityDao.queryBuilder();
    DeleteQuery<RecommandFriendEntity> bd = qb.where(RecommandFriendEntityDao.Properties.Pub_key.eq(pubkey)).buildDelete();
    bd.executeDeleteWithoutDetachingEntities();
}
 
Example #8
Source File: ParamHelper.java    From Android with MIT License 4 votes vote down vote up
/**********************************************************************************************
 *                                      delete
 *********************************************************************************************/
public void deleteParamEntity(String key) {
    QueryBuilder<ParamEntity> qb = paramEntityDao.queryBuilder();
    DeleteQuery<ParamEntity> bd = qb.where(ParamEntityDao.Properties.Key.eq(key)).buildDelete();
    bd.executeDeleteWithoutDetachingEntities();
}
 
Example #9
Source File: ParamHelper.java    From Android with MIT License 4 votes vote down vote up
public void deleteLikeParamEntity(String key){
    QueryBuilder<ParamEntity> qb = paramEntityDao.queryBuilder();
    DeleteQuery<ParamEntity> bd = qb.where(ParamEntityDao.Properties.Key.like("%" + key + "%")).buildDelete();
    bd.executeDeleteWithoutDetachingEntities();
}
 
Example #10
Source File: ConversionHelper.java    From Android with MIT License 4 votes vote down vote up
/**
 * remove room
 * @param roomid
 */
public void deleteRoom(String roomid) {
    QueryBuilder<ConversionEntity> qb = conversionEntityDao.queryBuilder();
    DeleteQuery<ConversionEntity> bd = qb.where(ConversionEntityDao.Properties.Identifier.eq(roomid)).buildDelete();
    bd.executeDeleteWithoutDetachingEntities();
}
 
Example #11
Source File: MessageHelper.java    From Android with MIT License 4 votes vote down vote up
/********************************* delete ***********************************/
public void deleteRoomMsg(String pukkey) {
    QueryBuilder<MessageEntity> qb = messageEntityDao.queryBuilder();
    DeleteQuery<MessageEntity> bd = qb.where(MessageEntityDao.Properties.Message_ower.eq(pukkey)).buildDelete();
    bd.executeDeleteWithoutDetachingEntities();
}
 
Example #12
Source File: MessageHelper.java    From Android with MIT License 4 votes vote down vote up
public void deleteMsgByid(String msgid) {
    QueryBuilder<MessageEntity> qb = messageEntityDao.queryBuilder();
    DeleteQuery<MessageEntity> bd = qb.where(MessageEntityDao.Properties.Message_id.eq(msgid)).buildDelete();
    bd.executeDeleteWithoutDetachingEntities();
}
 
Example #13
Source File: MessageHelper.java    From Android with MIT License 4 votes vote down vote up
public void clearMsgByRoomkey(String roomkey) {
    QueryBuilder<MessageEntity> qb = messageEntityDao.queryBuilder();
    DeleteQuery<MessageEntity> bd = qb.where(MessageEntityDao.Properties.Message_ower.eq(roomkey)).buildDelete();
    bd.executeDeleteWithoutDetachingEntities();
}