PRAGMA foreign_key_list(table-name)
I don't know the table-name, how do I get a list of table names in the database?

 
      From: Simon Slavin <[email protected]>
 To: Jonathan Leslie <[email protected]>; General Discussion of SQLite 
Database <[email protected]> 
 Sent: Tuesday, December 30, 2014 11:14 AM
 Subject: Re: [sqlite] SQL newbie, how to implement a delete correctly.
   

On 30 Dec 2014, at 3:53pm, Jonathan Leslie <[email protected]> wrote:

> Sorry, I wasn't clear.  what if there are other child tables, say child02- 
> childxx, and you don't know the names of the table, you want to search the 
> entire database?  

SQLite has no command which will help it specifically find all the child rows 
of a row.  You will have to use a set of SELECT commands like the one Hick 
posted.

It would be possible to write some clever code which came up with this list.  
You would want to start off executing

PRAGMA foreign_key_list(table-name)

and looking at the results you get back from it.  From those you could generate 
SELECT statements which found the child rows.

Simon.


_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


   
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to