• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java WhereBuilder类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.lidroid.xutils.db.sqlite.WhereBuilder的典型用法代码示例。如果您正苦于以下问题:Java WhereBuilder类的具体用法?Java WhereBuilder怎么用?Java WhereBuilder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



WhereBuilder类属于com.lidroid.xutils.db.sqlite包,在下文中一共展示了WhereBuilder类的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: onClick

import com.lidroid.xutils.db.sqlite.WhereBuilder; //导入依赖的package包/类
@Click(value = { R.id.tv_delete, R.id.tv_cancel })
public void onClick(View v)
{
	switch (v.getId())
	{
	case R.id.tv_delete:

		switch (MSG)
		{
		case DELETE_BOOK_AND_FILE:
			if (cb.isChecked()) FileKit.deleteFile(book.path);
		case DELETE_BOOK:
			db.delete(book);
			db.delete(Toc.class, WhereBuilder.b("book_id", "=", book.id));
			break;
		case DELETE_FILE:
			FileKit.deleteFile(file.path);
			break;
		}
		break;

	case R.id.tv_cancel:
		break;
	}
	finish();
}
 
开发者ID:AlixMing,项目名称:FBreader,代码行数:27,代码来源:DeleteBookDialog.java


示例2: delUpload

import com.lidroid.xutils.db.sqlite.WhereBuilder; //导入依赖的package包/类
/**
 * 删除上传信息
 * 
 * @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;
}
 
开发者ID:zqingyang521,项目名称:qingyang,代码行数:23,代码来源:DBManager.java


示例3: getBindId

import com.lidroid.xutils.db.sqlite.WhereBuilder; //导入依赖的package包/类
/**
 * 获取上传资源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;
}
 
开发者ID:zqingyang521,项目名称:qingyang,代码行数:28,代码来源:DBManager.java


示例4: find

import com.lidroid.xutils.db.sqlite.WhereBuilder; //导入依赖的package包/类
@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();
	}
}
 
开发者ID:xulailing,项目名称:android-open-project-demo-master,代码行数:31,代码来源:DbFragment.java


示例5: deleteAllChat

import com.lidroid.xutils.db.sqlite.WhereBuilder; //导入依赖的package包/类
public static void deleteAllChat(String aliasName) {
	try {
		db.delete(ChatHistory.class, WhereBuilder.b("sendAliasName", "=", aliasName).or("recvAliasName", "=", aliasName));
	} catch (DbException e) {
		Log.e(TAG, e.getMessage());
	}
}
 
开发者ID:zhaoyangzhou,项目名称:NPush,代码行数:8,代码来源:IMUtil.java


示例6: findChatHistory

import com.lidroid.xutils.db.sqlite.WhereBuilder; //导入依赖的package包/类
/**
 * <p>Method :findChatHistory
 * <p>Description : 查询历史信息
 *
 * @param friendAliasName 好友别名
 * @return 
 */
public static List<ChatHistory> findChatHistory(String friendAliasName) {
	//当前登陆人别名
	String aliasName = getStringSharedPreferences(APPLICATION_CONTEXT, "IM", "aliasName", "");
	try {
		return db.findAll(Selector.from(ChatHistory.class)
					.where("userAliasName", "=", aliasName)
					.and(WhereBuilder.b("sendAliasName", "=", friendAliasName).or("recvAliasName", "=", friendAliasName)));
	} catch (DbException e) {
		Log.e(TAG, e.getMessage());
	}
	return null;
}
 
开发者ID:zhaoyangzhou,项目名称:NPush,代码行数:20,代码来源:IMUtil.java


示例7: getDingOrCai

import com.lidroid.xutils.db.sqlite.WhereBuilder; //导入依赖的package包/类
/**
 * 检查是否点过赞
 * @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;
}
 
开发者ID:liuling07,项目名称:QiQuYing,代码行数:18,代码来源:DingCaiDAO.java


示例8: getUnUpload

import com.lidroid.xutils.db.sqlite.WhereBuilder; //导入依赖的package包/类
/**
 * 查找未同步到服务器的点赞数据
 * @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;
}
 
开发者ID:liuling07,项目名称:QiQuYing,代码行数:16,代码来源:DingCaiDAO.java


示例9: getCollect

import com.lidroid.xutils.db.sqlite.WhereBuilder; //导入依赖的package包/类
/**
 * 检查是否收藏过
 * @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;
}
 
开发者ID:liuling07,项目名称:QiQuYing,代码行数:18,代码来源:CollectDAO.java


示例10: cancelCollect

import com.lidroid.xutils.db.sqlite.WhereBuilder; //导入依赖的package包/类
/**
 * 取消收藏
 * @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);
	}
}
 
开发者ID:liuling07,项目名称:QiQuYing,代码行数:14,代码来源:CollectDAO.java


示例11: getCollects

import com.lidroid.xutils.db.sqlite.WhereBuilder; //导入依赖的package包/类
/**
 * 获取我的收藏
 * @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;
}
 
开发者ID:liuling07,项目名称:QiQuYing,代码行数:19,代码来源:CollectDAO.java


示例12: getDateFromDateBaseAndInitDate

import com.lidroid.xutils.db.sqlite.WhereBuilder; //导入依赖的package包/类
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();
	}
}
 
开发者ID:gizwits,项目名称:Gizwits-SmartBuld_Android,代码行数:15,代码来源:GosScheduleListActivity.java


示例13: deletBookMark

import com.lidroid.xutils.db.sqlite.WhereBuilder; //导入依赖的package包/类
/**
 * 删除书签
 * 
 * @param bookMarko
 */
