sqlite3?

General discussions about Automagic and automation in general

Moderator: Martin

Post Reply
pmgnt
Posts: 26
Joined: 15 Jul 2016 00:34

sqlite3?

Post by pmgnt » 13 Jun 2018 16:31

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

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: sqlite3?

Post by Desmanto » 13 Jun 2018 18:11

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");
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

pmgnt
Posts: 26
Joined: 15 Jul 2016 00:34

Re: sqlite3?

Post by pmgnt » 16 Jun 2018 12:35

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

User avatar
digitalstone
Posts: 342
Joined: 21 Oct 2017 12:36
Location: The Netherlands

Re: sqlite3?

Post by digitalstone » 16 Jun 2018 14:29

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 '|'
Phone: LG Nexus 5X (rooted vanilla Android 7.1.2)

thomas
Posts: 3
Joined: 15 Apr 2018 15:30

Re: sqlite3?

Post by thomas » 16 Jun 2018 16:24

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.

User avatar
digitalstone
Posts: 342
Joined: 21 Oct 2017 12:36
Location: The Netherlands

Re: sqlite3?

Post by digitalstone » 17 Jun 2018 12:07

Is that what they call a truism?
Phone: LG Nexus 5X (rooted vanilla Android 7.1.2)

Post Reply