[f-spot/fullfile-dupedetect: 4/4] Mo longer load filename and base_uri for Photo.



commit 301bb38094dfb588ca1710404dbf958561b002f6
Author: Ruben Vermeersch <ruben savanne be>
Date:   Thu Jun 10 00:14:46 2010 +0200

    Mo longer load filename and base_uri for Photo.
    
    Values are still kept in the database to make querying faster.

 src/Core/Photo.cs |    7 +------
 src/PhotoStore.cs |   22 +++++-----------------
 2 files changed, 6 insertions(+), 23 deletions(-)
---
diff --git a/src/Core/Photo.cs b/src/Core/Photo.cs
index 0182adc..1950795 100644
--- a/src/Core/Photo.cs
+++ b/src/Core/Photo.cs
@@ -509,14 +509,9 @@ namespace FSpot
 		}
 
 		// Constructor
-		public Photo (uint id, long unix_time, SafeUri base_uri, string filename)
+		public Photo (uint id, long unix_time)
 			: base (id)
 		{
-			if (base_uri == null)
-				throw new System.ArgumentNullException ("base_uri");
-			if (filename == String.Empty)
-				throw new System.ArgumentNullException ("filename");
-	
 			time = DbUtils.DateTimeFromUnixTime (unix_time);
 	
 			description = String.Empty;
diff --git a/src/PhotoStore.cs b/src/PhotoStore.cs
index f9b9f84..b9a7bc0 100644
--- a/src/PhotoStore.cs
+++ b/src/PhotoStore.cs
@@ -141,7 +141,7 @@ public class PhotoStore : DbStore<Photo> {
 				)
 			);
 
-			photo = new Photo (id, unix_time, new_base_uri, filename);
+			photo = new Photo (id, unix_time);
 			photo.AddVersionUnsafely (Photo.OriginalVersionId, new_base_uri, filename, import_md5, Catalog.GetString ("Original"), true);	
 			photo.Loaded = true;
 
@@ -272,20 +272,14 @@ public class PhotoStore : DbStore<Photo> {
 			return photo;
 		
 		SqliteDataReader reader = Database.Query(
-			new DbCommand("SELECT time, base_uri, filename, description, roll_id, default_version_id, rating " + 
+			new DbCommand("SELECT time, description, roll_id, default_version_id, rating " + 
 				      "FROM photos " + 
 				      "WHERE id = :id", "id", id
 				     )
 		);
 
 		if (reader.Read ()) {
-			var base_uri = new SafeUri (reader ["base_uri"].ToString (), true);
-			var filename = reader ["filename"].ToString ();
-			photo = new Photo (id,
-				Convert.ToInt64 (reader ["time"]),
-			    base_uri, filename
-			);
-
+			photo = new Photo (id, Convert.ToInt64 (reader ["time"]));
 			photo.Description = reader["description"].ToString ();
 			photo.RollId = Convert.ToUInt32 (reader["roll_id"]);
 			photo.DefaultVersionId = Convert.ToUInt32 (reader["default_version_id"]);
@@ -321,9 +315,7 @@ public class PhotoStore : DbStore<Photo> {
 
 		if (reader.Read ()) {
 			photo = new Photo (Convert.ToUInt32 (reader ["id"]),
-					   Convert.ToInt64 (reader ["time"]),
-					   base_uri,
-					   filename);
+					   Convert.ToInt64 (reader ["time"]));
 
 			photo.Description = reader["description"].ToString ();
 			photo.RollId = Convert.ToUInt32 (reader["roll_id"]);
@@ -762,11 +754,7 @@ public class PhotoStore : DbStore<Photo> {
 			Photo photo = LookupInCache (id);
 
 			if (photo == null) {
-				var base_uri = new SafeUri (reader ["base_uri"].ToString (), true);
-				var filename = reader ["filename"].ToString ();
-				photo =
-					new Photo (id, Convert.ToInt64 (reader ["time"]),
-					           base_uri, filename);
+				photo = new Photo (id, Convert.ToInt64 (reader ["time"]));
 				photo.Description = reader["description"].ToString ();
 				photo.RollId = Convert.ToUInt32 (reader["roll_id"]);
 				photo.DefaultVersionId = Convert.ToUInt32 (reader["default_version_id"]);



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