开发者

sqlite - programmatically determine primary key(s)

开发者 https://www.devze.com 2023-01-12 21:32 出处:网络
I need to programatically determine what the primary key field(s) are for a given sqlite table (using sqlite api, not command line).

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号