DB-API: get_family_handles(sort_handles=True) now fixed
This commit is contained in:
parent
1c06a07156
commit
0a0a450b45
@ -377,11 +377,21 @@ class DBAPI(DbGeneric):
|
||||
If sort_handles is True, the list is sorted by surnames.
|
||||
"""
|
||||
if sort_handles:
|
||||
self.dbapi.execute("""SELECT DISTINCT family.handle FROM family
|
||||
JOIN person
|
||||
ON family.father_handle = person.handle
|
||||
ORDER BY person.primary_name__surname_list__0__surname,
|
||||
person.primary_name__first_name;""")
|
||||
self.dbapi.execute("""SELECT f.handle FROM
|
||||
(SELECT family.*
|
||||
FROM family LEFT JOIN
|
||||
person AS father
|
||||
ON family.father_handle = father.handle LEFT JOIN
|
||||
person AS mother
|
||||
on family.mother_handle = mother.handle
|
||||
order by (case when father.handle is null
|
||||
then mother.primary_name__surname_list__0__surname
|
||||
else father.primary_name__surname_list__0__surname
|
||||
end),
|
||||
(case when family.handle is null
|
||||
then mother.primary_name__first_name
|
||||
else father.primary_name__first_name
|
||||
end)) AS f;""")
|
||||
else:
|
||||
self.dbapi.execute("SELECT handle FROM family;")
|
||||
rows = self.dbapi.fetchall()
|
||||
|
Loading…
x
Reference in New Issue
Block a user