[banshee] Services: reuse UriField object
- From: AndrÃs Aragoneses <aaragoneses src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [banshee] Services: reuse UriField object
- Date: Thu, 22 Dec 2011 01:33:32 +0000 (UTC)
commit 62bb1a7c530b8231bd73598ba530880603618090
Author: Andres G. Aragoneses <knocte gmail com>
Date: Thu Dec 22 01:22:54 2011 +0000
Services: reuse UriField object
More reuse of QueryField instances so the
column names are hardcoded in less places.
Signed-off-by: Alexander Kojevnikov <alexk gnome org>
.../Banshee.Collection/RescanPipeline.cs | 6 ++++--
.../Banshee.Metadata/SaveTrackMetadataJob.cs | 3 ++-
.../Banshee.Sources/PrimarySource.cs | 4 +++-
3 files changed, 9 insertions(+), 4 deletions(-)
---
diff --git a/src/Core/Banshee.Services/Banshee.Collection/RescanPipeline.cs b/src/Core/Banshee.Services/Banshee.Collection/RescanPipeline.cs
index 453cce1..174da9f 100644
--- a/src/Core/Banshee.Services/Banshee.Collection/RescanPipeline.cs
+++ b/src/Core/Banshee.Services/Banshee.Collection/RescanPipeline.cs
@@ -101,8 +101,10 @@ namespace Banshee.Collection
//Hyena.Log.DebugFormat ("Have {0} items before delete", ServiceManager.DbConnection.Query<int>("select count(*) from coretracks where primarysourceid=?", psource.DbId));
// Delete tracks that are under the BaseDirectory and that weren't rescanned just now
- string condition =
- @"WHERE PrimarySourceID = ? AND Uri LIKE ? ESCAPE '\' AND LastSyncedStamp IS NOT NULL AND LastSyncedStamp < ?";
+ string condition = String.Format (
+ @"WHERE PrimarySourceID = ? AND {0} LIKE ? ESCAPE '\' AND {1} IS NOT NULL AND {1} < ?",
+ Banshee.Query.BansheeQuery.UriField, "CoreTracks.LastSyncedStamp"
+ );
string uri = Hyena.StringUtil.EscapeLike (new SafeUri (psource.BaseDirectoryWithSeparator).AbsoluteUri) + "%";
ServiceManager.DbConnection.Execute (String.Format (@"BEGIN;
diff --git a/src/Core/Banshee.Services/Banshee.Metadata/SaveTrackMetadataJob.cs b/src/Core/Banshee.Services/Banshee.Metadata/SaveTrackMetadataJob.cs
index 029b800..b49673d 100644
--- a/src/Core/Banshee.Services/Banshee.Metadata/SaveTrackMetadataJob.cs
+++ b/src/Core/Banshee.Services/Banshee.Metadata/SaveTrackMetadataJob.cs
@@ -63,7 +63,8 @@ namespace Banshee.Metadata
@"(DateUpdatedStamp > LastSyncedStamp OR
(DateUpdatedStamp IS NOT NULL AND LastSyncedStamp IS NULL))
AND PrimarySourceID IN ({0})
- AND Uri LIKE '{1}%'", range, "file:");
+ AND {1} LIKE '{2}%'",
+ range, Banshee.Query.BansheeQuery.UriField.Column, "file:");
CountCommand = new HyenaSqliteCommand (
"SELECT COUNT(*) FROM CoreTracks WHERE " + condition);
diff --git a/src/Core/Banshee.Services/Banshee.Sources/PrimarySource.cs b/src/Core/Banshee.Services/Banshee.Sources/PrimarySource.cs
index 1a27ac5..eb127a7 100644
--- a/src/Core/Banshee.Services/Banshee.Sources/PrimarySource.cs
+++ b/src/Core/Banshee.Services/Banshee.Sources/PrimarySource.cs
@@ -92,7 +92,9 @@ namespace Banshee.Sources
protected bool error_source_visible = false;
protected string remove_range_sql = @"
- INSERT INTO CoreRemovedTracks (DateRemovedStamp, TrackID, Uri) SELECT ?, TrackID, Uri FROM CoreTracks WHERE TrackID IN (SELECT {0});
+ INSERT INTO CoreRemovedTracks (DateRemovedStamp, TrackID, Uri)
+ SELECT ?, TrackID, " + BansheeQuery.UriField.Column + @"
+ FROM CoreTracks WHERE TrackID IN (SELECT {0});
DELETE FROM CoreTracks WHERE TrackID IN (SELECT {0})";
protected HyenaSqliteCommand remove_list_command = new HyenaSqliteCommand (@"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]