Retrieve a list of all tables in the database

2019-02-14 02:52发布

问题:

I have this database file under the usual databases folder and a bunch of tables inside it.

Please note that I don't want to retrieve under the command line. I know I can use the ".tables" command.

I want to retrieve a list of all tables in it, using code, so that I can execute some specific algorithms on each of them.

Also, I didn't find any questions with this problem on Android, so please forgive me if there is any. I was wondering if there is any function I can use under DatabaseUtils, but I didn't find any either.

回答1:

Use

select name from sqlite_master where type = 'table'