本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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();
}
}
}
示例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);
}
}
示例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;
}
示例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);
}
}
示例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;
}
}
示例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();
}
示例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;
}
}
示例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;
}
}
示例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());
}
}
示例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());
}
}
示例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());
}
}
示例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;
}