public static void updateCanUpgradePlugins(Context context, int value, String selection) {
   DatabaseHelper helper = PluginsDatabaseHelper.getDatabaseHelperInstance(context);
   SQLiteDatabase db = helper.getWritableDatabase();
   Cursor cursor =
       db.rawQuery(
           "SELECT * FROM "
               + PluginsDatabaseHelper.PLUGIN_TABLE
               + " AS T1 INNER JOIN "
               + PluginsDatabaseHelper.PLUGIN_TABLE_EXTRA
               + " AS T2 ON T1.id = T2.id "
               + "WHERE T1.filename = ?",
           new String[] {selection});
   if (cursor != null && cursor.getCount() > 0 && cursor.moveToFirst()) {
     if (cursor.getInt(cursor.getColumnIndex("update_flag")) == 1) {
       int id = cursor.getInt(cursor.getColumnIndex("id"));
       ContentValues values = new ContentValues();
       values.put("update_flag", value);
       db.update(
           PluginsDatabaseHelper.PLUGIN_TABLE_EXTRA,
           values,
           "id = ?",
           new String[] {String.valueOf(id)});
     }
   }
   cursor.close();
   db.close();
   helper.close();
 }
 public static boolean hasCanUpgradePlugins(Context context) {
   boolean result = false;
   DatabaseHelper helper = PluginsDatabaseHelper.getDatabaseHelperInstance(context);
   SQLiteDatabase db = helper.getWritableDatabase();
   Cursor cursor =
       db.rawQuery(
           "SELECT * FROM "
               + PluginsDatabaseHelper.PLUGIN_TABLE
               + " AS T1 INNER JOIN "
               + PluginsDatabaseHelper.PLUGIN_TABLE_EXTRA
               + " AS T2 ON T1.id = T2.id "
               + "WHERE T2.update_flag = ?",
           new String[] {String.valueOf(1)});
   result = cursor != null && cursor.getCount() > 0 && cursor.moveToFirst();
   cursor.close();
   db.close();
   helper.close();
   return result;
 }