I want to migrate my iPhone app to a new database version. Since I don't have some version saved, I need to check if certain column names exist.
This Stackoverflow entry suggests doing the select
SELECT sql FROM sqlite_master
WHERE tbl_name = 'table_name' AND type = 'table'
and parse the result.
Is that the common way? Alternatives?
.schema in sqlite console when you have you're inside the table it looks something like this for me ...
I know it's too late but this will help other.
To find the column name of the table, you should execute
select * from tbl_name
and you will get the result insqlite3_stmt *
. and check the column iterate over the total fetched column. Please refer following code for the same.This will print all the column names of the result set.
In order to get the column information you can use the following snippet:
If you do
you will get the desired result.
To get a list of columns you can simply use: