use of org.greenrobot.greendao.database.StandardDatabase in project greenDAO by greenrobot.
the class SimpleEntityContentProvider method query.
@Override
public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
SQLiteQueryBuilder queryBuilder = new SQLiteQueryBuilder();
int uriType = sURIMatcher.match(uri);
switch(uriType) {
case SIMPLEENTITY_DIR:
queryBuilder.setTables(TABLENAME);
break;
case SIMPLEENTITY_ID:
queryBuilder.setTables(TABLENAME);
queryBuilder.appendWhere(PK + "=" + uri.getLastPathSegment());
break;
default:
throw new IllegalArgumentException("Unknown URI: " + uri);
}
Database db = getDatabase();
Cursor cursor = queryBuilder.query(((StandardDatabase) db).getSQLiteDatabase(), projection, selection, selectionArgs, null, null, sortOrder);
cursor.setNotificationUri(getContext().getContentResolver(), uri);
return cursor;
}
use of org.greenrobot.greendao.database.StandardDatabase in project greenDAO by greenrobot.
the class DbTest method createDatabase.
/** May be overriden by sub classes to set up a different db. */
protected Database createDatabase() {
SQLiteDatabase sqLiteDatabase;
if (inMemory) {
sqLiteDatabase = SQLiteDatabase.create(null);
} else {
getContext().deleteDatabase(DB_NAME);
sqLiteDatabase = getContext().openOrCreateDatabase(DB_NAME, 0, null);
}
return new StandardDatabase(sqLiteDatabase);
}
use of org.greenrobot.greendao.database.StandardDatabase in project greenDAO by greenrobot.
the class DaoSessionConcurrentWALTest method createDatabase.
@Override
protected Database createDatabase() {
int MODE_ENABLE_WRITE_AHEAD_LOGGING = 8;
getContext().deleteDatabase(DB_NAME);
SQLiteDatabase sqLiteDatabase = getContext().openOrCreateDatabase(DB_NAME, MODE_ENABLE_WRITE_AHEAD_LOGGING, null);
return new StandardDatabase(sqLiteDatabase);
}
Aggregations