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


Java Selector类代码示例

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


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

示例1: updateNum

import com.lidroid.xutils.db.sqlite.Selector; //导入依赖的package包/类
/** 修改数量,直接传入数量 */
public static int updateNum(Context context, int menuPos, int goodsId, String goodsNum)
{
    DbUtils dbUtils = DbUtils.create(context);

    try
    {
        GoodsBean bean = dbUtils.findFirst(Selector.from(GoodsBean.class)
                .where("menuPos" , "=" , menuPos).and("goodsId" , "=" , goodsId));
        bean.setGoodsNum(goodsNum);
        dbUtils.update(bean);
        return getSecondGoodsNumber(context , menuPos , goodsId);
    }
    catch (DbException e)
    {
        e.printStackTrace();
    }
    dbUtils.close();
    return 0;
}
 
开发者ID:z13538657403,项目名称:CustomShoppingCarDemo,代码行数:21,代码来源:OperateGoodsDataBaseStatic.java

示例2: updateChat

import com.lidroid.xutils.db.sqlite.Selector; //导入依赖的package包/类
/**
 * <p>Method :updateChat
 * <p>Description : 修改聊天记录状态
 *
 * @param chatBean
 * @return 
 */
public static ChatHistory updateChat(ChatHistory chatBean) {
	ChatHistory chat = null;
	try {
		chat = db.findFirst(
				Selector.from(ChatHistory.class)
					.where("time", "=", chatBean.getTime())
					.and("sendAliasName", "=", chatBean.getSendAliasName())
					.and("recvAliasName", "=", chatBean.getRecvAliasName())
					.and("userAliasName", "=", chatBean.getUserAliasName()));
		if(chat != null) {
			chat.setMsgStatus(chatBean.getMsgStatus());
			db.update(chat, "msgStatus");
		}
	} catch (DbException e) {
		Log.e(TAG, e.getMessage());
	}
	return chat;
}
 
开发者ID:zhaoyangzhou,项目名称:NPush,代码行数:26,代码来源:IMUtil.java

示例3: onChildClick

import com.lidroid.xutils.db.sqlite.Selector; //导入依赖的package包/类
@Override
public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id)
{
	BookFile file = adapter.getChild(groupPosition, childPosition);
	final File f = new File(file.path);
	if (f.canRead())
	{
		if (f.isDirectory()) setFileView(file.path);
		else
		{
			Book book = new Book(f);
			Book oldBook = db.findFirst(Selector.from(Book.class).where("path", "=", book.path));
			if (oldBook == null) book = db.saveAndFind(book, Selector.from(Book.class).where("path", "=", book.path));

			App.openBook(this, book);
		}
	}
	else T.ShortToast("对不起,您的访问权限不足!");

	return true;
}
 
开发者ID:AlixMing,项目名称:FBreader,代码行数:22,代码来源:FileActivity.java

示例4: loadGlobalValue

import com.lidroid.xutils.db.sqlite.Selector; //导入依赖的package包/类
public static void loadGlobalValue(Context context)
{
	DbUtils utils = DatabaseUtils.getDbUtils(context);
	String userId = UserServiceImpl.getCurrentUserId(context);
	if (userId != null && !"".equals(userId))
	{
		int currentUserId = Integer.parseInt(userId);
		SystemConfig config = null;
		try
		{
			config = utils.findFirst(Selector.from(SystemConfig.class).where("id", "=",
					currentUserId));
			if (config != null)
			{
				MyApplication.isAutoLogin = config.isAutoLogin();
				MyApplication.isReceivePush = config.isReceivePush();
			}
		} catch (Exception e)
		{
			e.printStackTrace();
		}
	}

}
 
开发者ID:ChenAt,项目名称:Translation,代码行数:25,代码来源:UserServiceImpl.java

示例5: updateDownlaodstatue

import com.lidroid.xutils.db.sqlite.Selector; //导入依赖的package包/类
/**
 * 更新下载状态
 */
public void updateDownlaodstatue(String bookName,String bookId) {
	try {
		List<BaiduInfo> list = db.findAll(Selector.from(BaiduInfo.class)
				.where("bookName", "=", bookName).and("bookId", "=", bookId));
		if (list != null && !list.isEmpty()) {
			BaiduInfo book = list.get(0);
			book.setAutoResume(true);// 下载完成
			db.update(book);
		}

	} catch (DbException e) {
		MyLogger.kLog().e(e);
	}

}
 
