cleaned up SQL statements in _process_database4

This commit is contained in:
Rhet Turnbull
2020-04-18 08:05:43 -07:00
parent 4b30b3b426
commit 6f281711e2

View File

@@ -521,10 +521,10 @@ class PhotosDB:
# Look for all combinations of persons and pictures # Look for all combinations of persons and pictures
c.execute( c.execute(
"select RKPerson.name, RKVersion.uuid from RKFace, RKPerson, RKVersion, RKMaster " """ select RKPerson.name, RKVersion.uuid from RKFace, RKPerson, RKVersion, RKMaster
+ "where RKFace.personID = RKperson.modelID and RKVersion.modelId = RKFace.ImageModelId " where RKFace.personID = RKperson.modelID and RKVersion.modelId = RKFace.ImageModelId
+ "and RKVersion.masterUuid = RKMaster.uuid and " and RKVersion.masterUuid = RKMaster.uuid
+ "RKVersion.filename not like '%.pdf' and RKVersion.isInTrash = 0" and RKVersion.isInTrash = 0 """
) )
for person in c: for person in c:
if person[0] is None: if person[0] is None:
@@ -538,10 +538,10 @@ class PhotosDB:
# Get info on albums # Get info on albums
c.execute( c.execute(
"select RKAlbum.uuid, RKVersion.uuid from RKAlbum, RKVersion, RKAlbumVersion " """ select RKAlbum.uuid, RKVersion.uuid from RKAlbum, RKVersion, RKAlbumVersion
+ "where RKAlbum.modelID = RKAlbumVersion.albumId and " where RKAlbum.modelID = RKAlbumVersion.albumId and
+ "RKAlbumVersion.versionID = RKVersion.modelId and " RKAlbumVersion.versionID = RKVersion.modelId
+ "RKVersion.filename not like '%.pdf' and RKVersion.isInTrash = 0" and RKVersion.isInTrash = 0 """
) )
for album in c: for album in c:
# store by uuid in _dbalbums_uuid and by album in _dbalbums_album # store by uuid in _dbalbums_uuid and by album in _dbalbums_album
@@ -583,12 +583,12 @@ class PhotosDB:
# Get info on keywords # Get info on keywords
c.execute( c.execute(
"select RKKeyword.name, RKVersion.uuid, RKMaster.uuid from " """ select RKKeyword.name, RKVersion.uuid, RKMaster.uuid from
+ "RKKeyword, RKKeywordForVersion, RKVersion, RKMaster " RKKeyword, RKKeywordForVersion, RKVersion, RKMaster
+ "where RKKeyword.modelId = RKKeyWordForVersion.keywordID and " where RKKeyword.modelId = RKKeyWordForVersion.keywordID and
+ "RKVersion.modelID = RKKeywordForVersion.versionID " RKVersion.modelID = RKKeywordForVersion.versionID and
+ "and RKMaster.uuid = RKVersion.masterUuid " RKMaster.uuid = RKVersion.masterUuid and
+ "and RKVersion.filename not like '%.pdf' and RKVersion.isInTrash = 0" RKVersion.isInTrash = 0 """
) )
for keyword in c: for keyword in c:
if not keyword[1] in self._dbkeywords_uuid: if not keyword[1] in self._dbkeywords_uuid:
@@ -899,13 +899,13 @@ class PhotosDB:
# get details on external edits # get details on external edits
c.execute( c.execute(
"SELECT RKVersion.uuid, " """ SELECT RKVersion.uuid,
"RKVersion.adjustmentUuid, " RKVersion.adjustmentUuid,
"RKAdjustmentData.originator, " RKAdjustmentData.originator,
"RKAdjustmentData.format " RKAdjustmentData.format
"FROM RKVersion, RKAdjustmentData " FROM RKVersion, RKAdjustmentData
"WHERE RKVersion.adjustmentUuid = RKAdjustmentData.uuid " WHERE RKVersion.adjustmentUuid = RKAdjustmentData.uuid
"AND RKVersion.isInTrash = 0" AND RKVersion.isInTrash = 0 """
) )
for row in c: for row in c: