diff options
author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2016-08-20 15:11:08 +0200 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2016-08-20 15:11:08 +0200 |
commit | cb612a12b952e349b96d427645aaeb55d15f509a (patch) | |
tree | f29298f41d2a7ea2a976616243aca64c2c2547ce /src/db/PhotoTable.vala | |
parent | e7be93745e4a2ff3aa255227bef7b9d3b733aafa (diff) | |
parent | 143bfc9f801c84428074312d661f8e08803df83b (diff) |
Merge tag 'upstream/0.23.5'
Upstream version 0.23.5
Diffstat (limited to 'src/db/PhotoTable.vala')
-rw-r--r-- | src/db/PhotoTable.vala | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/db/PhotoTable.vala b/src/db/PhotoTable.vala index 5be08e7..f774df5 100644 --- a/src/db/PhotoTable.vala +++ b/src/db/PhotoTable.vala @@ -158,6 +158,33 @@ public class PhotoTable : DatabaseTable { if (res2 != Sqlite.DONE) fatal("create photo table", res2); + // These are for duplicate searches + // https://bugzilla.gnome.org/show_bug.cgi?id=742670 + // + // 1) index on md5,file_format + res = db.prepare_v2 ("CREATE UNIQUE INDEX IF NOT EXISTS PhotoTableMD5Format on PhotoTable(md5, file_format)", -1, out stmt); + assert (res == Sqlite.OK); + res = stmt.step (); + if (res != Sqlite.DONE) { + DatabaseTable.warning ("Failed to create index on md5 and file_format", res); + } + + // 2) index on thumbnail_md5,file_format + res = db.prepare_v2 ("CREATE INDEX IF NOT EXISTS PhotoTableThumbnailMD5Format on PhotoTable(thumbnail_md5, file_format)", -1, out stmt); + assert (res == Sqlite.OK); + res = stmt.step (); + if (res != Sqlite.DONE) { + DatabaseTable.warning ("Failed to create index on md5 and file_format", res); + } + + // 3) index on thumbnail_md5,md5 + res = db.prepare_v2 ("CREATE INDEX IF NOT EXISTS PhotoTableThumbnailMD5MD5 on PhotoTable(thumbnail_md5, md5)", -1, out stmt); + assert (res == Sqlite.OK); + res = stmt.step (); + if (res != Sqlite.DONE) { + DatabaseTable.warning ("Failed to create index on thumbnail_md5 and md5", res); + } + set_table_name("PhotoTable"); } |