ebaumann / jphototagger

JPhotoTagger is a platform independent Photo Manager. For details check out the website
https://www.elmar-baumann.de/JPhotoTagger/
Other
17 stars 3 forks source link

Wrong SQL generated from simple SQL #4

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Search for more than 1 xmp attributes in simple SQL
2.
3.

What is the expected output? What do you see instead?
The generated SQL is wrong which has a huge impact on performance:
The join condition:
INNER JOIN xmp ON files.id = xmp.id_file
is inserted multipe times (probably once per attribute)

What version of the product are you using? On what operating system?
JPhotoTagger 0.24.6
Java Runtime Environment version: 1.6.0_19
on Windows XP

Please provide any additional information below.
The workaround is to use custom SQL.
Example corrected SQL:
SELECT DISTINCT files.filename FROM files 
INNER JOIN exif ON files.id = exif.id_file  
INNER JOIN xmp ON files.id = xmp.id_file 
INNER JOIN xmp_dc_subject ON xmp.id = xmp_dc_subject.id_xmp 
INNER JOIN dc_subjects ON xmp_dc_subject.id_dc_subject = dc_subjects.id 
WHERE dc_subjects.subject = 'Nele' 
AND exif.exif_date_time_original > '2010-01-01' 
AND exif.exif_date_time_original < '2010-10-01' 
AND xmp.rating > 2

Original issue reported on code.google.com by u...@eulen-steffen.de on 21 Mar 2012 at 7:10

GoogleCodeExporter commented 9 years ago
This bug should be fixed in current version 0.24.7. BTW this is a very good bug 
report.

Original comment by eb@elmar-baumann.de on 22 Mar 2012 at 6:07