本文整理汇总了Java中org.litepal.crud.DataSupport.deleteAll方法的典型用法代码示例。如果您正苦于以下问题:Java DataSupport.deleteAll方法的具体用法?Java DataSupport.deleteAll怎么用?Java DataSupport.deleteAll使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.litepal.crud.DataSupport
的用法示例。
在下文中一共展示了DataSupport.deleteAll方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testDeleteAllCascadeM2MAssociations
import org.litepal.crud.DataSupport; //导入方法依赖的package包/类
public void testDeleteAllCascadeM2MAssociations() {
createStudentsTeachersWithAssociations();
int rowsAffected = DataSupport.deleteAll(Teacher.class, "id=?", "" + john.getId());
assertEquals(2, rowsAffected);
assertNull(getTeacher(john.getId()));
assertM2MFalse(studentTable, teacherTable, rose.getId(), john.getId());
assertM2M(studentTable, teacherTable, rose.getId(), mike.getId());
assertM2M(studentTable, teacherTable, jude.getId(), mike.getId());
createStudentsTeachersWithAssociations();
rowsAffected = DataSupport.deleteAll(Teacher.class, "id=?", "" + mike.getId());
assertEquals(3, rowsAffected);
assertNull(getTeacher(mike.getId()));
assertM2MFalse(studentTable, teacherTable, rose.getId(), mike.getId());
assertM2MFalse(studentTable, teacherTable, jude.getId(), mike.getId());
assertM2M(studentTable, teacherTable, rose.getId(), john.getId());
}
示例2: testDeleteAllRows
import org.litepal.crud.DataSupport; //导入方法依赖的package包/类
public void testDeleteAllRows() {
createStudentsTeachersWithIdCard();
int rowsCount = getRowsCount(teacherTable);
int affectedRows = 0;
affectedRows = DataSupport.deleteAll(Teacher.class);
assertTrue(rowsCount <= affectedRows);
rowsCount = getRowsCount(studentTable);
affectedRows = DataSupport.deleteAll(Student.class);
assertTrue(rowsCount<= affectedRows);
rowsCount = getRowsCount(DBUtility.getTableNameByClassName(IdCard.class.getName()));
affectedRows = DataSupport.deleteAll(IdCard.class);
assertTrue(rowsCount<=affectedRows);
createStudentsTeachersWithAssociations();
rowsCount = getRowsCount(teacherTable);
affectedRows = DataSupport.deleteAll(Teacher.class);
assertTrue(rowsCount<=affectedRows);
rowsCount = getRowsCount(studentTable);
affectedRows = DataSupport.deleteAll(Student.class);
assertTrue(rowsCount<=affectedRows);
rowsCount = getRowsCount(DBUtility.getIntermediateTableName(studentTable, teacherTable));
affectedRows = DataSupport.deleteAll(DBUtility.getIntermediateTableName(studentTable, teacherTable));
assertTrue(rowsCount<=affectedRows);
}
示例3: testDeleteAllCascadeM2OAssociationsOnOSide
import org.litepal.crud.DataSupport; //导入方法依赖的package包/类
public void testDeleteAllCascadeM2OAssociationsOnOSide() {
createClassroomStudentsTeachers();
int rowsAffected = DataSupport.deleteAll(Student.class, "id = ?", String.valueOf(jude.getId()));
assertEquals(1, rowsAffected);
assertNull(getStudent(jude.getId()));
rowsAffected = DataSupport.deleteAll(Student.class, "id = ?", String.valueOf(rose.getId()));
assertEquals(1, rowsAffected);
assertNull(getStudent(rose.getId()));
rowsAffected = DataSupport.deleteAll(Teacher.class, "id = ?", String.valueOf(john.getId()));
assertEquals(1, rowsAffected);
assertNull(getTeacher(john.getId()));
rowsAffected = DataSupport.deleteAll(Teacher.class, "id = ?", String.valueOf(mike.getId()));
assertEquals(1, rowsAffected);
assertNull(getTeacher(mike.getId()));
}
示例4: deleteAllUserInfo
import org.litepal.crud.DataSupport; //导入方法依赖的package包/类
/**
* 清除所有用户数据
*/
public void deleteAllUserInfo() {
// deleteFriends();
// deleteGroups();
// deleteGroupMembers();
DataSupport.deleteAll(Friend.class);
DataSupport.deleteAll(GroupMember.class);
DataSupport.deleteAll(Groups.class);
//TODO:删除黑名单数据
}
示例5: deleteFriend
import org.litepal.crud.DataSupport; //导入方法依赖的package包/类
public synchronized void deleteFriend(Friend friend) {
DataSupport.deleteAll(Friend.class, "userid = ?", friend.getUserId());
}
示例6: deleteGroupsById
import org.litepal.crud.DataSupport; //导入方法依赖的package包/类
public synchronized void deleteGroupsById(String groupId) {
DataSupport.deleteAll(Groups.class, "groupid = ?", groupId);
}
示例7: deleteGroup
import org.litepal.crud.DataSupport; //导入方法依赖的package包/类
public synchronized void deleteGroup(Groups groups) {
DataSupport.deleteAll(Groups.class, "groupid = ?", groups.getGroupId());
}
示例8: deleteFriendById
import org.litepal.crud.DataSupport; //导入方法依赖的package包/类
public synchronized void deleteFriendById(String friendId) {
DataSupport.deleteAll(Friend.class, "userid = ?", friendId);
}
示例9: deleteGroupMembersByGroupId
import org.litepal.crud.DataSupport; //导入方法依赖的package包/类
public synchronized void deleteGroupMembersByGroupId(String groupId) {
DataSupport.deleteAll(GroupMember.class, "groupid = ?", groupId);
}
示例10: deleteGroups
import org.litepal.crud.DataSupport; //导入方法依赖的package包/类
public synchronized void deleteGroups() {
DataSupport.deleteAll(Groups.class);
}
示例11: onCreateView
import org.litepal.crud.DataSupport; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_notify_star, container, false);
mRecyclerView = (RecyclerView) view.findViewById(R.id.fragment_notify_star_recycler_view);
mRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
mRecyclerView.setAdapter(new NotifyStarAdapter(new ArrayList<StarNotifyItem>()));
mRecyclerView.addItemDecoration(new SpaceItemDecoration(5));
mSwipeRefreshLayout = (SwipeRefreshLayout)view.findViewById(R.id.fragment_notify_star_swipe_refresh_layout);
mSwipeRefreshLayout.setOnRefreshListener(this);
mSwipeRefreshLayout.setColorSchemeColors(getResources().getColor(R.color.colorPrimary));
List<StarNotifyItem> starNotifyItemsFromDatabase = DataSupport.findAll(StarNotifyItem.class);
if(starNotifyItemsFromDatabase==null){
Log.i(TAG, "onCreateView: starNotifyItemsFromDatabase==null");
getData();
}
else{
Log.i(TAG, "onCreateView: load star from database");
NotifyStarAdapter adapter = new NotifyStarAdapter(starNotifyItemsFromDatabase);
mRecyclerView.setAdapter(adapter);
}
mHandler = new Handler(){
@Override
public void handleMessage(Message msg) {
switch (msg.what){
case MSG_GET_NOTIFY_LIST:
Gson gson = new Gson();
List<StarNotifyItem> starNotifyItems = gson.fromJson(mJson, new TypeToken<List<StarNotifyItem>>(){}.getType());
DataSupport.deleteAll(StarNotifyItem.class);
DataSupport.saveAll(starNotifyItems);
mRecyclerView.setAdapter(new NotifyStarAdapter(starNotifyItems));
mSwipeRefreshLayout.setRefreshing(false);
break;
default:
break;
}
}
};
return view;
}
示例12: refreshComic
import org.litepal.crud.DataSupport; //导入方法依赖的package包/类
public void refreshComic(){
DataSupport.deleteAll(ComicItem.class,"comicType = ?",comicType);
queryComic();
}
示例13: deleteLocalItem
import org.litepal.crud.DataSupport; //导入方法依赖的package包/类
private void deleteLocalItem() {
DataSupport.deleteAll(RunningInfo.class.getSimpleName(), "runId = ?", mRunningInfo.getRunId());
toActivity(this, MainActivity.class);
finish();
}
示例14: deleteImageInfoByUrl
import org.litepal.crud.DataSupport; //导入方法依赖的package包/类
public void deleteImageInfoByUrl(String url, String type){
DataSupport.deleteAll(LocalImageInfo.class,"imageUrl=? and type=?",url,type);
}
示例15: deleteGroupMembers
import org.litepal.crud.DataSupport; //导入方法依赖的package包/类
public synchronized void deleteGroupMembers() {
DataSupport.deleteAll(GroupMember.class);
}