On 8/1/18, Charles Leifer <colei...@gmail.com> wrote:
> You can simply use:
>
> PRAGMA table_info('my_table')
>
> To get a list of columns, which you can check against and then
> conditionally add your column.

From C-code, you can use the sqlite_table_column_metadata() interface
[1] to quickly check for the existance of tables and/or columns.  This
happens a lot in Fossil, which has an evolving schema but still needs
to work with older repositories.

[1] https://www.sqlite.org/c3ref/table_column_metadata.html

-- 
D. Richard Hipp
d...@sqlite.org
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to