本文整理汇总了Java中com.j256.ormlite.dao.RuntimeExceptionDao.queryBuilder方法的典型用法代码示例。如果您正苦于以下问题:Java RuntimeExceptionDao.queryBuilder方法的具体用法?Java RuntimeExceptionDao.queryBuilder怎么用?Java RuntimeExceptionDao.queryBuilder使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.j256.ormlite.dao.RuntimeExceptionDao
的用法示例。
在下文中一共展示了RuntimeExceptionDao.queryBuilder方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getByFaceSync
import com.j256.ormlite.dao.RuntimeExceptionDao; //导入方法依赖的package包/类
private static List<Long> getByFaceSync(final long faceId) {
final RuntimeExceptionDao<MyFacePhoto, Long> daoFacePhoto = DatabaseHelper.getInstance().getCachedRuntimeExceptionDao(MyFacePhoto.class);
try {
QueryBuilder<MyFacePhoto, Long> facePhotoQb = daoFacePhoto.queryBuilder();
facePhotoQb.where().eq("faceId", faceId);
List<MyFacePhoto> facePhotos = facePhotoQb.query();
List<Long> photoIds = new ArrayList<>();
for (MyFacePhoto fp : facePhotos) {
photoIds.add(fp.photoId);
}
return photoIds;
} catch (Exception e) {
Log.w(TAG, e.getMessage());
return null;
}
}
示例2: getByMomentSync
import com.j256.ormlite.dao.RuntimeExceptionDao; //导入方法依赖的package包/类
private static List<Long> getByMomentSync(final long momentId) {
final RuntimeExceptionDao<MyMomentPhoto, Long> daoMomentPhoto = DatabaseHelper.getInstance().getCachedRuntimeExceptionDao(MyMomentPhoto.class);
try {
QueryBuilder<MyMomentPhoto, Long> momentPhotoQb = daoMomentPhoto.queryBuilder();
momentPhotoQb.where().eq("momentId", momentId);
List<MyMomentPhoto> momentPhotos = momentPhotoQb.query();
List<Long> photoIds = new ArrayList<>();
for (MyMomentPhoto mp : momentPhotos) {
photoIds.add(mp.photoId);
}
return photoIds;
} catch (Exception e) {
Log.w(TAG, e.getMessage());
return null;
}
}
示例3: getByTagSync
import com.j256.ormlite.dao.RuntimeExceptionDao; //导入方法依赖的package包/类
private static List<Long> getByTagSync(final long tagId) {
final RuntimeExceptionDao<MyTagPhoto, Long> daoTagPhoto = DatabaseHelper.getInstance().getCachedRuntimeExceptionDao(MyTagPhoto.class);
try {
QueryBuilder<MyTagPhoto, Long> tagPhotoQb = daoTagPhoto.queryBuilder();
tagPhotoQb.where().eq("tagId", tagId);
List<MyTagPhoto> tagPhotos = tagPhotoQb.query();
List<Long> photoIds = new ArrayList<>();
for (MyTagPhoto tp : tagPhotos) {
photoIds.add(tp.photoId);
}
return photoIds;
} catch (Exception e) {
Log.w(TAG, e.getMessage());
return null;
}
}
示例4: getByAlbumSync
import com.j256.ormlite.dao.RuntimeExceptionDao; //导入方法依赖的package包/类
private static List<Long> getByAlbumSync(final long albumId) {
final RuntimeExceptionDao<MyAlbumPhoto, Long> daoAlbumPhoto = DatabaseHelper.getInstance().getCachedRuntimeExceptionDao(MyAlbumPhoto.class);
try {
QueryBuilder<MyAlbumPhoto, Long> albumPhotoQb = daoAlbumPhoto.queryBuilder();
albumPhotoQb.where().eq("albumId", albumId);
List<MyAlbumPhoto> albumPhotos = albumPhotoQb.query();
List<Long> photoIds = new ArrayList<>();
for (MyAlbumPhoto mp : albumPhotos) {
photoIds.add(mp.photoId);
}
return photoIds;
} catch (Exception e) {
Log.w(TAG, e.getMessage());
return null;
}
}
示例5: CartModel
import com.j256.ormlite.dao.RuntimeExceptionDao; //导入方法依赖的package包/类
public CartModel(RuntimeExceptionDao<Cart, Long> cartDao) {
mCartDao = cartDao;
QueryBuilder<Cart, Long> queryBuilder = cartDao.queryBuilder();
try {
queryBuilder.where().eq("status", CartStatus.SHOPPING);
mCart = cartDao.queryForFirst(queryBuilder.prepare());
} catch (SQLException e) {
Log.e(LOG_TAG, "Failed to load cart from database", e);
}
mCartEntries = new ObservableArrayList<>();
if (mCart != null) {
mCartEntries.addAll(mCart.getEntries());
} else {
createNewCart();
}
EventBus.getDefault().register(this);
}
示例6: createIfNotExists
import com.j256.ormlite.dao.RuntimeExceptionDao; //导入方法依赖的package包/类
private void createIfNotExists(RuntimeExceptionDao<ICal, Long> iCalDao, ICal iCal)
{
List<ICal> retrievedICals = new ArrayList<>();
QueryBuilder<ICal, Long> queryBuilder = iCalDao.queryBuilder();
try {
queryBuilder.where().eq("summery", iCal.getSummery()).and().eq("start", iCal.getStart())
.and().eq("end", iCal.getEnd());
} catch (SQLException e) {
e.printStackTrace();
}
if(retrievedICals.size() == 0)
{
iCalDao.create(iCal);
}
}
示例7: getAllSync
import com.j256.ormlite.dao.RuntimeExceptionDao; //导入方法依赖的package包/类
public static List<MyFace> getAllSync() {
final RuntimeExceptionDao<MyFace, Long> dao = DatabaseHelper.getInstance().getCachedRuntimeExceptionDao(MyFace.class);
QueryBuilder<MyFace, Long> qb = dao.queryBuilder();
try {
qb.orderBy("name", false);
List<MyFace> result = qb.query();
return result;
} catch (Exception e) {
Log.w(TAG, e.getMessage());
return null;
}
}
示例8: getAllExceptIdsSync
import com.j256.ormlite.dao.RuntimeExceptionDao; //导入方法依赖的package包/类
public static List<MyFace> getAllExceptIdsSync(List<Long> ids) {
final RuntimeExceptionDao<MyFace, Long> dao = DatabaseHelper.getInstance().getCachedRuntimeExceptionDao(MyFace.class);
QueryBuilder<MyFace, Long> qb = dao.queryBuilder();
try {
qb.orderBy("name", false);
qb.where().notIn("id", ids);
List<MyFace> result = qb.query();
return result;
} catch (Exception e) {
Log.w(TAG, e.getMessage());
return null;
}
}
示例9: getAllSync
import com.j256.ormlite.dao.RuntimeExceptionDao; //导入方法依赖的package包/类
public static List<MyMoment> getAllSync() {
final RuntimeExceptionDao<MyMoment, Long> dao = DatabaseHelper.getInstance().getCachedRuntimeExceptionDao(MyMoment.class);
QueryBuilder<MyMoment, Long> qb = dao.queryBuilder();
try {
qb.orderBy("takenAt", false);
List<MyMoment> result = qb.query();
return result;
} catch (Exception e) {
Log.w(TAG, e.getMessage());
return null;
}
}
示例10: getAllSyncExceptSubTag
import com.j256.ormlite.dao.RuntimeExceptionDao; //导入方法依赖的package包/类
private static List<MyTag> getAllSyncExceptSubTag() {
final RuntimeExceptionDao<MyTag, Long> dao = DatabaseHelper.getInstance().getCachedRuntimeExceptionDao(MyTag.class);
QueryBuilder<MyTag, Long> qb = dao.queryBuilder();
try {
qb.where().eq("isSubTag", false);
List<MyTag> result = qb.query();
return result;
} catch (Exception e) {
Log.w(TAG, e.getMessage());
return null;
}
}
示例11: getAllSync
import com.j256.ormlite.dao.RuntimeExceptionDao; //导入方法依赖的package包/类
public static List<MyAlbum> getAllSync() {
final RuntimeExceptionDao<MyAlbum, Long> dao = DatabaseHelper.getInstance().getCachedRuntimeExceptionDao(MyAlbum.class);
QueryBuilder<MyAlbum, Long> qb = dao.queryBuilder();
try {
qb.where().eq("state", "active");
qb.orderBy("ctime", false);
List<MyAlbum> result = qb.query();
return result;
} catch (Exception e) {
Log.w(TAG, e.getMessage());
return null;
}
}
示例12: getAllExceptIdsSync
import com.j256.ormlite.dao.RuntimeExceptionDao; //导入方法依赖的package包/类
public static List<MyAlbum> getAllExceptIdsSync(List<Long> ids) {
final RuntimeExceptionDao<MyAlbum, Long> dao = DatabaseHelper.getInstance().getCachedRuntimeExceptionDao(MyAlbum.class);
QueryBuilder<MyAlbum, Long> qb = dao.queryBuilder();
try {
qb.where().eq("state", "active");
qb.where().notIn("id", ids);
qb.orderBy("ctime", false);
List<MyAlbum> result = qb.query();
return result;
} catch (Exception e) {
Log.w(TAG, e.getMessage());
return null;
}
}
示例13: getByIdsSync
import com.j256.ormlite.dao.RuntimeExceptionDao; //导入方法依赖的package包/类
public static List<MyPhoto> getByIdsSync(final List<Long> ids) {
final RuntimeExceptionDao<MyPhoto, Long> dao = DatabaseHelper.getInstance().getCachedRuntimeExceptionDao(MyPhoto.class);
QueryBuilder<MyPhoto, Long> qb = dao.queryBuilder();
try {
qb.where().in("id", ids);
qb.orderBy("ctime", false);
return qb.query();
} catch (Exception e) {
Log.w(TAG, e.getMessage());
}
return null;
}
示例14: getAllSync
import com.j256.ormlite.dao.RuntimeExceptionDao; //导入方法依赖的package包/类
public static List<MyPhoto> getAllSync() {
final RuntimeExceptionDao<MyPhoto, Long> dao = DatabaseHelper.getInstance().getCachedRuntimeExceptionDao(MyPhoto.class);
QueryBuilder<MyPhoto, Long> qb = dao.queryBuilder();
try {
qb.where().eq("state", "active");
qb.orderBy("ctime", false);
List<MyPhoto> result = qb.query();
return result;
} catch (Exception e) {
Log.w(TAG, e.getMessage());
return null;
}
}
示例15: loadInBackground
import com.j256.ormlite.dao.RuntimeExceptionDao; //导入方法依赖的package包/类
@Override
public List<BlackList> loadInBackground() {
RuntimeExceptionDao<BlackList, Integer> dao = mDBHelper.getBlackListDao();
QueryBuilder<BlackList, Integer> builder = dao.queryBuilder();
try {
return builder.orderBy(BlackList.CREATE_TIME, false).query();
} catch (SQLException e) {
e.printStackTrace();
}
return null;
}