本文整理匯總了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);
}