use of com.j256.ormlite.android.AndroidCompiledStatement in project ormlite-android by j256.
the class AndroidDatabaseConnection method compileStatement.
@Override
public CompiledStatement compileStatement(String statement, StatementType type, FieldType[] argFieldTypes, int resultFlags, boolean cacheStore) {
// resultFlags argument is not used in Android-land since the {@link Cursor} is bi-directional.
CompiledStatement stmt = new AndroidCompiledStatement(statement, db, type, cancelQueriesEnabled, cacheStore);
logger.trace("{}: compiled statement got {}: {}", this, stmt, statement);
return stmt;
}
use of com.j256.ormlite.android.AndroidCompiledStatement in project ormlite-android by j256.
the class OrmLiteCursorLoader method loadInBackground.
@Override
public Cursor loadInBackground() {
Cursor cursor;
try {
DatabaseConnection connection = dao.getConnectionSource().getReadOnlyConnection(dao.getTableName());
AndroidCompiledStatement statement = (AndroidCompiledStatement) query.compile(connection, SELECT);
cursor = statement.getCursor();
} catch (SQLException e) {
throw new RuntimeException(e);
}
// fill the cursor with results
cursor.getCount();
return cursor;
}
use of com.j256.ormlite.android.AndroidCompiledStatement in project ormlite-android by j256.
the class OrmLiteCursorLoader method loadInBackground.
@Override
public Cursor loadInBackground() {
Cursor cursor;
try {
DatabaseConnection connection = dao.getConnectionSource().getReadOnlyConnection(dao.getTableName());
AndroidCompiledStatement statement = (AndroidCompiledStatement) query.compile(connection, SELECT);
cursor = statement.getCursor();
} catch (SQLException e) {
throw new RuntimeException(e);
}
// fill the cursor with results
cursor.getCount();
return cursor;
}
use of com.j256.ormlite.android.AndroidCompiledStatement 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;
}
use of com.j256.ormlite.android.AndroidCompiledStatement 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;
}
Aggregations