Last active
January 16, 2020 15:48
-
-
Save speters/486e54ca415d13808eda31851eab197a to your computer and use it in GitHub Desktop.
get email addresses from Android E-Mail app
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
/* with kind regards to http://www.samuelbosch.com/2018/02/split-into-rows-sqlite.html */ | |
WITH RECURSIVE split(predictorset_id, predictor_name, rest) AS ( | |
SELECT _id, '', fromList || char(1) || toList || char(1) FROM Message WHERE _id | |
UNION ALL | |
SELECT predictorset_id, | |
substr(rest, 0, instr(rest, char(1))), | |
substr(rest, instr(rest, char(1))+1) | |
FROM split | |
WHERE rest <> '') | |
SELECT DISTINCT | |
CASE WHEN instr(predictor_name, char(2)) | |
THEN substr(predictor_name, 0, instr(predictor_name, char(2))) | |
ELSE predictor_name END | |
as email, | |
substr(predictor_name, instr(predictor_name, char(2))+1) as name | |
FROM split | |
WHERE predictor_name <> '' | |
UNION | |
SELECT accountAddress as email, | |
accountName as name | |
FROM EmailAddressCache | |
ORDER BY email; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment