[amarok] src/core-impl/collections/db/sql: Fix issue with very long artists

Matěj Laitl matej at laitl.cz
Mon Mar 18 10:13:06 UTC 2013


On 18. 3. 2013 Ralf Engels wrote:
> Git commit b310ae91879339a0d020ff70bf590d1c197a7c9b by Ralf Engels.
> 
> Fix issue with very long artists
> 
> Should improve on the problem with very long tags. At least I don't
> have any sql errors any longer.
> 
> I just can't find the bug entry for this issue right now.

It is https://bugs.kde.org/show_bug.cgi?id=276894 - please add another commit 
with ChangeLog entry and BUG:, FIXED-IN: tags. See below for other remarks.

> --- a/src/core-impl/collections/db/sql/SqlRegistry.cpp
> +++ b/src/core-impl/collections/db/sql/SqlRegistry.cpp
> @@ -360,10 +360,11 @@ SqlRegistry::removeTrack( int urlId, const QString uid
> ) // -------- artist
> 
>  Meta::ArtistPtr
> -SqlRegistry::getArtist( const QString &name )
> +SqlRegistry::getArtist( const QString &oName )
>  {
>      QMutexLocker locker( &m_artistMutex );
> 
> +    QString name = oName.left( 255 ); // truncate to column lenght

This (and all other uses of this magic constant) warrant a new static constant 
to be added to DatabaseUpdater, to prevent forgetting to change these when we 
change length of the columns in future. (I think one constant for all related 
columns suffices)

P.S.: it is "length", not "lenght". :-)

	Matěj


More information about the Amarok-devel mailing list