[f-spot/fullfile-dupedetect] Fix HashJob queries.



commit 78f951c0c4ab78a7983c8e9ddd410c0d5ff6ce92
Author: Ruben Vermeersch <ruben savanne be>
Date:   Fri Jun 11 13:41:09 2010 +0200

    Fix HashJob queries.

 extensions/Tools/HashJob/HashJob.cs |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/extensions/Tools/HashJob/HashJob.cs b/extensions/Tools/HashJob/HashJob.cs
index 477aa0b..2f36fe7 100644
--- a/extensions/Tools/HashJob/HashJob.cs
+++ b/extensions/Tools/HashJob/HashJob.cs
@@ -36,9 +36,9 @@ namespace HashJobExtension {
 		{ 			
 			// This query is not very fast, but it's a 'one-time' so don't care much...
 			SqliteDataReader reader = FSpot.App.Instance.Database.Database.Query (
-				"SELECT COUNT(*) FROM photos p WHERE md5_sum IS NULL OR md5_sum = '' OR EXISTS " +
-					"(SELECT * FROM photo_versions pv WHERE p.id=pv.photo_id AND version_id <> '1' AND " +
-					"(pv.md5_sum IS NULL OR pv.md5_sum = ''))");
+				"SELECT COUNT(*) FROM photos p WHERE EXISTS " +
+					"(SELECT * FROM photo_versions pv WHERE p.id=pv.photo_id AND " +
+					"(pv.import_md5 IS NULL OR pv.import_md5 = ''))");
 			reader.Read ();
 			uint missing_md5 = Convert.ToUInt32 (reader[0]);
 			reader.Close ();
@@ -91,9 +91,9 @@ namespace HashJobExtension {
 		void HandleExecuteClicked (object o, EventArgs e)
 		{
 			SqliteDataReader reader = FSpot.App.Instance.Database.Database.Query (
-				"SELECT id FROM photos p WHERE md5_sum IS NULL OR md5_sum = '' OR EXISTS " +
-					"(SELECT * FROM photo_versions pv WHERE p.id=pv.photo_id AND version_id <> '1' AND " +
-					"(pv.md5_sum IS NULL OR pv.md5_sum = '') )");
+				"SELECT id FROM photos p WHERE EXISTS " +
+					"(SELECT * FROM photo_versions pv WHERE p.id=pv.photo_id AND " +
+					"(pv.import_md5 IS NULL OR pv.import_md5 = '') )");
 			FSpot.App.Instance.Database.Database.BeginTransaction ();
 			while (reader.Read ())
 				FSpot.Jobs.CalculateHashJob.Create (FSpot.App.Instance.Database.Jobs, Convert.ToUInt32 (reader[0]));



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