Projects >> MyExpenses >>6b670ce8f97e04a4265079e0af02601aaf99936f

Chunk
Conflicting content
    if (oldVersion < 48) {
      db.execSQL("ALTER TABLE templates add column uuid text");
      db.execSQL(EVENT_CACHE_CREATE);
<<<<<<< HEAD
=======
    }
    if (oldVersion < 48) {
>>>>>>> faf6b5a5873e3de3eecf9086d3b3b28be510ae63
      //added method_label to extended view
      //do not comment out, since it is needed by the uuid update
      db.execSQL("DROP VIEW IF EXISTS transactions_extended");
Solution content
      db.execSQL("ALTER TABLE templates add column uuid text");
      db.execSQL(EVENT_CACHE_CREATE);
    }
    if (oldVersion < 48) {
      //added method_label to extended view
      //do not comment out, since it is needed by the uuid update
      db.execSQL("DROP VIEW IF EXISTS transactions_extended");
File
TransactionDatabase.java
Developer's decision
Version 2
Kind of conflict
If statement
Chunk
Conflicting content
      db.execSQL("DROP VIEW IF EXISTS templates_all");
      db.execSQL("CREATE VIEW transactions_extended" + VIEW_DEFINITION_EXTENDED(TABLE_TRANSACTIONS) + " WHERE " + KEY_STATUS + " != " + STATUS_UNCOMMITTED + ";");
      db.execSQL("CREATE VIEW templates_extended" +  VIEW_DEFINITION_EXTENDED(TABLE_TEMPLATES));
<<<<<<< HEAD
      db.execSQL("DROP VIEW IF EXISTS transactions_committed");
=======
>>>>>>> faf6b5a5873e3de3eecf9086d3b3b28be510ae63
      String viewTransactions = VIEW_DEFINITION(TABLE_TRANSACTIONS);
      db.execSQL("CREATE VIEW transactions_committed "  + viewTransactions + " WHERE " + KEY_STATUS + " != " + STATUS_UNCOMMITTED + ";");
      db.execSQL("CREATE VIEW transactions_uncommitted" + viewTransactions + " WHERE " + KEY_STATUS +  " = " + STATUS_UNCOMMITTED + ";");
Solution content
      db.execSQL("DROP VIEW IF EXISTS templates_all");
      db.execSQL("CREATE VIEW transactions_extended" + VIEW_DEFINITION_EXTENDED(TABLE_TRANSACTIONS) + " WHERE " + KEY_STATUS + " != " + STATUS_UNCOMMITTED + ";");
      db.execSQL("CREATE VIEW templates_extended" +  VIEW_DEFINITION_EXTENDED(TABLE_TEMPLATES));
      String viewTransactions = VIEW_DEFINITION(TABLE_TRANSACTIONS);
      db.execSQL("CREATE VIEW transactions_committed "  + viewTransactions + " WHERE " + KEY_STATUS + " != " + STATUS_UNCOMMITTED + ";");
      db.execSQL("CREATE VIEW transactions_uncommitted" + viewTransactions + " WHERE " + KEY_STATUS +  " = " + STATUS_UNCOMMITTED + ";");
File
TransactionDatabase.java
Developer's decision
Version 2
Kind of conflict
Method invocation
Chunk
Conflicting content
            "CASE WHEN " +
                "  " + "transfer_peer" + " " +
            " THEN " +
<<<<<<< HEAD
              " (SELECT " + "label" + " FROM " + "categories" + " WHERE " + "_id" + " = " +
                " (SELECT " + "parent_id" + " FROM " + "categories" + " WHERE " + "_id" + " = " + "cat_id" + ")) " +
              "  || '" + TransactionList.CATEGORY_SEPARATOR + "' || " +
              " (SELECT " + "label" + " FROM " + "categories" + " WHERE " + "_id" + " = " + "cat_id" + ") " +
            " ELSE" +
              " (SELECT " + "label" + " FROM " + "categories" + " WHERE " + "_id" + " = " + "cat_id" + ") " +
            " END " +
          " END AS  " + "label",
          "name",
          "transfer_peer",
          "transfer_account",
          "account_id",
          "method_id",
          "method_label",
          "title",
          "plan_id",
          "plan_execution",
          "uuid",
          "currency"
        };
      Cursor c = db.query(
          "templates_extended",
          projection,
          null, null, null,null,null);
      if (c!=null) {
        if (c.moveToFirst()) {
          ContentValues templateValues = new ContentValues(),
              eventValues = new ContentValues();
          String planCalendarId = MyApplication.getInstance().checkPlanner();
          while( c.getPosition() < c.getCount() ) {
            Template t = new Template(c);
            templateValues.put(DatabaseConstants.KEY_UUID, t.getUuid());
            long templateId = c.getLong(c.getColumnIndex("_id"));
            long planId = c.getLong(c.getColumnIndex("plan_id"));
            eventValues.put(Events.DESCRIPTION,t.compileDescription(mCtx));
            db.update("templates", templateValues, "_id = "+templateId,null);
            mCtx.getContentResolver().update(Events.CONTENT_URI,
                eventValues,Events._ID + "= ? AND " + Events.CALENDAR_ID + " = ?",
                new String[]{String.valueOf(planId),planCalendarId});
            c.moveToNext();
=======
              "  (SELECT " + "label" + " FROM " + "accounts" + " WHERE " + "_id" + " = " + "transfer_account" + ") " +
            " ELSE " +
              " CASE WHEN " +
                  " (SELECT " + "parent_id" + " FROM " + "categories" + " WHERE " + "_id" + " = " + "cat_id" + ") " +
              " THEN " +
                " (SELECT " + "label" + " FROM " + "categories" + " WHERE " + "_id" + " = " +
                  " (SELECT " + "parent_id" + " FROM " + "categories" + " WHERE " + "_id" + " = " + "cat_id" + ")) " +
                "  || '" + TransactionList.CATEGORY_SEPARATOR + "' || " +
                " (SELECT " + "label" + " FROM " + "categories" + " WHERE " + "_id" + " = " + "cat_id" + ") " +
              " ELSE" +
                " (SELECT " + "label" + " FROM " + "categories" + " WHERE " + "_id" + " = " + "cat_id" + ") " +
              " END " +
            " END AS  " + "label",
            "name",
            "transfer_peer",
            "transfer_account",
            "account_id",
            "method_id",
            "method_label",
            "title",
            "plan_id",
            "plan_execution",
            "uuid",
            "currency"
          };
        Cursor c = db.query(
            "templates_extended",
            projection,
            null, null, null,null,null);
        if (c!=null) {
          if (c.moveToFirst()) {
            ContentValues templateValues = new ContentValues(),
                eventValues = new ContentValues();
            String planCalendarId = MyApplication.getInstance().checkPlanner();
            while( c.getPosition() < c.getCount() ) {
              Template t = new Template(c);
              templateValues.put(DatabaseConstants.KEY_UUID, t.getUuid());
              long templateId = c.getLong(c.getColumnIndex("_id"));
              long planId = c.getLong(c.getColumnIndex("plan_id"));
              eventValues.put(Events.DESCRIPTION,t.compileDescription(mCtx));
              db.update("templates", templateValues, "_id = "+templateId,null);
              mCtx.getContentResolver().update(Events.CONTENT_URI,
                  eventValues,Events._ID + "= ? AND " + Events.CALENDAR_ID + " = ?",
                  new String[]{String.valueOf(planId),planCalendarId});
              c.moveToNext();
            }
>>>>>>> faf6b5a5873e3de3eecf9086d3b3b28be510ae63
          }
          c.close();
        }
Solution content
            "CASE WHEN " +
                "  " + "transfer_peer" + " " +
            " THEN " +
              "  (SELECT " + "label" + " FROM " + "accounts" + " WHERE " + "_id" + " = " + "transfer_account" + ") " +
            " ELSE " +
              " CASE WHEN " +
                  " (SELECT " + "parent_id" + " FROM " + "categories" + " WHERE " + "_id" + " = " + "cat_id" + ") " +
              " THEN " +
                " (SELECT " + "label" + " FROM " + "categories" + " WHERE " + "_id" + " = " +
                  " (SELECT " + "parent_id" + " FROM " + "categories" + " WHERE " + "_id" + " = " + "cat_id" + ")) " +
                "  || '" + TransactionList.CATEGORY_SEPARATOR + "' || " +
                " (SELECT " + "label" + " FROM " + "categories" + " WHERE " + "_id" + " = " + "cat_id" + ") " +
              " ELSE" +
                " (SELECT " + "label" + " FROM " + "categories" + " WHERE " + "_id" + " = " + "cat_id" + ") " +
              " END " +
            " END AS  " + "label",
            "name",
            "transfer_peer",
            "transfer_account",
            "account_id",
            "method_id",
            "method_label",
            "title",
            "plan_id",
            "plan_execution",
            "uuid",
            "currency"
          };
        Cursor c = db.query(
            "templates_extended",
            projection,
            null, null, null,null,null);
        if (c!=null) {
          if (c.moveToFirst()) {
            ContentValues templateValues = new ContentValues(),
                eventValues = new ContentValues();
            String planCalendarId = MyApplication.getInstance().checkPlanner();
            while( c.getPosition() < c.getCount() ) {
              Template t = new Template(c);
              templateValues.put(DatabaseConstants.KEY_UUID, t.getUuid());
              long templateId = c.getLong(c.getColumnIndex("_id"));
              long planId = c.getLong(c.getColumnIndex("plan_id"));
              eventValues.put(Events.DESCRIPTION,t.compileDescription(mCtx));
              db.update("templates", templateValues, "_id = "+templateId,null);
              mCtx.getContentResolver().update(Events.CONTENT_URI,
                  eventValues,Events._ID + "= ? AND " + Events.CALENDAR_ID + " = ?",
                  new String[]{String.valueOf(planId),planCalendarId});
              c.moveToNext();
            }
          }
          c.close();
        }
File
TransactionDatabase.java
Developer's decision
Version 2
Kind of conflict
If statement
Method invocation
Variable
While statement