list files: replace WHEREs with INNER JOIN ON

This commit is contained in:
Vincent Riquer 2013-03-08 12:58:27 +01:00
parent eb884e0e80
commit 807e0c961d

48
atom
View File

@ -983,18 +983,18 @@ removeObsoleteFiles
# get files
echo '
SELECT COUNT(DISTINCT source_files.filename)
FROM source_files,
destinations,
destination_files,
mime_type_actions,
tags
WHERE destination_files.last_change < source_files.last_change
AND destinations.id = destination_files.destination_id
AND mime_type_actions.destination_id = destinations.id
AND mime_type_actions.id = source_files.mime_type
AND source_files.id = destination_files.source_file_id
AND source_files.id = tags.source_file
AND tags.last_change < source_files.last_change
FROM source_files
INNER JOIN destination_files
ON destination_files.source_file_id=source_files.id
INNER JOIN destinations
ON destination_files.destination_id=destinations.id
INNER JOIN mime_type_actions
ON destinations.id=mime_type_actions.destination_id
INNER JOIN tags
ON source_files.id=tags.source_file
WHERE mime_type_actions.id = source_files.mime_type
AND NOT destination_files.last_change = source_files.last_change
AND NOT tags.last_change = source_files.last_change
AND mime_type_actions.action = 1;' >&3
read -u4 filecount
echo '
@ -1003,18 +1003,18 @@ echo '
source_files.last_change,
mime_type_actions.mime_text,
source_files.filename
FROM source_files,
destinations,
destination_files,
mime_type_actions,
tags
WHERE destination_files.last_change < source_files.last_change
AND destinations.id = destination_files.destination_id
AND mime_type_actions.destination_id = destinations.id
AND mime_type_actions.id = source_files.mime_type
AND source_files.id = destination_files.source_file_id
AND source_files.id = tags.source_file
AND tags.last_change < source_files.last_change
FROM source_files
INNER JOIN destination_files
ON destination_files.source_file_id=source_files.id
INNER JOIN destinations
ON destination_files.destination_id=destinations.id
INNER JOIN mime_type_actions
ON destinations.id=mime_type_actions.destination_id
INNER JOIN tags
ON source_files.id=tags.source_file
WHERE mime_type_actions.id = source_files.mime_type
AND NOT destination_files.last_change = source_files.last_change
AND NOT tags.last_change = source_files.last_change
AND mime_type_actions.action = 1;
SELECT "AtOM:NoMoreFiles";' >&3