banshee r5145 - in trunk/banshee: . src/Core/Banshee.Services/Banshee.Database
- From: gburt svn gnome org
- To: svn-commits-list gnome org
- Subject: banshee r5145 - in trunk/banshee: . src/Core/Banshee.Services/Banshee.Database
- Date: Fri, 20 Mar 2009 04:27:26 +0000 (UTC)
Author: gburt
Date: Fri Mar 20 04:27:25 2009
New Revision: 5145
URL: http://svn.gnome.org/viewvc/banshee?rev=5145&view=rev
Log:
2009-03-19 Gabriel Burt <gabriel burt gmail com>
* src/Core/Banshee.Services/Banshee.Database/SortKeyUpdater.cs: When the
locale has changed, update the SearchKeys as well.
Modified:
trunk/banshee/ChangeLog
trunk/banshee/src/Core/Banshee.Services/Banshee.Database/SortKeyUpdater.cs
Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Database/SortKeyUpdater.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Database/SortKeyUpdater.cs (original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Database/SortKeyUpdater.cs Fri Mar 20 04:27:25 2009
@@ -26,6 +26,8 @@
using System;
using System.Globalization;
+
+using Banshee.Collection;
using Banshee.Configuration;
using Banshee.ServiceStack;
@@ -49,15 +51,29 @@
protected static void ForceUpdate (string new_locale)
{
- BansheeDbConnection db = ServiceManager.DbConnection;
- db.Execute ("BEGIN");
- db.Execute (@"UPDATE CoreArtists SET NameSortKey = HYENA_COLLATION_KEY(IFNULL(NameSort,Name))");
- db.Execute (@"UPDATE CoreAlbums SET TitleSortKey = HYENA_COLLATION_KEY(IFNULL(TitleSort,Title)),
- ArtistNameSortKey = HYENA_COLLATION_KEY(IFNULL(ArtistNameSort, ArtistName))");
- db.Execute (@"UPDATE CoreTracks SET TitleSortKey = HYENA_COLLATION_KEY(IFNULL(TitleSort,Title))");
-
+ ServiceManager.DbConnection.Execute (@"
+ BEGIN;
+ UPDATE CoreArtists SET
+ NameSortKey = HYENA_COLLATION_KEY(COALESCE(NameSort, Name, ?)),
+ NameLowered = HYENA_SEARCH_KEY(COALESCE(Name, ?));
+
+ UPDATE CoreAlbums SET
+ TitleSortKey = HYENA_COLLATION_KEY(COALESCE(TitleSort, Title, ?)),
+ ArtistNameSortKey = HYENA_COLLATION_KEY(COALESCE(ArtistName, ?)),
+ TitleLowered = HYENA_SEARCH_KEY(COALESCE(Title, ?)),
+ ArtistNameLowered = HYENA_SEARCH_KEY(COALESCE(ArtistName, ?));
+
+ UPDATE CoreTracks SET
+ TitleSortKey = HYENA_COLLATION_KEY(COALESCE(TitleSort, Title, ?)),
+ TitleLowered = HYENA_SEARCH_KEY(COALESCE(Title, ?));
+ COMMIT",
+ ArtistInfo.UnknownArtistName, ArtistInfo.UnknownArtistName,
+ AlbumInfo.UnknownAlbumTitle, ArtistInfo.UnknownArtistName,
+ AlbumInfo.UnknownAlbumTitle, ArtistInfo.UnknownArtistName,
+ TrackInfo.UnknownTitle, TrackInfo.UnknownTitle
+ );
+
DatabaseConfigurationClient.Client.Set<string> ("SortKeyLocale", new_locale);
- db.Execute ("COMMIT");
}
protected static string PreviousLocale {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]