On 30 Sep 2010, at 4:47pm, TP wrote:

> Apart from parsing the SQL definition of a table obtained with 
> sqlite_master, is there any means to obtain directly the primary key of a 
> table? I have not found any PRAGMA allowing that.

If your primary key is a unique autoincrement integer, then (bit of handwaving) 
SQLite will hand it to you when you ask for the column called '_rowid_'.  So 
even if you don't know what it's called, you can always get the values used.

If you're willing to do some analysis work you can work out what the primary 
key is by looking at the table definition.  And you can find that by doing a 
SELECT on SQLITE_MASTER:

<http://www.sqlite.org/faq.html#q7>

Simon.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to