Find schema of a table in a query
| Newsgroups | gmane.comp.db.sqlite.general |
|---|---|
| Message-ID | <DB7PR04MB52895321CCE129A5DE53336DB7330@DB7PR04MB5289.eurprd04.prod.outlook.com> |
Suppose you’re given a query ‘SELECT 1 from tbl’ by a user and you want to know the name of the schema that tbl belongs to. What’s the easiest way to do this? I know sqlite will use temp.tbl if it exists else main.tbl if it exists else it will search for the earliest attached schema with a table called tbl. Finding that involves the use of PRAGMA database_list and then querying each of the associated sqlite_master tables in turn for the existence of tbl until you get a match. Is there an easier way? _______________________________________________ sqlite-users mailing list [email protected] http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users