当前位置: 首页>>代码示例>>Java>>正文


Java DataSupport.deleteAll方法代码示例

本文整理汇总了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());
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:17,代码来源:DeleteTest.java

示例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);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:24,代码来源:DeleteTest.java

示例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()));
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:16,代码来源:DeleteTest.java

示例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:删除黑名单数据
    }
 
开发者ID:GitLqr,项目名称:LQRWeChat,代码行数:13,代码来源:DBManager.java

示例5: deleteFriend

import org.litepal.crud.DataSupport; //导入方法依赖的package包/类
public synchronized void deleteFriend(Friend friend) {
    DataSupport.deleteAll(Friend.class, "userid = ?", friend.getUserId());
}
 
开发者ID:GitLqr,项目名称:LQRWeChat,代码行数:4,代码来源:DBManager.java

示例6: deleteGroupsById

import org.litepal.crud.DataSupport; //导入方法依赖的package包/类
public synchronized void deleteGroupsById(String groupId) {
    DataSupport.deleteAll(Groups.class, "groupid = ?", groupId);
}
 
开发者ID:starryxp,项目名称:LQRWeChat-master,代码行数:4,代码来源:DBManager.java

示例7: deleteGroup

import org.litepal.crud.DataSupport; //导入方法依赖的package包/类
public synchronized void deleteGroup(Groups groups) {
    DataSupport.deleteAll(Groups.class, "groupid = ?", groups.getGroupId());
}
 
开发者ID:GitLqr,项目名称:LQRWeChat,代码行数:4,代码来源:DBManager.java

示例8: deleteFriendById

import org.litepal.crud.DataSupport; //导入方法依赖的package包/类
public synchronized void deleteFriendById(String friendId) {
    DataSupport.deleteAll(Friend.class, "userid = ?", friendId);
}
 
开发者ID:starryxp,项目名称:LQRWeChat-master,代码行数:4,代码来源:DBManager.java

示例9: deleteGroupMembersByGroupId

import org.litepal.crud.DataSupport; //导入方法依赖的package包/类
public synchronized void deleteGroupMembersByGroupId(String groupId) {
    DataSupport.deleteAll(GroupMember.class, "groupid = ?", groupId);
}
 
开发者ID:starryxp,项目名称:LQRWeChat-master,代码行数:4,代码来源:DBManager.java

示例10: deleteGroups

import org.litepal.crud.DataSupport; //导入方法依赖的package包/类
public synchronized void deleteGroups() {
    DataSupport.deleteAll(Groups.class);
}
 
开发者ID:GitLqr,项目名称:LQRWeChat,代码行数:4,代码来源:DBManager.java

示例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;
}
 
开发者ID:shawnsky,项目名称:RantApp,代码行数:45,代码来源:NotifyStarFragment.java

示例12: refreshComic

import org.litepal.crud.DataSupport; //导入方法依赖的package包/类
public void refreshComic(){
        DataSupport.deleteAll(ComicItem.class,"comicType = ?",comicType);
        queryComic();
}
 
开发者ID:NicoLiutong,项目名称:miaosou,代码行数:5,代码来源:ComicFragment.java

示例13: deleteLocalItem

import org.litepal.crud.DataSupport; //导入方法依赖的package包/类
private void deleteLocalItem() {
    DataSupport.deleteAll(RunningInfo.class.getSimpleName(), "runId = ?", mRunningInfo.getRunId());
    toActivity(this, MainActivity.class);
    finish();
}
 
开发者ID:SailFlorve,项目名称:RunHDU,代码行数:6,代码来源:RunDetailsActivity.java

示例14: deleteImageInfoByUrl

import org.litepal.crud.DataSupport; //导入方法依赖的package包/类
public void deleteImageInfoByUrl(String url, String type){
    DataSupport.deleteAll(LocalImageInfo.class,"imageUrl=? and type=?",url,type);
}
 
开发者ID:lai233333,项目名称:MyDemo,代码行数:4,代码来源:LocalImageDb.java

示例15: deleteGroupMembers

import org.litepal.crud.DataSupport; //导入方法依赖的package包/类
public synchronized void deleteGroupMembers() {
    DataSupport.deleteAll(GroupMember.class);
}
 
开发者ID:lo625090140,项目名称:lqrwechatrongcloud,代码行数:4,代码来源:DBManager.java


注:本文中的org.litepal.crud.DataSupport.deleteAll方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。