Query<IArtist> Artist::listAll( MediaLibraryPtr ml, bool includeAll, const QueryParameters* params ) { std::string req = "FROM " + Artist::Table::Name + " WHERE "; if ( includeAll == true ) req += "( nb_albums > 0 OR nb_tracks > 0 )"; else req += "nb_albums > 0"; req += " AND is_present != 0"; return make_query<Artist, IArtist>( ml, "*", std::move( req ), sortRequest( params ) ); }
Query<IArtist> Artist::search( MediaLibraryPtr ml, const std::string& name, bool includeAll, const QueryParameters* params ) { std::string req = "FROM " + Artist::Table::Name + " WHERE id_artist IN " "(SELECT rowid FROM " + Artist::Table::Name + "Fts WHERE name MATCH '*' || ? || '*')" "AND is_present != 0"; // We are searching based on the name, so we're ignoring unknown/various artist // This means all artist we find has at least one track associated with it, so // we can simply filter out based on the number of associated albums if ( includeAll == false ) req += " AND nb_albums > 0"; return make_query<Artist, IArtist>( ml, "*", std::move( req ), sortRequest( params ), name ); }
void ZoneTableModel::sort(int column, Qt::SortOrder order) { emit sortRequest(column, order == Qt::AscendingOrder); }