本文整理汇总了Java中com.j256.ormlite.dao.RuntimeExceptionDao类的典型用法代码示例。如果您正苦于以下问题:Java RuntimeExceptionDao类的具体用法?Java RuntimeExceptionDao怎么用?Java RuntimeExceptionDao使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
RuntimeExceptionDao类属于com.j256.ormlite.dao包,在下文中一共展示了RuntimeExceptionDao类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateName
import com.j256.ormlite.dao.RuntimeExceptionDao; //导入依赖的package包/类
public static void updateName(final long faceId, final String name, final DatabaseCallback callback) {
DatabaseHelper.getInstance().execute(new Runnable() {
@Override
public void run() {
final RuntimeExceptionDao<MyFace, Long> dao = DatabaseHelper.getInstance().getCachedRuntimeExceptionDao(MyFace.class);
QueryBuilder<MyFace, Long> qb = dao.queryBuilder();
dao.callBatchTasks(new Callable() {
@Override
public Void call() throws Exception {
try {
if (dao.idExists(faceId)) {
UpdateBuilder<MyFace, Long> ub = dao.updateBuilder();
ub.where().eq("id", faceId);
ub.updateColumnValue("name", name);
ub.update();
}
} catch (Exception e) {
Log.w(TAG, e.getMessage());
}
return null;
}
});
}
});
}
示例2: updateNextCursorSync
import com.j256.ormlite.dao.RuntimeExceptionDao; //导入依赖的package包/类
public static void updateNextCursorSync(final MyFace face) {
final RuntimeExceptionDao<MyFace, Long> dao = DatabaseHelper.getInstance().getCachedRuntimeExceptionDao(MyFace.class);
dao.callBatchTasks(new Callable<Object>() {
@Override
public Object call() throws Exception {
try {
UpdateBuilder<MyFace, Long> ub = dao.updateBuilder();
ub.where().eq("id", face.id);
ub.updateColumnValue("nextCursor", face.nextCursor);
ub.update();
} catch (Exception e) {
Log.w(TAG, e.getMessage());
}
return null;
}
});
}
示例3: query
import com.j256.ormlite.dao.RuntimeExceptionDao; //导入依赖的package包/类
public static void query(final long limit, final DatabaseCallback<MyFace> callback) {
DatabaseHelper.getInstance().execute(new Runnable() {
@Override
public void run() {
final RuntimeExceptionDao<MyFace, Long> dao = DatabaseHelper.getInstance().getCachedRuntimeExceptionDao(MyFace.class);
QueryBuilder<MyFace, Long> qb = dao.queryBuilder();
qb.orderBy("name", false);
if (limit > 0) {
qb.limit(limit);
}
List<MyFace> result = null;
try {
result = qb.query();
callback.onCompleted(0, result);
} catch (Exception e) {
Log.w(TAG, e.getMessage());
callback.onCompleted(1, null);
}
}
});
}
示例4: getById
import com.j256.ormlite.dao.RuntimeExceptionDao; //导入依赖的package包/类
public static void getById(final long id, final DatabaseCallback<MyFace> callback) {
DatabaseHelper.getInstance().execute(new Runnable() {
@Override
public void run() {
final RuntimeExceptionDao<MyFace, Long> dao = DatabaseHelper.getInstance().getCachedRuntimeExceptionDao(MyFace.class);
QueryBuilder<MyFace, Long> qb = dao.queryBuilder();
try {
qb.where().eq("id", id);
callback.onCompleted(0, qb.query());
} catch (Exception e) {
Log.w(TAG, e.getMessage());
callback.onCompleted(1, null);
}
}
});
}
示例5: getMaxUploadedAt
import com.j256.ormlite.dao.RuntimeExceptionDao; //导入依赖的package包/类
public static void getMaxUploadedAt(final DatabaseCallback<MyFace> callback) {
DatabaseHelper.getInstance().execute(new Runnable() {
@Override
public void run() {
final RuntimeExceptionDao<MyFace, Long> dao = DatabaseHelper.getInstance().getCachedRuntimeExceptionDao(MyFace.class);
QueryBuilder<MyFace, Long> qb = dao.queryBuilder();
try {
qb.orderBy("mtime", false);
qb.limit(1L);
List<MyFace> result = qb.query();
callback.onCompleted(0, result);
} catch (Exception e) {
Log.w(TAG, e.getMessage());
callback.onCompleted(1, null);
}
}
});
}
示例6: deleteByIds
import com.j256.ormlite.dao.RuntimeExceptionDao; //导入依赖的package包/类
public static void deleteByIds(final List<Long> ids, final DatabaseCallback<Void> callback) {
DatabaseHelper.getInstance().execute(new Runnable() {
@Override
public void run() {
final RuntimeExceptionDao<MyFace, Long> dao = DatabaseHelper.getInstance().getCachedRuntimeExceptionDao(MyFace.class);
DeleteBuilder<MyFace, Long> db = dao.deleteBuilder();
try {
db.where().in("id", ids);
db.delete();
callback.onCompleted(0, null);
} catch (Exception e) {
e.printStackTrace();
callback.onCompleted(1, null);
}
}
});
}
示例7: deleteByPhotosSync
import com.j256.ormlite.dao.RuntimeExceptionDao; //导入依赖的package包/类
private static void deleteByPhotosSync(final List<Long> photoIds) {
final RuntimeExceptionDao<MyFacePhoto, Long> dao = DatabaseHelper.getInstance().getCachedRuntimeExceptionDao(MyFacePhoto.class);
dao.callBatchTasks(new Callable() {
@Override
public Object call() throws Exception {
try {
DeleteBuilder<MyFacePhoto, Long> builder = dao.deleteBuilder();
builder.where().in("photo_id", photoIds);
builder.delete();
} catch (Exception e) {
Log.w(TAG, e.getMessage());
}
return null;
}
});
}
示例8: 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;
}
}
示例9: getAll
import com.j256.ormlite.dao.RuntimeExceptionDao; //导入依赖的package包/类
public static void getAll(final List<String> folderList, final DatabaseCallback<UploadedPhoto> callback) {
DatabaseHelper.getInstance().execute(new Runnable() {
@Override
public void run() {
try {
final RuntimeExceptionDao<UploadedPhoto, Long> dao = DatabaseHelper.getInstance().getCachedRuntimeExceptionDao(UploadedPhoto.class);
QueryBuilder<UploadedPhoto, Long> qb = dao.queryBuilder();
qb.where().in("folder", folderList);
if (callback != null) callback.onCompleted(0, qb.query());
} catch (Exception e) {
Log.w(TAG, e.getMessage());
if (callback != null) callback.onCompleted(1, null);
}
}
});
}
示例10: updateSync
import com.j256.ormlite.dao.RuntimeExceptionDao; //导入依赖的package包/类
private static void updateSync(final String key, final String nextCursor) {
final RuntimeExceptionDao<MyCursor, Long> dao = DatabaseHelper.getInstance().getCachedRuntimeExceptionDao(MyCursor.class);
dao.callBatchTasks(new Callable() {
@Override
public Object call() throws Exception {
try {
QueryBuilder<MyCursor, Long> cursorQb = dao.queryBuilder();
cursorQb.where().eq("key", key);
List<MyCursor> cursor = cursorQb.query();
if (cursor != null && cursor.size() > 0) {
UpdateBuilder<MyCursor, Long> ub = dao.updateBuilder();
ub.where().eq("key", key);
ub.updateColumnValue("cursor", nextCursor);
ub.update();
} else {
dao.create(new MyCursor(key, nextCursor));
}
} catch (Exception e) {
Log.w(TAG, e.getMessage());
}
return null;
}
});
}
示例11: getNextCursor
import com.j256.ormlite.dao.RuntimeExceptionDao; //导入依赖的package包/类
public static void getNextCursor(final String key, final DatabaseCallback<MyCursor> callback) {
DatabaseHelper.getInstance().execute(new Runnable() {
@Override
public void run() {
final RuntimeExceptionDao<MyCursor, Long> dao = DatabaseHelper.getInstance().getCachedRuntimeExceptionDao(MyCursor.class);
QueryBuilder<MyCursor, Long> qb = dao.queryBuilder();
try {
qb.where().eq("key", key);
callback.onCompleted(0, qb.query());
} catch (Exception e) {
Log.w(TAG, e.getMessage());
callback.onCompleted(1, null);
}
}
});
}
示例12: updateNextCursorSync
import com.j256.ormlite.dao.RuntimeExceptionDao; //导入依赖的package包/类
public static void updateNextCursorSync(final MyMoment moment) {
final RuntimeExceptionDao<MyMoment, Long> dao = DatabaseHelper.getInstance().getCachedRuntimeExceptionDao(MyMoment.class);
dao.callBatchTasks(new Callable<Object>() {
@Override
public Object call() throws Exception {
try {
UpdateBuilder<MyMoment, Long> ub = dao.updateBuilder();
ub.where().eq("id", moment.id);
ub.updateColumnValue("nextCursor", moment.nextCursor);
ub.update();
} catch (Exception e) {
Log.w(TAG, e.getMessage());
}
return null;
}
});
}
示例13: getById
import com.j256.ormlite.dao.RuntimeExceptionDao; //导入依赖的package包/类
public static void getById(final long id, final DatabaseCallback<MyMoment> callback) {
DatabaseHelper.getInstance().execute(new Runnable() {
@Override
public void run() {
final RuntimeExceptionDao<MyMoment, Long> dao = DatabaseHelper.getInstance().getCachedRuntimeExceptionDao(MyMoment.class);
QueryBuilder<MyMoment, Long> qb = dao.queryBuilder();
try {
qb.where().eq("id", id);
qb.orderBy("takenAt", false);
if (callback != null) callback.onCompleted(0, qb.query());
} catch (Exception e) {
Log.w(TAG, e.getMessage());
if (callback != null) callback.onCompleted(1, null);
}
}
});
}
示例14: getByIds
import com.j256.ormlite.dao.RuntimeExceptionDao; //导入依赖的package包/类
public static void getByIds(final List<Long> ids, final DatabaseCallback<MyMoment> callback) {
DatabaseHelper.getInstance().execute(new Runnable() {
@Override
public void run() {
final RuntimeExceptionDao<MyMoment, Long> dao = DatabaseHelper.getInstance().getCachedRuntimeExceptionDao(MyMoment.class);
QueryBuilder<MyMoment, Long> qb = dao.queryBuilder();
try {
qb.where().in("id", ids);
qb.orderBy("takenAt", false);
if (callback != null) callback.onCompleted(0, qb.query());
} catch (Exception e) {
Log.w(TAG, e.getMessage());
if (callback != null) callback.onCompleted(1, null);
}
}
});
}
示例15: getMaxUploadedAt
import com.j256.ormlite.dao.RuntimeExceptionDao; //导入依赖的package包/类
public static void getMaxUploadedAt(final DatabaseCallback<MyMoment> callback) {
DatabaseHelper.getInstance().execute(new Runnable() {
@Override
public void run() {
final RuntimeExceptionDao<MyMoment, Long> dao = DatabaseHelper.getInstance().getCachedRuntimeExceptionDao(MyMoment.class);
QueryBuilder<MyMoment, Long> qb = dao.queryBuilder();
try {
qb.orderBy("mtime", false);
qb.limit(1L);
List<MyMoment> result = qb.query();
callback.onCompleted(0, result);
} catch (Exception e) {
Log.w(TAG, e.getMessage());
callback.onCompleted(1, null);
}
}
});
}