开发者ID:justingboy,项目名称:CouldBooks,代码行数:19,代码来源:BaiduBookDownload.java

示例6: queryBookDownloadStatue

import com.lidroid.xutils.db.sqlite.Selector; //导入依赖的package包/类
/**
 * 查询下载的状态
 * 
 * @param bookName
 * @return
 */
public boolean queryBookDownloadStatue(String bookName,String bookId) {
	try {
		List<BaiduInfo> list = db.findAll(Selector.from(BaiduInfo.class)
				.where("bookName", "=", bookName).and("bookId", "=", bookId));
		if (list != null && !list.isEmpty()) {
			BaiduInfo book = list.get(0);
			return book.isAutoResume();
		}

	} catch (DbException e) {
		MyLogger.kLog().e(e);
		return false;
	}
	return false;

}
 
开发者ID:justingboy,项目名称:CouldBooks,代码行数:23,代码来源:BaiduBookDownload.java

示例7: updateDownSuccess

import com.lidroid.xutils.db.sqlite.Selector; //导入依赖的package包/类
/**
 * 设置下载完成的状态
 * 
 * @param bookName
 */
public void updateDownSuccess(String bookName, String bookId) {

	try {
		List<BaiduInfo> list = db.findAll(Selector.from(BaiduInfo.class)
				.where("bookName", "=", bookName)
				.and("bookId", "=", bookId));
		if (list != null && !list.isEmpty()) {
			BaiduInfo book = list.get(0);
			book.setAutoResume(true);
			db.update(book);
		}

	} catch (DbException e) {
		MyLogger.kLog().e(e);
	}
}
 
开发者ID:justingboy,项目名称:CouldBooks,代码行数:22,代码来源:BaiduBookDownload.java

示例8: isDownload

import com.lidroid.xutils.db.sqlite.Selector; //导入依赖的package包/类
/**
 * 根据书名判断该书是否已下载
 * 
 * @param bookName
 * @return
 */
public boolean isDownload(String bookName, String bookId) {
	try {
		List<BaiduInfo> list = db.findAll(Selector.from(BaiduInfo.class)
				.where("bookName", "=", bookName)
				.and("bookId", "=", bookId));
		if (list == null || list.isEmpty())
			return false;
		else
			return true;

	} catch (DbException e) {
		return false;
	}

}
 
开发者ID:justingboy,项目名称:CouldBooks,代码行数:22,代码来源:BaiduBookDownload.java

示例9: getReaderBookCount

import com.lidroid.xutils.db.sqlite.Selector; //导入依赖的package包/类
/**
 * 查询已经阅读过的书
 * 
 * @return
 */
public int getReaderBookCount() {

	try {
		List<BookDownloadInfo> list = db.findAll(Selector.from(
				BookDownloadInfo.class).where("bookIsRead", "=", true));
		if (list != null)
			return list.size();
	} catch (DbException e) {
		// TODO Auto-generated catch block
		MyLogger.kLog().e(e);
		return getDownloadInfoListCount();
	}

	return getDownloadInfoListCount();
}
 
开发者ID:justingboy,项目名称:CouldBooks,代码行数:21,代码来源:BookDownloadManager.java

示例10: isDownload

import com.lidroid.xutils.db.sqlite.Selector; //导入依赖的package包/类
/**
 * 判断数据库中是否已经下载过
 * 
 * @param book
 * @return
 */
public boolean isDownload(BookDetails book) {
	try {
		List<BookDownloadInfo> list = db.findAll(Selector
				.from(BookDownloadInfo.class)
				.where("downloadUrl", "=", book.getBook_Download())
				.and("bookId", "=", book.getBook_ID()+"")
				.and("bookName", "=", book.getBook_Name()));
		if (list == null || list.isEmpty())
			return false;
		else
			return true;

	} catch (DbException e) {
		return false;
	}

}
 
开发者ID:justingboy,项目名称:CouldBooks,代码行数:24,代码来源:BookDownloadManager.java

示例11: querryByBookName

import com.lidroid.xutils.db.sqlite.Selector; //导入依赖的package包/类
/**
 * 判断数据库中是否已经下载过
 * @param bookName
 * @param bookId
 * @return
 */
