/** {@inheritDoc} */
 @Override
 public int delete(Uri uri, String selection, String[] selectionArgs) {
   if (LOGV) Log.v(TAG, "delete(uri=" + uri + ")");
   final SQLiteDatabase db = mOpenHelper.getWritableDatabase();
   final SelectionBuilder builder = buildSimpleSelection(uri);
   int retVal = builder.where(selection, selectionArgs).delete(db);
   getContext().getContentResolver().notifyChange(uri, null);
   return retVal;
 }
  /** {@inheritDoc} */
  @Override
  public Cursor query(
      Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
    if (LOGV) Log.v(TAG, "query(uri=" + uri + ", proj=" + Arrays.toString(projection) + ")");
    final SQLiteDatabase db = mOpenHelper.getReadableDatabase();

    final ContentResolver contentResolver = getContext().getContentResolver();
    final int match = sUriMatcher.match(uri);
    switch (match) {
      default:
        {
          // Most cases are handled with simple SelectionBuilder
          final SelectionBuilder builder = buildExpandedSelection(uri, match);
          final Cursor c = builder.where(selection, selectionArgs).query(db, projection, sortOrder);
          c.setNotificationUri(contentResolver, uri);
          return c;
        }
      case SEARCH_SUGGEST:
        {
          final SelectionBuilder builder = new SelectionBuilder();

          // Adjust incoming query to become SQL text match
          selectionArgs[0] = selectionArgs[0] + "%";
          builder.table(Tables.SEARCH_SUGGEST);
          builder.where(selection, selectionArgs);
          builder.map(SearchManager.SUGGEST_COLUMN_QUERY, SearchManager.SUGGEST_COLUMN_TEXT_1);

          projection =
              new String[] {
                BaseColumns._ID,
                SearchManager.SUGGEST_COLUMN_TEXT_1,
                SearchManager.SUGGEST_COLUMN_QUERY
              };

          final String limit = uri.getQueryParameter(SearchManager.SUGGEST_PARAMETER_LIMIT);
          final Cursor c =
              builder.query(db, projection, null, null, SearchSuggest.DEFAULT_SORT, limit);
          c.setNotificationUri(contentResolver, uri);
          return c;
        }
    }
  }