sqlite3 - sqlite C api how to figure out what tables have foreign keys? -


using c api, don't see way determine foreign key constraints named table?

given example:

create table artist(   artistid    integer primary key,    artistname  text ); create table track(   trackid     integer,   trackname   text,    trackartist integer,   foreign key(trackartist) references artist(artistid) ); 

sqlite3_table_column_metadata() tell it's primary key, autoincrement, etc. how foreign key constraints?

 foreign key(trackartist) references artist(artistid) 

i want able list table "track" there foreign keys table artist column artistid?

i don't see api this? need programmaticlly upon opening database, purposes of aggregation.

thanks.

after using pragma foreign_key_list(valuation);

i got back:

pragma foreign_key_list(valuation); 0|0|stock|stockid|id|no action|no action|none 

i understand need split on vertical bar, first 2 columns? 0|0 ?

please note (foreign) keys can consist of multiple columns, not make sense return column information.

to information table's foreign keys, use this:

pragma foreign_key_list(table-name);

this pragma returns 1 row each foreign key constraint created references clause in create table statement of table "table-name".


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

css - Firefox for ubuntu renders wrong colors -