public BookDownloadInfo querryByBookName(String bookName, String bookId) {
	try {
		List<BookDownloadInfo> list = db.findAll(Selector
				.from(BookDownloadInfo.class)
				.where("bookName", "=", bookName)
				.and("bookId", "=", bookId));
		if (list != null && !list.isEmpty())

			return list.get(0);
		else
			return null;

	} catch (DbException e) {
		return null;
	}

}
 
开发者ID:justingboy,项目名称:CouldBooks,代码行数:24,代码来源:BookDownloadManager.java

示例12: updateReaderProgress

import com.lidroid.xutils.db.sqlite.Selector; //导入依赖的package包/类
/**
 * 保存阅读进度
 * @param bookMark
 * @param chapterNum
 */
public void updateReaderProgress(BookMark bookMark, int chapterNum) {
	List<BaiduInfo> list;
	try {
		list = db.findAll(Selector.from(BaiduInfo.class)
				.where("bookName", "=", bookMark.getBookName())
				.and("bookId", "=", bookMark.getBookId()));
		if (list != null && !list.isEmpty()) {
			BaiduInfo bookinfo = list.get(0);
			bookinfo.setBookReadHository(bookMark.getChapterName());
			bookinfo.setBookIsRead(true);
			DecimalFormat df = new DecimalFormat("#.#");
			double progress = 100 * ((double) bookMark.getPosition() / chapterNum);
			bookinfo.setLastReaderProgress(df.format(progress) + "%");
			db.update(bookinfo);
		}
	} catch (DbException e) {
		// TODO Auto-generated catch block
		Log.e("msg", e.getMessage());
	}

}
 
开发者ID:justingboy,项目名称:CouldBooks,代码行数:27,代码来源:BookDownloadManager.java

示例13: setBookReader

import com.lidroid.xutils.db.sqlite.Selector; //导入依赖的package包/类
/**
 * 设置阅读状态
 * @param bookName
 * @param bookId
 */
public void setBookReader(String bookName, String bookId) {
	List<BaiduInfo> list;
	try {
		list = db.findAll(Selector.from(BaiduInfo.class)
				.where("bookName", "=", bookName)
				.and("bookId", "=", bookId));
		if (list != null && !list.isEmpty()) {
			BaiduInfo bookinfo = list.get(0);
			bookinfo.setBookIsRead(true);
			db.update(bookinfo);
		}
	} catch (DbException e) {
		Log.e("msg", e.getMessage());
	}

}
 
开发者ID:justingboy,项目名称:CouldBooks,代码行数:22,代码来源:BookDownloadManager.java

示例14: updateDownSuccess

import com.lidroid.xutils.db.sqlite.Selector; //导入依赖的package包/类
/**
 * 设置下载完成
 * @param bookName
 * @param bookId
 * @param isSuccess
 */
public void updateDownSuccess(String bookName, String bookId,
		boolean isSuccess) {
	List<BaiduInfo> list;
	try {
		list = db.findAll(Selector.from(BaiduInfo.class)
				.where("bookName", "=", bookName)
				.and("bookId", "=", bookId));
		if (list != null && !list.isEmpty()) {
			BaiduInfo bookinfo = list.get(0);
			bookinfo.setAutoResume(isSuccess);
			db.update(bookinfo);
		}
	} catch (DbException e) {
		// TODO Auto-generated catch block
		Log.e("msg", e.getMessage());
	}
}
 
开发者ID:justingboy,项目名称:CouldBooks,代码行数:24,代码来源:BookDownloadManager.java

示例15: queryBookDownSuccess

import com.lidroid.xutils.db.sqlite.Selector; //导入依赖的package包/类
/**
 * 查询状态 下载是否完成
 * @param bookName
 * @param bookId
 * @return
 */
public boolean queryBookDownSuccess(String bookName, String bookId) {

	List<BaiduInfo> list;
	try {
		list = db.findAll(Selector.from(BaiduInfo.class)
				.where("bookName", "=", bookName)
				.and("bookId", "=", bookId));
		if (list != null && !list.isEmpty()) {
			BaiduInfo bookinfo = list.get(0);
			return bookinfo.isAutoResume();
		}
	} catch (DbException e) {
		// TODO Auto-generated catch block
		Log.e("msg", e.getMessage());
	}

	return false;
}
 
开发者ID:justingboy,项目名称:CouldBooks,代码行数:25,代码来源:BookDownloadManager.java


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