views:

133

answers:

1

You can get a list of databases using

PRAGMA database_list

or a list of tables in the "main" database using

select name from sqlite_master where type='table'

but as I just wrote, it only returns the tables from the "main" DB only, and I don't see a way to know which tables are in the other DBs.

So how does one list the tables in the other DBs (which were attached later on)?

Thanks, --DD

PS: I can think of a work around of creating a separate sqlite* for each DB listed via the pragma database_list, and them doing the "select name from sqlite_master where type='table'" N times on those (since each one is the "main" one now), but this sounds like something that should be possible without resorting to the work-around, no???

A: 

Ah ah, found the answer by looking at the answer for http://stackoverflow.com/questions/837067/how-do-i-open-an-in-memory-database-file-into-sqlite3

Since there's a sqlite_master per DB, all I need to do is prefix sqlite_master with "DB_name." where DB_name corresponds to the name column returned by PRAGMA database_list.

ddevienne