use of androidx.room.RoomSQLiteQuery in project LearningApps by evitwilly.
the class NoteDao_Impl method notesByCreatedDate.
@Override
public Object notesByCreatedDate(final Continuation<? super List<NoteWithTags>> continuation) {
final String _sql = "select * from notes order by created_date";
final RoomSQLiteQuery _statement = RoomSQLiteQuery.acquire(_sql, 0);
final CancellationSignal _cancellationSignal = DBUtil.createCancellationSignal();
return CoroutinesRoom.execute(__db, true, _cancellationSignal, new Callable<List<NoteWithTags>>() {
@Override
public List<NoteWithTags> call() throws Exception {
__db.beginTransaction();
try {
final Cursor _cursor = DBUtil.query(__db, _statement, true, null);
try {
final int _cursorIndexOfTitle = CursorUtil.getColumnIndexOrThrow(_cursor, "title");
final int _cursorIndexOfCreatedDate = CursorUtil.getColumnIndexOrThrow(_cursor, "created_date");
final int _cursorIndexOfEditedDate = CursorUtil.getColumnIndexOrThrow(_cursor, "edited_date");
final int _cursorIndexOfId = CursorUtil.getColumnIndexOrThrow(_cursor, "id");
final LongSparseArray<ArrayList<Tag>> _collectionTags = new LongSparseArray<ArrayList<Tag>>();
while (_cursor.moveToNext()) {
final long _tmpKey = _cursor.getLong(_cursorIndexOfId);
ArrayList<Tag> _tmpTagsCollection = _collectionTags.get(_tmpKey);
if (_tmpTagsCollection == null) {
_tmpTagsCollection = new ArrayList<Tag>();
_collectionTags.put(_tmpKey, _tmpTagsCollection);
}
}
_cursor.moveToPosition(-1);
__fetchRelationshiptagsAsruFreeitNotesDataDbEntityTag(_collectionTags);
final List<NoteWithTags> _result = new ArrayList<NoteWithTags>(_cursor.getCount());
while (_cursor.moveToNext()) {
final NoteWithTags _item;
final Note _tmpNote;
if (!(_cursor.isNull(_cursorIndexOfTitle) && _cursor.isNull(_cursorIndexOfCreatedDate) && _cursor.isNull(_cursorIndexOfEditedDate) && _cursor.isNull(_cursorIndexOfId))) {
final String _tmpTitle;
if (_cursor.isNull(_cursorIndexOfTitle)) {
_tmpTitle = null;
} else {
_tmpTitle = _cursor.getString(_cursorIndexOfTitle);
}
final long _tmpCreatedDate;
_tmpCreatedDate = _cursor.getLong(_cursorIndexOfCreatedDate);
final long _tmpEditedDate;
_tmpEditedDate = _cursor.getLong(_cursorIndexOfEditedDate);
final long _tmpId;
_tmpId = _cursor.getLong(_cursorIndexOfId);
_tmpNote = new Note(_tmpTitle, _tmpCreatedDate, _tmpEditedDate, _tmpId);
} else {
_tmpNote = null;
}
ArrayList<Tag> _tmpTagsCollection_1 = null;
final long _tmpKey_1 = _cursor.getLong(_cursorIndexOfId);
_tmpTagsCollection_1 = _collectionTags.get(_tmpKey_1);
if (_tmpTagsCollection_1 == null) {
_tmpTagsCollection_1 = new ArrayList<Tag>();
}
_item = new NoteWithTags(_tmpNote, _tmpTagsCollection_1);
_result.add(_item);
}
__db.setTransactionSuccessful();
return _result;
} finally {
_cursor.close();
_statement.release();
}
} finally {
__db.endTransaction();
}
}
}, continuation);
}
use of androidx.room.RoomSQLiteQuery in project LearningApps by evitwilly.
the class NoteDao_Impl method notes.
@Override
public Object notes(final Continuation<? super List<NoteWithTags>> continuation) {
final String _sql = "select * from notes";
final RoomSQLiteQuery _statement = RoomSQLiteQuery.acquire(_sql, 0);
final CancellationSignal _cancellationSignal = DBUtil.createCancellationSignal();
return CoroutinesRoom.execute(__db, true, _cancellationSignal, new Callable<List<NoteWithTags>>() {
@Override
public List<NoteWithTags> call() throws Exception {
__db.beginTransaction();
try {
final Cursor _cursor = DBUtil.query(__db, _statement, true, null);
try {
final int _cursorIndexOfTitle = CursorUtil.getColumnIndexOrThrow(_cursor, "title");
final int _cursorIndexOfCreatedDate = CursorUtil.getColumnIndexOrThrow(_cursor, "created_date");
final int _cursorIndexOfEditedDate = CursorUtil.getColumnIndexOrThrow(_cursor, "edited_date");
final int _cursorIndexOfId = CursorUtil.getColumnIndexOrThrow(_cursor, "id");
final LongSparseArray<ArrayList<Tag>> _collectionTags = new LongSparseArray<ArrayList<Tag>>();
while (_cursor.moveToNext()) {
final long _tmpKey = _cursor.getLong(_cursorIndexOfId);
ArrayList<Tag> _tmpTagsCollection = _collectionTags.get(_tmpKey);
if (_tmpTagsCollection == null) {
_tmpTagsCollection = new ArrayList<Tag>();
_collectionTags.put(_tmpKey, _tmpTagsCollection);
}
}
_cursor.moveToPosition(-1);
__fetchRelationshiptagsAsruFreeitNotesDataDbEntityTag(_collectionTags);
final List<NoteWithTags> _result = new ArrayList<NoteWithTags>(_cursor.getCount());
while (_cursor.moveToNext()) {
final NoteWithTags _item;
final Note _tmpNote;
if (!(_cursor.isNull(_cursorIndexOfTitle) && _cursor.isNull(_cursorIndexOfCreatedDate) && _cursor.isNull(_cursorIndexOfEditedDate) && _cursor.isNull(_cursorIndexOfId))) {
final String _tmpTitle;
if (_cursor.isNull(_cursorIndexOfTitle)) {
_tmpTitle = null;
} else {
_tmpTitle = _cursor.getString(_cursorIndexOfTitle);
}
final long _tmpCreatedDate;
_tmpCreatedDate = _cursor.getLong(_cursorIndexOfCreatedDate);
final long _tmpEditedDate;
_tmpEditedDate = _cursor.getLong(_cursorIndexOfEditedDate);
final long _tmpId;
_tmpId = _cursor.getLong(_cursorIndexOfId);
_tmpNote = new Note(_tmpTitle, _tmpCreatedDate, _tmpEditedDate, _tmpId);
} else {
_tmpNote = null;
}
ArrayList<Tag> _tmpTagsCollection_1 = null;
final long _tmpKey_1 = _cursor.getLong(_cursorIndexOfId);
_tmpTagsCollection_1 = _collectionTags.get(_tmpKey_1);
if (_tmpTagsCollection_1 == null) {
_tmpTagsCollection_1 = new ArrayList<Tag>();
}
_item = new NoteWithTags(_tmpNote, _tmpTagsCollection_1);
_result.add(_item);
}
__db.setTransactionSuccessful();
return _result;
} finally {
_cursor.close();
_statement.release();
}
} finally {
__db.endTransaction();
}
}
}, continuation);
}
use of androidx.room.RoomSQLiteQuery in project LibChecker-Rules-Bundle by zhaobozhen.
the class RuleDao_Impl method selectAllRules.
@Override
public Cursor selectAllRules() {
final String _sql = "SELECT * FROM rules_table";
final RoomSQLiteQuery _statement = RoomSQLiteQuery.acquire(_sql, 0);
final Cursor _tmpResult = __db.query(_statement);
return _tmpResult;
}
use of androidx.room.RoomSQLiteQuery in project LibChecker-Rules-Bundle by zhaobozhen.
the class RuleDao_Impl method getAllRules.
@Override
public Object getAllRules(final Continuation<? super List<RuleEntity>> continuation) {
final String _sql = "SELECT * from rules_table";
final RoomSQLiteQuery _statement = RoomSQLiteQuery.acquire(_sql, 0);
final CancellationSignal _cancellationSignal = DBUtil.createCancellationSignal();
return CoroutinesRoom.execute(__db, false, _cancellationSignal, new Callable<List<RuleEntity>>() {
@Override
public List<RuleEntity> call() throws Exception {
final Cursor _cursor = DBUtil.query(__db, _statement, false, null);
try {
final int _cursorIndexOfId = CursorUtil.getColumnIndexOrThrow(_cursor, "_id");
final int _cursorIndexOfName = CursorUtil.getColumnIndexOrThrow(_cursor, "name");
final int _cursorIndexOfLabel = CursorUtil.getColumnIndexOrThrow(_cursor, "label");
final int _cursorIndexOfType = CursorUtil.getColumnIndexOrThrow(_cursor, "type");
final int _cursorIndexOfIconIndex = CursorUtil.getColumnIndexOrThrow(_cursor, "iconIndex");
final int _cursorIndexOfIsRegexRule = CursorUtil.getColumnIndexOrThrow(_cursor, "isRegexRule");
final int _cursorIndexOfRegexName = CursorUtil.getColumnIndexOrThrow(_cursor, "regexName");
final List<RuleEntity> _result = new ArrayList<RuleEntity>(_cursor.getCount());
while (_cursor.moveToNext()) {
final RuleEntity _item;
final int _tmpId;
_tmpId = _cursor.getInt(_cursorIndexOfId);
final String _tmpName;
if (_cursor.isNull(_cursorIndexOfName)) {
_tmpName = null;
} else {
_tmpName = _cursor.getString(_cursorIndexOfName);
}
final String _tmpLabel;
if (_cursor.isNull(_cursorIndexOfLabel)) {
_tmpLabel = null;
} else {
_tmpLabel = _cursor.getString(_cursorIndexOfLabel);
}
final int _tmpType;
_tmpType = _cursor.getInt(_cursorIndexOfType);
final int _tmpIconIndex;
_tmpIconIndex = _cursor.getInt(_cursorIndexOfIconIndex);
final boolean _tmpIsRegexRule;
final int _tmp;
_tmp = _cursor.getInt(_cursorIndexOfIsRegexRule);
_tmpIsRegexRule = _tmp != 0;
final String _tmpRegexName;
if (_cursor.isNull(_cursorIndexOfRegexName)) {
_tmpRegexName = null;
} else {
_tmpRegexName = _cursor.getString(_cursorIndexOfRegexName);
}
_item = new RuleEntity(_tmpId, _tmpName, _tmpLabel, _tmpType, _tmpIconIndex, _tmpIsRegexRule, _tmpRegexName);
_result.add(_item);
}
return _result;
} finally {
_cursor.close();
_statement.release();
}
}
}, continuation);
}
use of androidx.room.RoomSQLiteQuery in project LearningApps by evitwilly.
the class NoteDao_Impl method noteBy.
@Override
public Object noteBy(final long id, final Continuation<? super NoteWithTags> continuation) {
final String _sql = "select * from notes where id = ?";
final RoomSQLiteQuery _statement = RoomSQLiteQuery.acquire(_sql, 1);
int _argIndex = 1;
_statement.bindLong(_argIndex, id);
final CancellationSignal _cancellationSignal = DBUtil.createCancellationSignal();
return CoroutinesRoom.execute(__db, true, _cancellationSignal, new Callable<NoteWithTags>() {
@Override
public NoteWithTags call() throws Exception {
__db.beginTransaction();
try {
final Cursor _cursor = DBUtil.query(__db, _statement, true, null);
try {
final int _cursorIndexOfTitle = CursorUtil.getColumnIndexOrThrow(_cursor, "title");
final int _cursorIndexOfCreatedDate = CursorUtil.getColumnIndexOrThrow(_cursor, "created_date");
final int _cursorIndexOfEditedDate = CursorUtil.getColumnIndexOrThrow(_cursor, "edited_date");
final int _cursorIndexOfId = CursorUtil.getColumnIndexOrThrow(_cursor, "id");
final LongSparseArray<ArrayList<Tag>> _collectionTags = new LongSparseArray<ArrayList<Tag>>();
while (_cursor.moveToNext()) {
final long _tmpKey = _cursor.getLong(_cursorIndexOfId);
ArrayList<Tag> _tmpTagsCollection = _collectionTags.get(_tmpKey);
if (_tmpTagsCollection == null) {
_tmpTagsCollection = new ArrayList<Tag>();
_collectionTags.put(_tmpKey, _tmpTagsCollection);
}
}
_cursor.moveToPosition(-1);
__fetchRelationshiptagsAsruFreeitNotesDataDbEntityTag(_collectionTags);
final NoteWithTags _result;
if (_cursor.moveToFirst()) {
final Note _tmpNote;
if (!(_cursor.isNull(_cursorIndexOfTitle) && _cursor.isNull(_cursorIndexOfCreatedDate) && _cursor.isNull(_cursorIndexOfEditedDate) && _cursor.isNull(_cursorIndexOfId))) {
final String _tmpTitle;
if (_cursor.isNull(_cursorIndexOfTitle)) {
_tmpTitle = null;
} else {
_tmpTitle = _cursor.getString(_cursorIndexOfTitle);
}
final long _tmpCreatedDate;
_tmpCreatedDate = _cursor.getLong(_cursorIndexOfCreatedDate);
final long _tmpEditedDate;
_tmpEditedDate = _cursor.getLong(_cursorIndexOfEditedDate);
final long _tmpId;
_tmpId = _cursor.getLong(_cursorIndexOfId);
_tmpNote = new Note(_tmpTitle, _tmpCreatedDate, _tmpEditedDate, _tmpId);
} else {
_tmpNote = null;
}
ArrayList<Tag> _tmpTagsCollection_1 = null;
final long _tmpKey_1 = _cursor.getLong(_cursorIndexOfId);
_tmpTagsCollection_1 = _collectionTags.get(_tmpKey_1);
if (_tmpTagsCollection_1 == null) {
_tmpTagsCollection_1 = new ArrayList<Tag>();
}
_result = new NoteWithTags(_tmpNote, _tmpTagsCollection_1);
} else {
_result = null;
}
__db.setTransactionSuccessful();
return _result;
} finally {
_cursor.close();
_statement.release();
}
} finally {
__db.endTransaction();
}
}
}, continuation);
}
Aggregations