Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在使用 cpp 和 -lsqlite3 来处理一些数据。我只是想询问一个查询,它将返回 sqlite 中特定表的列数。有没有可能查到?
使用足够新的 SQLite 版本:
select count(*) from pragma_table_info('tableName')
如果它不必是 SQL 查询,但可以是 API 调用,那么 a) 准备一个查询select * from tableName(只需准备,您不需要实际执行它),然后调用sqlite3_column_count生成的语句句柄。
select * from tableName
sqlite3_column_count