sqlite - programmatically determine primary key(s)
I need to programatically determine what the primary key field(s) are for a given sqlite table (using sqlite api, not command line).
I can get a list of tables and a list of colum开发者_JAVA技巧ns, but only see the column type using the Column_Type() function. Need to know if a given column is the primary key (or part of the primary key if a compound key is used).
Have a look at sqlite3_table_column_metadata:
This routine returns metadata about a specific column of a specific database table accessible using the database connection handle passed as the first function argument.
精彩评论