當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。