Skip to content

Instantly share code, notes, and snippets.

Avatar

mattura

  • London
View GitHub Profile
@mattura
mattura / WAJoin.sqlite
Created Jun 6, 2018
WhatsApp (iOS) ChatStorage.sqlite SQLite Join Query
View WAJoin.sqlite
--Full:
SELECT ZWAMESSAGE.Z_PK AS PK, ZWAMESSAGE.Z_ENT AS ENT, ZWAMESSAGE.Z_OPT AS OPT, ZCHATSESSION AS 'Chat Session',
CASE ZISFROMME WHEN 0 THEN 'Incoming' WHEN 1 THEN 'Outgoing' ELSE ZISFROMME END Direction,
CASE ZMESSAGESTATUS WHEN 8 THEN 'Read' WHEN 6 THEN 'Unread' ELSE ZMESSAGESTATUS END Status,
CASE ZMESSAGETYPE WHEN 0 THEN 'Text' WHEN 1 THEN 'Picture' WHEN 2 THEN 'Media2' WHEN 4 THEN 'Media4' WHEN 10 THEN 'System Information Message' ELSE ZMESSAGETYPE END 'Message Type',
ZSORT AS 'Sort Index', ZMEDIAITEM, ZMESSAGEINFO, datetime(ZMESSAGEDATE + 978307200, 'unixepoch') AS 'Message Date', datetime(ZSENTDATE + 978307200, 'unixepoch') AS 'Sent Date', ZFROMJID, ZTOJID, ZPUSHNAME, ZTEXT AS Text,
ZMEDIALOCALPATH AS 'Path', ZXMPPTHUMBPATH, ZTITLE,
ZVCARDSTRING,
ZMOVIEDURATION, ZMEDIAURLDATE, ZFILESIZE,
ZWACHATSESSION.ZMESSAGECOUNTER AS 'Message Counter', ZUNREADCOUNT AS 'Unread Count', ZLASTMESSAGE AS 'Last Message PK', datetime(ZLASTMESSAGEDATE + 978307200, 'unixepoch') AS 'Last Message', ZCONTACTJID, Z