Is there an equivalent SELECT statement for PRAGMA table_info('mytable') in SQLite? Essentially, I would like to get the exact same result set as PRAGMA returns: cid, name, type, notnull, dflt_value, and pk. Although I know of the other alternative to getting this information via the C function sqlite3_table_column_metadata, I would prefer to use a SELECT statement.
According to the doc
PRAGMAs that return results and that have no side-effects can be accessed from ordinary SELECT statements as table-valued functions. For each participating PRAGMA, the corresponding table-valued function has the same name as the PRAGMA with a 7-character "pragma_" prefix. The PRAGMA argument and schema, if any, are passed as arguments to the table-valued function.
For example, information about the columns in an index can be read using the index_info pragma as follows:
PRAGMA index_info('idx52'); Or, the same content can be read using:
SELECT * FROM pragma_index_info('idx52');
shouldn't this do the trick?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With