thedarkpassenger
thedarkpassenger

Reputation: 7348

How to find out primary keys of a table in android sqlite programatically?

I have been working on an application where I need to determine the primary keys of the table programatically. Is there any API exposed in Android Sqlite which enables us to do this? I was able to find an API for retrieving primary keys of a table in C, but couldn't find the same for Android.

Any leads would be appreciated. TIA.

Upvotes: 1

Views: 75

Answers (1)

Vijay Pal Vishwakarma
Vijay Pal Vishwakarma

Reputation: 731

pragma table_info(table_name)

Run this schema (query) and find where pk value is 1

Upvotes: 1

Related Questions