Last active
December 2, 2016 16:05
-
-
Save scien/cc38b2cba28bbbb30054 to your computer and use it in GitHub Desktop.
Revisions
-
scien revised this gist
Sep 23, 2015 . 1 changed file with 6 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -39,4 +39,9 @@ Find a specific message from a friend WHERE handle_id = 41 and ROWID >= 7005 ORDER BY date LIMIT 10; Readable Date Format SELECT ROWID, datetime(date + strftime('%s', '2001-01-01 00:00:00'), 'unixepoch', 'localtime') as date, is_from_me, text FROM message WHERE handle_id in (1, 27) ORDER BY date; -
scien revised this gist
Sep 10, 2014 . 1 changed file with 23 additions and 6 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -7,19 +7,36 @@ Helpful Commands sqlite> .headers off sqlite> .headers on sqlite> .mode line sqlite> .mode list sqlite> .schema handle sqlite> .schema message Find a specific friend by phone number (find their handle id) sqlite> /* example: look for friend's from the 802 area code */ sqlite> SELECT ROWID, id FROM handle WHERE id like '+1802%'; Find message history with a specific friend sqlite> /* let's assume the ROWID from the previous query was 41 */ sqlite> .mode list sqlite> SELECT ROWID, date, is_from_me, text FROM message WHERE handle_id=41 ORDER BY date; Find a specific message from a friend sqlite> /* look at the ROWID of this query. */ sqlite> SELECT ROWID, date, is_from_me, text FROM message WHERE handle_id=41 and text like '%something they said%' ORDER BY date; sqlite> /* Let's assume we found our message at ROWID=7005 */ sqlite> /* then we can grab the next 10 messages from that conversation */ sqlite> SELECT ROWID, date, is_from_me, text FROM message WHERE handle_id = 41 and ROWID >= 7005 ORDER BY date LIMIT 10;
-
scien revised this gist
Sep 10, 2014 . 1 changed file with 17 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -6,4 +6,20 @@ Helpful Commands sqlite> .tables sqlite> .headers off sqlite> .headers on sqlite> .mode line sqlite> .schema message Find a specific friend by phone number sqlite> SELECT ROWID, id FROM handle WHERE id like '+1802%'; // area code 802 phone numbers Find message history with a specific friend sqlite> /* let's assume the ROWID from the previous query was 41 */ sqlite> .mode list sqlite> SELECT ROWID, date, is_from_me, text FROM message WHERE handle_id=41 ORDER BY date; Find a specific message from a friend sqlite> SELECT ROWID, date, is_from_me, text FROM message WHERE handle_id=41 and text like '%something they said%' ORDER BY date; sqlite> /* then look at the ROWID. We'll use 7005 for this example */ sqlite> /* then we can grab the next 10 messages from that conversation */ sqlite> select ROWID, date, is_from_me, text from message where handle_id = 41 and ROWID >= 7005 ORDER BY date LIMIT 10;
-
scien created this gist
Sep 10, 2014 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,9 @@ How to connect > sqlite3 ~/Library/Messages/chat.db Helpful Commands sqlite> .help sqlite> .tables sqlite> .headers off sqlite> .headers on sqlite> .mode line