code: @Override
      public boolean setVersion(String version) {
          // Update the version column in the database. This is a little weird looking because we want
          // to avoid modifying the database if the version didn't change, and because the row might
          // not exist yet.
          SQLiteStorageEngine storage = store.getStorageEngine();
          boolean hasView;
          Cursor cursor = null;
          try {
              String sql = "SELECT name, version FROM views WHERE name=?";
              String[] args = {name};
              cursor = storage.rawQuery(sql, args);
              hasView = cursor.moveToNext();
          } catch (SQLException e) {
              Log.e(Log.TAG_VIEW, "Error querying existing view name " + name, e);
              return false;
          } finally {
              if (cursor != null)
                  cursor.close();
          }
  
          if (!hasView) {
              // no such record, so insert
              ContentValues insertValues = new ContentValues();
              insertValues.put("name", name);
              insertValues.put("version", version);
              insertValues.put("total_docs", 0);
              storage.insert("views", null, insertValues);
              createIndex();
              return true; // created new view
          }
  
          ContentValues updateValues = new ContentValues();
          updateValues.put("version", version);
          updateValues.put("lastSequence", 0);
          updateValues.put("total_docs", 0);
          String[] whereArgs = {name, version};
          int rowsAffected = storage.update("views",
                  updateValues,
                  "name=? AND version!=?",
                  whereArgs);
          return (rowsAffected > 0);
      }
docs: Updates the version of the view. A change in version means the delegate's map block has
  changed its semantics, so the _index should be deleted.