[banshee] Services: reuse SQL instruction (refactoring)
- From: AndrÃs Aragoneses <aaragoneses src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [banshee] Services: reuse SQL instruction (refactoring)
- Date: Wed, 21 Dec 2011 00:58:16 +0000 (UTC)
commit 2bb8984939929dbf7642a3c20a9eb328c845881c
Author: Andres G. Aragoneses <knocte gmail com>
Date: Wed Dec 21 00:57:36 2011 +0000
Services: reuse SQL instruction (refactoring)
An SQL instruction was duplicated in the code,
now PrimarySource class will reuse a method in
DatabaseTrackInfo class.
Signed-off-by: Alexander Kojevnikov <alexk gnome org>
.../DatabaseTrackInfo.cs | 2 +-
.../Banshee.Sources/PrimarySource.cs | 3 +--
2 files changed, 2 insertions(+), 3 deletions(-)
---
diff --git a/src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseTrackInfo.cs b/src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseTrackInfo.cs
index 231e8e5..ee7d0e6 100644
--- a/src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseTrackInfo.cs
+++ b/src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseTrackInfo.cs
@@ -787,7 +787,7 @@ namespace Banshee.Collection.Database
"SELECT COUNT('x') FROM CoreTracks WHERE PrimarySourceId IN (?) AND MetadataHash = ?"
);
- public static int GetTrackIdForUri (SafeUri uri, int [] primary_sources)
+ public static int GetTrackIdForUri (SafeUri uri, params int [] primary_sources)
{
return ServiceManager.DbConnection.Query<int> (get_track_id_by_uri,
primary_sources, uri.AbsoluteUri);
diff --git a/src/Core/Banshee.Services/Banshee.Sources/PrimarySource.cs b/src/Core/Banshee.Services/Banshee.Sources/PrimarySource.cs
index a27e7ca..1a27ac5 100644
--- a/src/Core/Banshee.Services/Banshee.Sources/PrimarySource.cs
+++ b/src/Core/Banshee.Services/Banshee.Sources/PrimarySource.cs
@@ -569,10 +569,9 @@ namespace Banshee.Sources
return true;
}
- private static HyenaSqliteCommand get_track_id_cmd = new HyenaSqliteCommand ("SELECT TrackID FROM CoreTracks WHERE PrimarySourceId = ? AND Uri = ? LIMIT 1");
public int GetTrackIdForUri (string uri)
{
- return ServiceManager.DbConnection.Query<int> (get_track_id_cmd, DbId, new SafeUri (uri).AbsoluteUri);
+ return DatabaseTrackInfo.GetTrackIdForUri (new SafeUri (uri), DbId);
}
private bool is_adding;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]