How to get a list of column names on Sqlite3 database?

后端 未结 18 1340
半阙折子戏
半阙折子戏 2020-11-27 08:48

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

18条回答
  •  迷失自我
    2020-11-27 09:25

    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 in sqlite3_stmt *. and check the column iterate over the total fetched column. Please refer following code for the same.

    // sqlite3_stmt *statement ;
    int totalColumn = sqlite3_column_count(statement);
    for (int iterator = 0; iterator

    This will print all the column names of the result set.

提交回复
热议问题