public void deletBookMark(String bookName,String bookId) {
	try {
		db.delete(BookMark.class, WhereBuilder.b("bookName", "=", bookName).and("bookId", "=", bookId));
	} catch (DbException e) {
		// TODO Auto-generated catch block
		MyLogger.kLog().e(e);
	}
}
 
开发者ID:justingboy,项目名称:CouldBooks,代码行数:14,代码来源:BookMarkDb.java


示例14: hourAvera

import com.lidroid.xutils.db.sqlite.WhereBuilder; //导入依赖的package包/类
/**
 * 从数据库中查询某个小时检查的平均值
 * 
 * @param lastDay
 * @param today
 * @param tvbiJiao
 */
private float hourAvera(String today, String hour) {
	java.text.DecimalFormat df = new java.text.DecimalFormat("#0.0");
	DbUtils db = DbUtils.create(getActivity());
	List<BltModel> blts;
	float averageWater = 0;
	WhereBuilder builder = WhereBuilder.b("date", "==", today)
			.and("hour", "==", hour).and("modelstate", "==", checkType);
	try {
		blts = db.findAll(Selector.from(BltModel.class).where(builder));
		if (blts != null) {
			int totalWater = 0;

			for (int i = 0; i < blts.size(); i++) {
				totalWater = totalWater
						+ Integer.parseInt(blts.get(i).getWater());

			}
			if (blts.size() > 0) {
				averageWater = totalWater / blts.size();
				averageWater = Float.parseFloat(df
						.format(averageWater / 45.0f + 20.0));

			}

		}
	} catch (DbException e1) {
		// TODO Auto-generated catch block
		e1.printStackTrace();
		return 0;
	}
	return averageWater;

}
 
开发者ID:cdkd321,项目名称:pure,代码行数:41,代码来源:HomeRootFragment.java


示例15: dayAvera

import com.lidroid.xutils.db.sqlite.WhereBuilder; //导入依赖的package包/类
/**
 * 从数据库中查询某天检查的平均值
 * 
 * @param lastDay
 * @param today
 * @param tvbiJiao
 */
private Average dayAvera(String day) {
	Average average = new Average();
	java.text.DecimalFormat df = new java.text.DecimalFormat("#0.0");
	DbUtils db = DbUtils.create(getActivity());
	List<BltModel> blts;
	float averageWater = 0;
	WhereBuilder builder = WhereBuilder.b("date", "==", day).and(
			"modelstate", "==", checkType);
	try {
		blts = db.findAll(Selector.from(BltModel.class).where(builder));
		if (blts != null) {
			int totalWater = 0;

			for (int i = 0; i < blts.size(); i++) {
				totalWater = totalWater
						+ Integer.parseInt(blts.get(i).getWater());

			}
			if (blts.size() > 0) {
				averageWater = totalWater / blts.size();
				average.setCount(blts.size());
				averageWater = Float.parseFloat(df
						.format(averageWater / 45.0f + 20.0));
				average.setAverage(averageWater);

			}

		}
	} catch (DbException e1) {
		// TODO Auto-generated catch block
		e1.printStackTrace();
		return average;
	}
	return average;

}
 
开发者ID:cdkd321,项目名称:pure,代码行数:44,代码来源:HomeRootFragment.java


示例16: delete

import com.lidroid.xutils.db.sqlite.WhereBuilder; //导入依赖的package包/类
public void delete(Class<?> entityType, WhereBuilder whereBuilder) throws DbException {
    if (!tableIsExist(entityType)) return;
    try {
        beginTransaction();

        execNonQuery(SqlInfoBuilder.buildDeleteSqlInfo(this, entityType, whereBuilder));

        setTransactionSuccessful();
    } finally {
        endTransaction();
    }
}
 
开发者ID:cdkd321,项目名称:pure,代码行数:13,代码来源:DbUtils.java


示例17: update

import com.lidroid.xutils.db.sqlite.WhereBuilder; //导入依赖的package包/类
public void update(Object entity, WhereBuilder whereBuilder, String... updateColumnNames) throws DbException {
    if (!tableIsExist(entity.getClass())) return;
    try {
        beginTransaction();

        execNonQuery(SqlInfoBuilder.buildUpdateSqlInfo(this, entity, whereBuilder, updateColumnNames));

        setTransactionSuccessful();
    } finally {
        endTransaction();
    }
}
 
开发者ID:cdkd321,项目名称:pure,代码行数:13,代码来源:DbUtils.java


示例18: updateAll

import com.lidroid.xutils.db.sqlite.WhereBuilder; //导入依赖的package包/类
public void updateAll(List<?> entities, WhereBuilder whereBuilder, String... updateColumnNames) throws DbException {
    if (entities == null || entities.size() == 0 || !tableIsExist(entities.get(0).getClass())) return;
    try {
        beginTransaction();

        for (Object entity : entities) {
            execNonQuery(SqlInfoBuilder.buildUpdateSqlInfo(this, entity, whereBuilder, updateColumnNames));
        }

        setTransactionSuccessful();
    } finally {
        endTransaction();
    }
}
 
开发者ID:cdkd321,项目名称:pure,代码行数:15,代码来源:DbUtils.java



注:本文中的com.lidroid.xutils.db.sqlite.WhereBuilder类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Priorities类代码示例发布时间:2022-05-22
下一篇:
Java PublisherVerification类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap