f-spot r4494 - in branches/FSPOT_0_5_0_STABLE: . src



Author: sdelcroix
Date: Thu Oct 16 21:06:17 2008
New Revision: 4494
URL: http://svn.gnome.org/viewvc/f-spot?rev=4494&view=rev

Log:
2008-10-16  Stephane Delcroix  <sdelcroix novell com>

	* src/PhotoStore.cs: Fix the biggest WTF ever. We should definitely
	stop referencing results columns by their id !

Modified:
   branches/FSPOT_0_5_0_STABLE/ChangeLog
   branches/FSPOT_0_5_0_STABLE/src/PhotoStore.cs

Modified: branches/FSPOT_0_5_0_STABLE/src/PhotoStore.cs
==============================================================================
--- branches/FSPOT_0_5_0_STABLE/src/PhotoStore.cs	(original)
+++ branches/FSPOT_0_5_0_STABLE/src/PhotoStore.cs	Thu Oct 16 21:06:17 2008
@@ -356,7 +356,7 @@
 #else
 				new System.Uri (reader [1].ToString (), true),
 #endif
-				reader[6].ToString ()
+				reader[6] != null ? reader[6].ToString () : null
 			);
 
 			photo.Description = reader[2].ToString ();
@@ -388,7 +388,7 @@
 
 		uint timer = Log.DebugTimerStart ();
 
-		SqliteDataReader reader = Database.Query (new DbCommand ("SELECT id, time, description, roll_id, default_version_id, rating " + 
+		SqliteDataReader reader = Database.Query (new DbCommand ("SELECT id, time, description, roll_id, default_version_id, rating, md5_sum " +
 									 " FROM photos " +
 									 " LEFT JOIN photo_versions AS pv ON photos.id = pv.photo_id" +
 							                 " WHERE photos.uri = :uri OR pv.uri = :uri", "uri", uri.ToString ()));
@@ -397,7 +397,7 @@
 			photo = new Photo (Convert.ToUInt32 (reader [0]),
 					   Convert.ToInt64 (reader [1]),
 					   uri,
-					   reader[6].ToString ());
+					   reader[6] != null ? reader[6].ToString () : null);
 
 			photo.Description = reader[2].ToString ();
 			photo.RollId = Convert.ToUInt32 (reader[3]);
@@ -892,7 +892,7 @@
 		return Query (new DbCommand (query));
 	}
 
-	public Photo [] Query (DbCommand query)
+	private Photo [] Query (DbCommand query)
 	{
 		uint timer = Log.DebugTimerStart ();
 		SqliteDataReader reader = Database.Query(query);
@@ -911,7 +911,7 @@
 #else
 						   new System.Uri (reader [2].ToString (), true),
 #endif
-						   reader [6].ToString ()
+						   reader[7] != null ? reader [7].ToString () : null
 				);
 				photo.Description = reader[3].ToString ();
 				photo.RollId = Convert.ToUInt32 (reader[4]);
@@ -1029,7 +1029,8 @@
 					     "photos.description, "		+
 					     "photos.roll_id, "   		+
 					     "photos.default_version_id, "	+
-					     "photos.rating "			+
+					     "photos.rating, "			+
+					     "photos.md5_sum "			+
 				      "FROM photos ");
 
 		if (range != null) {



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