本文整理汇总了Java中com.j256.ormlite.dao.RuntimeExceptionDao.queryForAll方法的典型用法代码示例。如果您正苦于以下问题:Java RuntimeExceptionDao.queryForAll方法的具体用法?Java RuntimeExceptionDao.queryForAll怎么用?Java RuntimeExceptionDao.queryForAll使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.j256.ormlite.dao.RuntimeExceptionDao
的用法示例。
在下文中一共展示了RuntimeExceptionDao.queryForAll方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: clearDao
import com.j256.ormlite.dao.RuntimeExceptionDao; //导入方法依赖的package包/类
private void clearDao(RuntimeExceptionDao<ICal, Long> iCalDao)
{
List<ICal> retrievedICals = iCalDao.queryForAll();
for(ICal i : retrievedICals)
{
iCalDao.delete(i);
}
}
示例2: doSampleDatabaseNoteStuff
import com.j256.ormlite.dao.RuntimeExceptionDao; //导入方法依赖的package包/类
/**
* Do our sample database stuff.
*/
private void doSampleDatabaseNoteStuff(String action, TextView tv) {
// get our dao
RuntimeExceptionDao<Note, Integer> simpleDao = getHelper().getNoteDao();
// query for all of the data objects in the database
List<Note> list = simpleDao.queryForAll();
// our string builder for building the content-view
StringBuilder sb = new StringBuilder();
sb.append("Found ").append(list.size()).append(" entries in DB in ").append(action).append("()\n");
// if we already have items in the database
int simpleC = 1;
for (Note simple : list) {
sb.append('#').append(simpleC).append(": ").append(simple).append('\n');
simpleC++;
}
// sb.append("------------------------------------------\n");
// sb.append("Deleted ids:");
// for (Note simple : list) {
// if (simple.getObjectId().contains("0")) {
// simple.setObjectId("ObjectId" + System.currentTimeMillis());
// simpleDao.update(simple);
// } else
// simpleDao.delete(simple);
// sb.append(' ').append(simple.getObjectId());
// Log.i(LOG_TAG, "deleting simple(" + simple.getObjectId() + ")");
// simpleC++;
// }
// sb.append('\n');
// sb.append("------------------------------------------\n");
//
// int createNum;
// do {
// createNum = new Random().nextInt(MAX_NUM_TO_CREATE) + 1;
// } while (createNum == list.size());
// sb.append("Creating ").append(createNum).append(" new entries:\n");
// for (int i = 0; i < createNum; i++) {
// // create a new simple object
// long millis = System.currentTimeMillis();
// Note simple = new Note("objectId " + millis + "/" + i, "title", millis, "contentCode"
// , "folder", "folderId", "type");
// // store it in the database
// simpleDao.create(simple);
// Log.i(LOG_TAG, "created simple(" + millis + ")");
// // output it
// sb.append('#').append(i + 1).append(": ");
// sb.append(simple).append('\n');
// try {
// Thread.sleep(5);
// } catch (InterruptedException e) {
// // ignore
// }
// }
tv.setText(sb.toString());
Log.i(LOG_TAG, "Done with page at " + System.currentTimeMillis());
}