Search in sources :

Example 16 with DbException

use of org.xutils.ex.DbException in project xUtils3 by wyouflf.

the class Selector method findAll.

public List<T> findAll() throws DbException {
    if (!table.tableIsExist())
        return null;
    List<T> result = null;
    Cursor cursor = table.getDb().execQuery(this.toString());
    if (cursor != null) {
        try {
            result = new ArrayList<T>();
            while (cursor.moveToNext()) {
                T entity = CursorUtils.getEntity(table, cursor);
                result.add(entity);
            }
        } catch (Throwable e) {
            throw new DbException(e);
        } finally {
            IOUtil.closeQuietly(cursor);
        }
    }
    return result;
}
Also used : Cursor(android.database.Cursor) DbException(org.xutils.ex.DbException)

Aggregations

DbException (org.xutils.ex.DbException)16 Cursor (android.database.Cursor)8 ColumnEntity (org.xutils.db.table.ColumnEntity)3 ArrayList (java.util.ArrayList)2 ProcessLock (org.xutils.common.util.ProcessLock)2 DbModel (org.xutils.db.table.DbModel)2 SQLiteDatabase (android.database.sqlite.SQLiteDatabase)1 SQLiteStatement (android.database.sqlite.SQLiteStatement)1 File (java.io.File)1 IOException (java.io.IOException)1 Date (java.util.Date)1 List (java.util.List)1 DbManager (org.xutils.DbManager)1 KeyValue (org.xutils.common.util.KeyValue)1 FileLockedException (org.xutils.ex.FileLockedException)1 Parent (org.xutils.sample.db.Parent)1 Event (org.xutils.view.annotation.Event)1