Commit 388cbd18 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen
Browse files

Artist: Use enum_to_string

parent 6b6632b4
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include "Album.h" #include "Album.h"
#include "AlbumTrack.h" #include "AlbumTrack.h"
#include "Media.h" #include "Media.h"
#include "utils/Enums.h"
#include "database/SqliteTools.h" #include "database/SqliteTools.h"
#include "database/SqliteQuery.h" #include "database/SqliteQuery.h"
...@@ -407,8 +408,7 @@ std::string Artist::trigger( Triggers trigger, uint32_t dbModelVersion ) ...@@ -407,8 +408,7 @@ std::string Artist::trigger( Triggers trigger, uint32_t dbModelVersion )
return "CREATE TRIGGER " + triggerName( trigger, dbModelVersion ) + return "CREATE TRIGGER " + triggerName( trigger, dbModelVersion ) +
" AFTER UPDATE OF is_present ON " + Media::Table::Name + " AFTER UPDATE OF is_present ON " + Media::Table::Name +
" WHEN new.subtype = " + " WHEN new.subtype = " +
std::to_string( static_cast<typename std::underlying_type<IMedia::SubType>::type>( utils::enum_to_string( IMedia::SubType::AlbumTrack ) +
IMedia::SubType::AlbumTrack ) ) +
" BEGIN " " BEGIN "
" UPDATE " + Table::Name + " SET is_present=is_present + " " UPDATE " + Table::Name + " SET is_present=is_present + "
"(CASE new.is_present WHEN 0 THEN -1 ELSE 1 END)" "(CASE new.is_present WHEN 0 THEN -1 ELSE 1 END)"
...@@ -420,8 +420,7 @@ std::string Artist::trigger( Triggers trigger, uint32_t dbModelVersion ) ...@@ -420,8 +420,7 @@ std::string Artist::trigger( Triggers trigger, uint32_t dbModelVersion )
return "CREATE TRIGGER " + triggerName( trigger, dbModelVersion ) + return "CREATE TRIGGER " + triggerName( trigger, dbModelVersion ) +
" AFTER UPDATE OF is_present ON " + Media::Table::Name + " AFTER UPDATE OF is_present ON " + Media::Table::Name +
" WHEN new.subtype = " + " WHEN new.subtype = " +
std::to_string( static_cast<typename std::underlying_type<IMedia::SubType>::type>( utils::enum_to_string( IMedia::SubType::AlbumTrack ) +
IMedia::SubType::AlbumTrack ) ) +
" AND old.is_present != new.is_present" " AND old.is_present != new.is_present"
" BEGIN " " BEGIN "
" UPDATE " + Table::Name + " SET is_present=is_present + " " UPDATE " + Table::Name + " SET is_present=is_present + "
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment