Repository: xbmc/xbmc
File: xbmc/video/VideoDatabase.h (C/C++)

Code before:
   \param artwork the artwork map for the show.
   \param seasonArt the artwork map for seasons.
   \param idTvShow the database id of the tvshow if known (defaults to -1)
   \return the id of the tvshow.
   */
  int SetDetailsForTvShow(const std::vector< std::pair<std::string, std::string> > &paths, CVideoInfoTag& details, const std::map<std::string, std::string> &artwork, const std::map<int, std::map<std::string, std::string> > &seasonArt, int idTvShow = -1);
  bool UpdateDetailsForTvShow(int idTvShow, CVideoInfoTag &details, const std::map<std::string, std::string> &artwork, const std::map<int, std::map<std::string, std::string> > &seasonArt);
  int SetDetailsForSeason(const CVideoInfoTag& details, const std::map<std::string, std::string> &artwork, int idShow, int idSeason = -1);
  int SetDetailsForEpisode(CVideoInfoTag& details,
                           const std::map<std::string, std::string>& artwork,
                           int idShow,
                           int idEpisode = -1);
  bool SetFileForEpisode(const std::string& fileAndPath, const int idEpisode, const int oldIdFile);
  bool SetFileForMovie(const std::string& fileAndPath, const int oldIdFile);
  int SetDetailsForMusicVideo(CVideoInfoTag& details,
                              const std::map<std::string, std::string>& artwork,
                              int idMVideo = -1);
  bool SetStreamDetailsForFile(const CStreamDetails& details,
                               const std::string& strFileNameAndPath);
  /*!
   * \brief Clear any existing stream details and add the new provided details to a file.
   * \param[in] details New stream details
   * \param[in] idFile Identifier of the file
   * \return operation success. true for success, false for failure
   */
  bool SetStreamDetailsForFileId(const CStreamDetails& details, int idFile) const;

  bool SetSingleValue(VideoDbContentType type, int dbId, int dbField, const std::string& strValue);
  bool SetSingleValue(VideoDbContentType type,
                      int dbId,
                      Field dbField,
                      const std::string& strValue);
  bool SetSingleValue(const std::string &table, const std::string &fieldName, const std::string &strValue,
                      const std::string &conditionName = "", int conditionValue = -1);

  int UpdateDetailsForMovie(int idMovie, CVideoInfoTag& details, const std::map<std::string, std::string> &artwork, const std::set<std::string> &updatedDetails);

  /*!
   * \brief Remove a movie from the library.
   * \param[in] idMovie The id of the movie
   * \param[in] action Versions of the movie to be deleted
   * \param[in] hashAction Preserve or invalidate the hash of the movie path
   * \return operation success. true for success, false for failure
   */
  bool DeleteMovie(int idMovie,
                   DeleteMovieCascadeAction action = DeleteMovieCascadeAction::ALL_ASSETS,
                   DeleteMovieHashAction hashAction = DeleteMovieHashAction::HASH_DELETE);
  void DeleteTvShow(int idTvShow, bool bKeepId = false);
  void DeleteTvShow(const std::string& strPath);
  void DeleteSeason(int idSeason, bool bKeepId = false);
  void DeleteEpisode(int idEpisode, bool bKeepId = false);

Review comment (suggestion):
A setter with a const modifier is a red flag. Setters clearly mutate state, so shouldn't be const. And as long as I noticed this, const should be dropped from the DB getters too. The getters call into mysql, and even though it's a DB read, it still mutates internal state of the sql object.

Code after:
   \param artwork the artwork map for the show.
   \param seasonArt the artwork map for seasons.
   \param idTvShow the database id of the tvshow if known (defaults to -1)
   \return the id of the tvshow.
   */
  int SetDetailsForTvShow(const std::vector< std::pair<std::string, std::string> > &paths, CVideoInfoTag& details, const std::map<std::string, std::string> &artwork, const std::map<int, std::map<std::string, std::string> > &seasonArt, int idTvShow = -1);
  bool UpdateDetailsForTvShow(int idTvShow, CVideoInfoTag &details, const std::map<std::string, std::string> &artwork, const std::map<int, std::map<std::string, std::string> > &seasonArt);
  int SetDetailsForSeason(const CVideoInfoTag& details, const std::map<std::string, std::string> &artwork, int idShow, int idSeason = -1);
  int SetDetailsForEpisode(CVideoInfoTag& details,
                           const std::map<std::string, std::string>& artwork,
                           int idShow,
                           int idEpisode = -1);
  bool SetFileForEpisode(const std::string& fileAndPath, int idEpisode, int oldIdFile);
  bool SetFileForMovie(const std::string& fileAndPath, int idMovie, int oldIdFile);
  int SetDetailsForMusicVideo(CVideoInfoTag& details,
                              const std::map<std::string, std::string>& artwork,
                              int idMVideo = -1);
  bool SetStreamDetailsForFile(const CStreamDetails& details,
                               const std::string& strFileNameAndPath);
  /*!
   * \brief Clear any existing stream details and add the new provided details to a file.
   * \param[in] details New stream details
   * \param[in] idFile Identifier of the file
   * \return operation success. true for success, false for failure
   */
  bool SetStreamDetailsForFileId(const CStreamDetails& details, int idFile);

  bool SetSingleValue(VideoDbContentType type, int dbId, int dbField, const std::string& strValue);
  bool SetSingleValue(VideoDbContentType type,
                      int dbId,
                      Field dbField,
                      const std::string& strValue);
  bool SetSingleValue(const std::string &table, const std::string &fieldName, const std::string &strValue,
                      const std::string &conditionName = "", int conditionValue = -1);

  int UpdateDetailsForMovie(int idMovie, CVideoInfoTag& details, const std::map<std::string, std::string> &artwork, const std::set<std::string> &updatedDetails);

  /*!
   * \brief Remove a movie from the library.
   * \param[in] idMovie The id of the movie
   * \param[in] action Versions of the movie to be deleted
   * \param[in] hashAction Preserve or invalidate the hash of the movie path
   * \return operation success. true for success, false for failure
   */
  bool DeleteMovie(int idMovie,
                   DeleteMovieCascadeAction action = DeleteMovieCascadeAction::ALL_ASSETS,
                   DeleteMovieHashAction hashAction = DeleteMovieHashAction::HASH_DELETE);
  void DeleteTvShow(int idTvShow, bool bKeepId = false);
  void DeleteTvShow(const std::string& strPath);
  void DeleteSeason(int idSeason, bool bKeepId = false);
  void DeleteEpisode(int idEpisode, bool bKeepId = false);