fix: query only contacts with ABCDContact type
This commit is contained in:
@@ -251,6 +251,11 @@ class Service(Queryable):
|
|||||||
class Record:
|
class Record:
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def queryAll(cursor: sqlite3.Cursor) -> Dict[int, 'Record']:
|
def queryAll(cursor: sqlite3.Cursor) -> Dict[int, 'Record']:
|
||||||
|
# get z_ent id that is used for contact cards
|
||||||
|
z_ent = cursor.execute(
|
||||||
|
'SELECT Z_ENT FROM Z_PRIMARYKEY WHERE Z_NAME == "ABCDContact"'
|
||||||
|
).fetchone()[0]
|
||||||
|
# find all records that match this id
|
||||||
return {x[0]: Record(x) for x in cursor.execute('''
|
return {x[0]: Record(x) for x in cursor.execute('''
|
||||||
SELECT Z_PK,
|
SELECT Z_PK,
|
||||||
ZFIRSTNAME, ZLASTNAME, ZMIDDLENAME, ZTITLE, ZSUFFIX,
|
ZFIRSTNAME, ZLASTNAME, ZMIDDLENAME, ZTITLE, ZSUFFIX,
|
||||||
@@ -260,7 +265,7 @@ class Record:
|
|||||||
strftime('%Y-%m-%d', ZBIRTHDAY + 978307200, 'unixepoch'),
|
strftime('%Y-%m-%d', ZBIRTHDAY + 978307200, 'unixepoch'),
|
||||||
ZTHUMBNAILIMAGEDATA, ZDISPLAYFLAGS
|
ZTHUMBNAILIMAGEDATA, ZDISPLAYFLAGS
|
||||||
FROM ZABCDRECORD
|
FROM ZABCDRECORD
|
||||||
WHERE ZCONTAINER1 IS NOT NULL;''')}
|
WHERE Z_ENT = ?;''', [z_ent])}
|
||||||
|
|
||||||
def __init__(self, row: List[Any]) -> None:
|
def __init__(self, row: List[Any]) -> None:
|
||||||
self.id = row[0] # type: int
|
self.id = row[0] # type: int
|
||||||
|
|||||||
Reference in New Issue
Block a user