本文整理汇总了Java中com.j256.ormlite.android.AndroidDatabaseResults.getRawCursor方法的典型用法代码示例。如果您正苦于以下问题:Java AndroidDatabaseResults.getRawCursor方法的具体用法?Java AndroidDatabaseResults.getRawCursor怎么用?Java AndroidDatabaseResults.getRawCursor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.j256.ormlite.android.AndroidDatabaseResults
的用法示例。
在下文中一共展示了AndroidDatabaseResults.getRawCursor方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: makeSubjectCursor
import com.j256.ormlite.android.AndroidDatabaseResults; //导入方法依赖的package包/类
/**
* Creates a cursor to get the topics in the stream in
*
* @param stream from which topics similar to {@param subject} are selected
* @param subject Filter out subject containing this string
*/
private Cursor makeSubjectCursor(CharSequence stream, CharSequence subject)
throws SQLException {
if (subject == null) {
subject = "";
}
if (stream == null) {
stream = "";
}
AndroidDatabaseResults results = (AndroidDatabaseResults) app
.getDao(Message.class)
.queryRaw(
"SELECT DISTINCT "
+ Message.SUBJECT_FIELD
+ ", 1 AS _id FROM messages JOIN streams ON streams."
+ Stream.ID_FIELD + " = messages."
+ Message.STREAM_FIELD + " WHERE "
+ Message.SUBJECT_FIELD
+ " LIKE ? ESCAPE '\\' AND "
+ Stream.NAME_FIELD + " = ? ORDER BY "
+ Message.SUBJECT_FIELD + " COLLATE NOCASE",
DatabaseHelper.likeEscape(subject.toString()) + "%",
stream.toString()).closeableIterator().getRawResults();
return results.getRawCursor();
}
示例2: obtainCursor
import com.j256.ormlite.android.AndroidDatabaseResults; //导入方法依赖的package包/类
private Cursor obtainCursor(PreparedQuery<Observation> query, Dao<Observation, Long> oDao) throws SQLException {
Cursor c = null;
CloseableIterator<Observation> iterator = oDao.iterator(query);
// get the raw results which can be cast under Android
AndroidDatabaseResults results = (AndroidDatabaseResults) iterator.getRawResults();
c = results.getRawCursor();
if (c.moveToLast()) {
long oldestTime = c.getLong(c.getColumnIndex("last_modified"));
Log.i(LOG_NAME, "last modified is: " + c.getLong(c.getColumnIndex("last_modified")));
Log.i(LOG_NAME, "querying again in: " + (oldestTime - requeryTime)/60000 + " minutes");
if (queryUpdateHandle != null) {
queryUpdateHandle.cancel(true);
}
queryUpdateHandle = scheduler.schedule(new Runnable() {
public void run() {
updateFilter();
}
}, oldestTime - requeryTime, TimeUnit.MILLISECONDS);
c.moveToFirst();
}
return c;
}
示例3: obtainCursor
import com.j256.ormlite.android.AndroidDatabaseResults; //导入方法依赖的package包/类
private Cursor obtainCursor(PreparedQuery<Location> query, Dao<Location, Long> lDao) throws SQLException {
Cursor c = null;
CloseableIterator<Location> iterator = lDao.iterator(query);
// get the raw results which can be cast under Android
AndroidDatabaseResults results = (AndroidDatabaseResults) iterator.getRawResults();
c = results.getRawCursor();
if (c.moveToLast()) {
if (queryUpdateHandle != null) {
queryUpdateHandle.cancel(true);
}
queryUpdateHandle = scheduler.schedule(new Runnable() {
public void run() {
updateTimeFilter(getTimeFilterId());
}
}, 30*1000, TimeUnit.MILLISECONDS);
c.moveToFirst();
}
return c;
}
示例4: getCursor
import com.j256.ormlite.android.AndroidDatabaseResults; //导入方法依赖的package包/类
public Cursor getCursor(QueryBuilder<T, Integer> qb) throws SQLException {
CloseableIterator<T> iterator = this.getDao().iterator(qb.prepare());
try {
AndroidDatabaseResults results = (AndroidDatabaseResults) iterator.getRawResults();
return results.getRawCursor();
} finally {
iterator.closeQuietly();
}
}
示例5: cursorFromQueryBuilder
import com.j256.ormlite.android.AndroidDatabaseResults; //导入方法依赖的package包/类
static Cursor cursorFromQueryBuilder(QueryBuilder queryBuilder, String[] projection, String selection, String[] selectionArgs, String sortOrder) throws SQLException {
if (projection != null)
queryBuilder.selectColumns(projection);
if (selection != null)
queryBuilder.where().raw(selection, OrmUtil.selectArgsFromStrings(selectionArgs));
if (sortOrder != null)
queryBuilder.orderBy(sortOrder, true);
CloseableIterator iterator = queryBuilder.iterator();
AndroidDatabaseResults results = (AndroidDatabaseResults) iterator.getRawResults();
return results.getRawCursor();
}
示例6: reload
import com.j256.ormlite.android.AndroidDatabaseResults; //导入方法依赖的package包/类
public void reload(){
if(itMangas != null){
itMangas.closeQuietly();
}
try{
itMangas = databaseHelper.getMangaRunDao().iterator(mangaQuery);
mMangas = (AndroidDatabaseResults) itMangas.getRawResults();
mAlphabetIndexer = new AlphabetIndexer(mMangas.getRawCursor(),
mMangas.findColumn(Manga.TITLE_COLUMN_NAME), sections);
} catch (SQLException e){
e.printStackTrace();
}
}
示例7: getCursor
import com.j256.ormlite.android.AndroidDatabaseResults; //导入方法依赖的package包/类
private Cursor getCursor(QueryBuilder<Card, Long> queryBuilder) throws SQLException {
CloseableIterator<Card> iterator = cardDao.iterator(queryBuilder.prepare());
AndroidDatabaseResults results = (AndroidDatabaseResults) iterator.getRawResults();
return results.getRawCursor();
}