Page 1 of 1

sqlite3?

Posted: 13 Jun 2018 16:31
by pmgnt
root command:

/system/xbin/sqlite3 /data/data/com.whatsapp/databases/wa.db "SELECT display_name FROM wa_contacts WHERE is_whatsapp_user='1' ORDER BY _id;"

Call me stupid but how to make result (stdout) a valid list?

Thanks

Re: sqlite3?

Posted: 13 Jun 2018 18:11
by Desmanto
You want to extract out the WA contacts? I should start to learn sqlite soon, this could come in handy.

The stdout from the sqlite is contact name separated by newline. You can simply use split() to split them into list.

Code: Select all

wacontact = split(stdout,"\n");

Re: sqlite3?

Posted: 16 Jun 2018 12:35
by pmgnt
Yes, its for an multi choice contact picker that shows wa contacts only. However, it shows groups too.
If you need the jid's aswell you can use

/system/xbin/sqlite3 /data/data/com.whatsapp/databases/wa.db "SELECT display_name,jid FROM wa_contacts WHERE is_whatsapp_user == '1'"

Now you got contact name and its WhatsApp ID seperated by '|'

Regards

Re: sqlite3?

Posted: 16 Jun 2018 14:29
by digitalstone

Code: Select all

find("FirstName Lastname|123456", "\|")
This will create an list with (in this case) 3 items:
First item: Everything before '|'
Second item: '|'
Third item: Everything behind '|'

Re: sqlite3?

Posted: 16 Jun 2018 16:24
by thomas
sqlite is to read a sqldump file into memory and perform sql queries onto this.
A sqldump is a series of logged sql statements.
When you play them, the database reconstructs.

Re: sqlite3?

Posted: 17 Jun 2018 12:07
by digitalstone
Is that what they call a truism?