f-spot r4152 - in trunk: . src



Author: lmilesi
Date: Fri Jul  4 13:34:22 2008
New Revision: 4152
URL: http://svn.gnome.org/viewvc/f-spot?rev=4152&view=rev

Log:
2008-07-04  Lorenzo Milesi <maxxer yetopen it>

	* src/PhotoStore.cs: extend GetByUri to search in photo versions too.




Modified:
   trunk/ChangeLog
   trunk/src/PhotoStore.cs

Modified: trunk/src/PhotoStore.cs
==============================================================================
--- trunk/src/PhotoStore.cs	(original)
+++ trunk/src/PhotoStore.cs	Fri Jul  4 13:34:22 2008
@@ -353,8 +353,11 @@
 	{
 		Photo photo = null;
 
-		SqliteDataReader reader = Database.Query (new DbCommand ("SELECT id, time, description, roll_id, default_version_id, rating FROM photos "
-                + "WHERE uri = :uri", "uri", uri.ToString ()));
+		uint timer = Log.DebugTimerStart ();
+		SqliteDataReader reader = Database.Query (new DbCommand ("SELECT id, time, description, roll_id, default_version_id, rating " + 
+									 " FROM photos " +
+									 " JOIN photo_versions AS pv ON photos.id = pv.photo_id" +
+							                 " WHERE photos.uri = :uri OR pv.uri = :uri", "uri", uri.ToString ()));
 
 		if (reader.Read ()) {
 			photo = new Photo (Convert.ToUInt32 (reader [0]),
@@ -367,6 +370,7 @@
 			photo.Rating = Convert.ToUInt32 (reader [5]);
 		}
 	        reader.Close();
+		Log.DebugTimerPrint (timer, "GetByUri query took {0}");
 
 		if (photo == null)
 			return null;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]