banshee r3986 - in trunk/banshee: . src/Core/Banshee.Services/Banshee.Collection.Database src/Libraries/Hyena/Hyena.Data.Sqlite
- From: gburt svn gnome org
- To: svn-commits-list gnome org
- Subject: banshee r3986 - in trunk/banshee: . src/Core/Banshee.Services/Banshee.Collection.Database src/Libraries/Hyena/Hyena.Data.Sqlite
- Date: Tue, 27 May 2008 22:06:00 +0000 (UTC)
Author: gburt
Date: Tue May 27 22:05:59 2008
New Revision: 3986
URL: http://svn.gnome.org/viewvc/banshee?rev=3986&view=rev
Log:
2008-05-27 Gabriel Burt <gabriel burt gmail com>
* src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseTrackListModel.cs:
* src/Core/Banshee.Services/Banshee.Collection.Database/IDatabaseTrackModelCache.cs:
* src/Libraries/Hyena/Hyena.Data.Sqlite/SqliteModelCache.cs: Fix two bugs,
one I introduced in my last big podcast commit that made the play queue
keep repeating the same song, and another more subtle one, in our
implementation of IndexOf for findind the index of an item in playlists.
Fixes BGO #534863.
Modified:
trunk/banshee/ChangeLog
trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseTrackListModel.cs
trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Database/IDatabaseTrackModelCache.cs
trunk/banshee/src/Libraries/Hyena/Hyena.Data.Sqlite/SqliteModelCache.cs
Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseTrackListModel.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseTrackListModel.cs (original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseTrackListModel.cs Tue May 27 22:05:59 2008
@@ -296,7 +296,11 @@
public override int IndexOf (TrackInfo track)
{
DatabaseTrackInfo db_track = track as DatabaseTrackInfo;
- return (int) (db_track == null ? -1 : cache.IndexOf ((int)db_track.CacheEntryId));
+ if (db_track == null || db_track.CacheModelId != CacheId) {
+ return -1;
+ }
+
+ return (int) cache.IndexOf ((int)db_track.CacheEntryId);
}
private DateTime random_began_at = DateTime.MinValue;
Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Database/IDatabaseTrackModelCache.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Database/IDatabaseTrackModelCache.cs (original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Database/IDatabaseTrackModelCache.cs Tue May 27 22:05:59 2008
@@ -42,7 +42,7 @@
void RestoreSelection ();
long Count { get; }
void Reload ();
- long IndexOf (long item_id);
+ long IndexOf (long item_entry_id);
TrackInfo GetSingle (string random_fragment, params object [] args);
TrackInfo GetValue (long index);
long CacheId { get; }
Modified: trunk/banshee/src/Libraries/Hyena/Hyena.Data.Sqlite/SqliteModelCache.cs
==============================================================================
--- trunk/banshee/src/Libraries/Hyena/Hyena.Data.Sqlite/SqliteModelCache.cs (original)
+++ trunk/banshee/src/Libraries/Hyena/Hyena.Data.Sqlite/SqliteModelCache.cs Tue May 27 22:05:59 2008
@@ -1,10 +1,11 @@
//
// SqliteModelCache.cs
//
-// Author:
+// Authors:
+// Gabriel Burt <gburt novell com>
// Scott Peterson <lunchtimemama gmail com>
//
-// Copyright (C) 2007 Novell, Inc.
+// Copyright (C) 2007-2008 Novell, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
@@ -32,8 +33,6 @@
namespace Hyena.Data.Sqlite
{
- //public delegate void AggregatesUpdatedEventHandler (IDataReader reader);
-
public class SqliteModelCache<T> : DictionaryModelCache<T> where T : ICacheableItem, new ()
{
private HyenaSqliteConnection connection;
@@ -117,16 +116,6 @@
provider.Where
);
- select_single_command = new HyenaSqliteCommand (
- String.Format (@"
- SELECT OrderID FROM {0}
- WHERE
- ModelID = {1} AND
- ItemID IN (SELECT {2} FROM {3} WHERE {4} = ?) LIMIT 1",
- CacheTableName, uid, model.JoinPrimaryKey, model.JoinTable, model.JoinColumn
- )
- );
-
reload_sql = String.Format (@"
DELETE FROM {0} WHERE ModelID = {1};
INSERT INTO {0} (ModelID, ItemID) SELECT {1}, {2} ",
@@ -145,16 +134,6 @@
provider.Where
);
- select_single_command = new HyenaSqliteCommand (
- String.Format (@"
- SELECT OrderID FROM {0}
- WHERE
- ModelID = {1} AND
- ItemID = ?",
- CacheTableName, uid
- )
- );
-
reload_sql = String.Format (@"
DELETE FROM {0} WHERE ModelID = {1};
INSERT INTO {0} (ModelID, ItemID) SELECT {1}, {2} ",
@@ -162,6 +141,16 @@
);
}
+ select_single_command = new HyenaSqliteCommand (
+ String.Format (@"
+ SELECT OrderID FROM {0}
+ WHERE
+ ModelID = {1} AND
+ ItemID = ?",
+ CacheTableName, uid
+ )
+ );
+
select_range_command = new HyenaSqliteCommand (
String.Format ("{0} {1}", select_str, "LIMIT ?, ?")
);
@@ -228,11 +217,13 @@
}
}
+ // FIXME this should really take a type T, not a confusing, ambiguous long
public long IndexOf (long item_id)
{
lock (this) {
- if (rows == 0)
+ if (rows == 0) {
return -1;
+ }
long target_id = connection.Query<long> (select_single_command, item_id);
if (target_id == 0) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]