Jerry Krinock wrote:
Is there any way to get a list of all column names in a table via the C API, which works even when there are no data rows in the table?


Jerry,

You can get the column names for any query, including a "select * from table", using the prepared statement APIs.

After you prepare a query using sqlite3_prepare(), you can call sqlite3_column_count() to get the number of columns that will be returned, and then loop calling sqlite3_column_name() to get the columns names. Note, you do *not* need to execute the query to get this information, so it doesn't matter if the table is empty or not. After you have the column names you can simply finalize the prepared statement.

See http://www.sqlite.org/c3ref/prepare.html, http://www.sqlite.org/c3ref/column_count.html, and http://www.sqlite.org/c3ref/column_name.html for more details.

HTH
Dennis cote




-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to