[f-spot/fullfile-dupedetect: 3/3] Mo longer load filename and base_uri for Photo.
- From: Ruben Vermeersch <rubenv src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [f-spot/fullfile-dupedetect: 3/3] Mo longer load filename and base_uri for Photo.
- Date: Wed, 9 Jun 2010 22:43:11 +0000 (UTC)
commit 854b48660aebb2e4f2ecf7d46cbe6cf7cfe9f0ec
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 | 26 +++++++-------------------
2 files changed, 8 insertions(+), 25 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 f55cafd..8515122 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;
@@ -270,22 +270,16 @@ public class PhotoStore : DbStore<Photo> {
Photo photo = LookupInCache (id);
if (photo != null)
return photo;
-
+
SqliteDataReader reader = Database.Query(
- new DbCommand("SELECT time, base_uri, filename, description, roll_id, default_version_id, rating " +
- "FROM photos " +
+ 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]