Example usage for android.database.sqlite SQLiteQueryBuilder setStrict

List of usage examples for android.database.sqlite SQLiteQueryBuilder setStrict

Introduction

In this page you can find the example usage for android.database.sqlite SQLiteQueryBuilder setStrict.

Prototype

public void setStrict(boolean flag) 

Source Link

Document

When set, the selection is verified against malicious arguments.

Usage

From source file:com.hyunnyapp.easycursor.sqlcursor.querymodels.SelectQueryModel.java

@Override
protected Cursor executeQueryInternal(final SQLiteDatabase db) {
    final SQLiteQueryBuilder builder = new SQLiteQueryBuilder();
    builder.setTables(getTables());/*from   w  ww  .j av a  2 s  . co m*/
    builder.setDistinct(isDistinct());

    if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
        builder.setStrict(isStrict());
    }

    return builder.query(db, getProjectionIn(), getSelection(), getSelectionArgs(), getGroupBy(), getHaving(),
            getSortOrder(), getLimit());
}

From source file:com.appsimobile.appsii.module.home.provider.HomeContentProvider.java

@Override
public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {

    selection = fixWhereProjection(uri, selection);
    SqlArguments args = new SqlArguments(uri, selection, selectionArgs);

    SQLiteQueryBuilder qb = new SQLiteQueryBuilder();

    String tables = createTablesFromTableQuery(args.table);

    qb.setTables(tables);// ww  w .  j  ava 2  s .  c o  m

    Map<String, String> projectionMap = getProjectionMapForTable(args.table);

    if (projectionMap != null) {
        qb.setProjectionMap(projectionMap);
        qb.setStrict(true);
    }

    SQLiteDatabase db = mOpenHelper.getWritableDatabase();

    if (HomeContract.CELLS_TABLE_NAME.equals(args.table)) {
        sortOrder = fixSortOrder(sortOrder);
    }
    String where = args.where;
    if (HomeContract.HOTSPOT_PAGES_DETAILS_TABLE_NAME.equals(args.table)) {
        where = "_ht." + BaseColumns._ID + "=" + ContentUris.parseId(uri);
    }

    Cursor result = qb.query(db, projection, where, args.args, null, null, sortOrder);

    result.setNotificationUri(getContext().getContentResolver(), uri);

    return result;
}