Last active
August 29, 2015 14:08
-
-
Save theotherian/0be39a4b303063751c85 to your computer and use it in GitHub Desktop.
SQL for iPhone messages
This file contains hidden or 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
select | |
case is_from_me when 0 then 'Other Person' else 'Me' end, | |
-- you may be wondering what the hell 'date + 978307200' is about | |
-- the iPhone stores dates as seconds past Jan 1st, 2001 rather than 1970 | |
-- adding the 978307200 will 'move' your date up to the epoch, which allows sqllite to convert it for you | |
datetime(date + 978307200,'unixepoch', 'localtime'), | |
text | |
from | |
message | |
where | |
handle_id in ( | |
select | |
ROWID | |
from | |
handle | |
where | |
id = '<phone number you care about as +1[area code][number]>' | |
) | |
; |
This file contains hidden or 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
PRAGMA table_info(handle); |
This file contains hidden or 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
SQL for iPhone messages |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment