summaryrefslogtreecommitdiff
path: root/src/db/PhotoTable.vala
diff options
context:
space:
mode:
Diffstat (limited to 'src/db/PhotoTable.vala')
-rw-r--r--src/db/PhotoTable.vala13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/db/PhotoTable.vala b/src/db/PhotoTable.vala
index 4304da8..24cec86 100644
--- a/src/db/PhotoTable.vala
+++ b/src/db/PhotoTable.vala
@@ -920,14 +920,15 @@ public class PhotoTable : DatabaseTable {
sql += " OR ((";
first = false;
- if (thumbnail_md5 != null)
- sql += " thumbnail_md5=?";
-
if (md5 != null) {
- if (thumbnail_md5 == null)
- sql += " md5=?";
+ sql += " md5=?";
+
+ }
+ if (thumbnail_md5 != null) {
+ if (md5 == null)
+ sql += " thumbnail_md5=?";
else
- sql += " OR md5=?";
+ sql += " OR (md5 IS NULL AND thumbnail_md5=?)";
}
sql += ")";