Created
June 6, 2018 14:58
-
-
Save mattura/14d110042f5dc86ade73f8d28080c2cd to your computer and use it in GitHub Desktop.
WhatsApp (iOS) ChatStorage.sqlite SQLite Join Query
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--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, ZPARTNERNAME | |
FROM ZWAMESSAGE | |
LEFT JOIN ZWACHATSESSION | |
ON ZWAMESSAGE.ZCHATSESSION=ZWACHATSESSION.Z_PK | |
LEFT JOIN ZWAMEDIAITEM | |
ON ZWAMEDIAITEM.Z_PK = ZWAMESSAGE.ZMEDIAITEM | |
--Neat: TODO |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment