Search in sources :

Example 6 with DatabaseConnection

use of com.j256.ormlite.support.DatabaseConnection in project ormlite-android-extras by campnic.

the class AndroidBaseDaoImpl method getCursor.

public Cursor getCursor(PreparedQuery<T> query) throws SQLException {
    DatabaseConnection readOnlyConn = connectionSource.getReadOnlyConnection();
    AndroidCompiledStatement stmt = (AndroidCompiledStatement) query.compile(readOnlyConn, StatementBuilder.StatementType.SELECT);
    Cursor base = stmt.getCursor();
    String idColumnName = getTableInfo().getIdField().getColumnName();
    int idColumnIndex = base.getColumnIndex(idColumnName);
    NoIdCursorWrapper wrapper = new NoIdCursorWrapper(base, idColumnIndex);
    return wrapper;
}
Also used : DatabaseConnection(com.j256.ormlite.support.DatabaseConnection) AndroidCompiledStatement(com.j256.ormlite.android.AndroidCompiledStatement) Cursor(android.database.Cursor)

Example 7 with DatabaseConnection

use of com.j256.ormlite.support.DatabaseConnection in project ormlite-android-extras by campnic.

the class AndroidBaseDaoImpl method getCursor.

public Cursor getCursor(PreparedQuery<T> query) throws SQLException {
    DatabaseConnection readOnlyConn = connectionSource.getReadOnlyConnection();
    AndroidCompiledStatement stmt = (AndroidCompiledStatement) query.compile(readOnlyConn, StatementBuilder.StatementType.SELECT);
    Cursor base = stmt.getCursor();
    String idColumnName = getTableInfo().getIdField().getColumnName();
    int idColumnIndex = base.getColumnIndex(idColumnName);
    NoIdCursorWrapper wrapper = new NoIdCursorWrapper(base, idColumnIndex);
    return wrapper;
}
Also used : DatabaseConnection(com.j256.ormlite.support.DatabaseConnection) AndroidCompiledStatement(com.j256.ormlite.android.AndroidCompiledStatement) Cursor(android.database.Cursor)

Aggregations

DatabaseConnection (com.j256.ormlite.support.DatabaseConnection)7 Cursor (android.database.Cursor)4 AndroidCompiledStatement (com.j256.ormlite.android.AndroidCompiledStatement)4 SQLException (java.sql.SQLException)4 AndroidConnectionSource (com.j256.ormlite.android.AndroidConnectionSource)2 AndroidDatabaseConnection (com.j256.ormlite.android.AndroidDatabaseConnection)2 ConnectionSource (com.j256.ormlite.support.ConnectionSource)2 SQLiteDatabase (android.database.sqlite.SQLiteDatabase)1