com.lidroid.xutils.db.sqlite.WhereBuilder Java Examples
The following examples show how to use
com.lidroid.xutils.db.sqlite.WhereBuilder.
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: DBManager.java From qingyang with Apache License 2.0 | 6 votes |
/** * 删除上传信息 * * @param uploadfilepath * @return */ public boolean delUpload(String uploadfilepath) { Selector selector = Selector.from(Upload.class); selector.where(WhereBuilder.b("uploadfilepath", "=", uploadfilepath)); try { Upload upload = db.findFirst(selector); db.delete(upload); } catch (DbException e) { e.printStackTrace(); return false; } return true; }
Example #2
Source File: DBManager.java From qingyang with Apache License 2.0 | 6 votes |
/** * 获取上传资源Id * * @param uploadfilepath * @return */ public String getBindId(String uploadfilepath) { Selector selector = Selector.from(Upload.class); selector.where(WhereBuilder.b("uploadfilepath", "=", uploadfilepath)); String bindId = ""; try { Upload upload = db.findFirst(selector); if (upload == null) { return ""; } bindId = upload.getSourceid(); } catch (DbException e) { e.printStackTrace(); return ""; } return bindId; }
Example #3
Source File: DingCaiDAO.java From QiQuYing with Apache License 2.0 | 5 votes |
/** * 检查是否点过赞 * @param userId * @param jokeId * @return */ public DingOrCai getDingOrCai(int userId, int jokeId) { DbUtils db = DbUtils.create(context); DingOrCai dingOrCai = null; try { dingOrCai = db.findFirst(Selector.from(DingOrCai.class).where(WhereBuilder.b("user_id", "=", userId).and("joke_id", "=", jokeId))); Log.d(TAG, "getDingOrCai success"); } catch (DbException e) { Log.d(TAG, "getDingOrCai failure", e); } return dingOrCai; }
Example #4
Source File: DingCaiDAO.java From QiQuYing with Apache License 2.0 | 5 votes |
/** * 查找未同步到服务器的点赞数据 * @return */ public List<DingOrCai> getUnUpload() { DbUtils db = DbUtils.create(context); List<DingOrCai> dbModels = null; try { dbModels = db.findAll(Selector.from(DingOrCai.class).where(WhereBuilder.b("is_upload", "=", DingOrCai.NOT_UPLOAD))); Log.d(TAG, "getUnUpload success"); } catch (DbException e) { Log.d(TAG, "getUnUpload failure", e); } return dbModels; }
Example #5
Source File: CollectDAO.java From QiQuYing with Apache License 2.0 | 5 votes |
/** * 检查是否收藏过 * @param userId * @param jokeId * @return */ public Collect getCollect(int userId, int jokeId) { DbUtils db = DbUtils.create(context); Collect collect = null; try { collect = db.findFirst(Selector.from(Collect.class).where(WhereBuilder.b("user_id", "=", userId).and("joke_id", "=", jokeId))); Log.d(TAG, "getDingOrCai success"); } catch (DbException e) { Log.e(TAG, "getDingOrCai failure", e); } return collect; }
Example #6
Source File: CollectDAO.java From QiQuYing with Apache License 2.0 | 5 votes |
/** * 取消收藏 * @param jokeId */ public void cancelCollect(int jokeId) { DbUtils db = DbUtils.create(context); try { db.delete(Collect.class, WhereBuilder.b("joke_id", "=", jokeId)); Log.d(TAG, "cancelCollect success"); } catch (DbException e) { Log.e(TAG, "cancelCollect failure", e); } }
Example #7
Source File: CollectDAO.java From QiQuYing with Apache License 2.0 | 5 votes |
/** * 获取我的收藏 * @param userId * @return */ public List<Collect> getCollects(int userId) { DbUtils db = DbUtils.create(context); List<Collect> dbModels = null; try { dbModels = db.findAll(Selector.from(Collect.class). where(WhereBuilder.b("user_id", "=", userId)) .orderBy("create_at", true)); Log.d(TAG, "getCollects success"); } catch (DbException e) { Log.e(TAG, "getCollects failure", e); } return dbModels; }
Example #8
Source File: GosScheduleListActivity.java From Gizwits-SmartBuld_Android with MIT License | 5 votes |
private void getDateFromDateBaseAndInitDate() { String uid = spf.getString("Uid", ""); String did = device.getDid(); try { scheduleDates.clear(); scheduleDates = dbUtils.findAll( Selector.from(GosScheduleData.class).where("uid", "=", uid).and(WhereBuilder.b("did", "=", did))); } catch (DbException e) { e.printStackTrace(); } for (GosScheduleData i : scheduleDates) { i.setViewContent(); } }
Example #9
Source File: DbFragment.java From android-open-project-demo with Apache License 2.0 | 5 votes |
@OnClick(R.id.db_find) public void find(View view) { try { String temp = ""; // 查找全部 // List<Student> students = db.findAll(Student.class); // for (Student student : students) { // temp = temp + student.toString() + "\n"; // } // 主键查找 // Student student = db.findById(Student.class, 10086); // temp = student.toString(); //条件查找 List<Student> students = db.findAll(Selector.from(Student.class) .where("name", "=", "李四") .where(WhereBuilder.b("id", "=", 10010)).orderBy("name").limit(0).offset(10)); if (students == null) { Toast.makeText(this.getActivity(), "没有数据请先添加数据", Toast.LENGTH_SHORT).show(); return; } for (Student student : students) { temp = temp + student.toString() + "\n"; } info.setText(temp); } catch (DbException e) { e.printStackTrace(); } }