sqlite下能通過sqlite_master獲取指定數據庫的表信息和表結構
但是通過sqlite_master不能獲取表字段的信息
如果需要獲取指定表字段的所有信息
可以使用如下語法:
1 PRAGMA table_info('tablename')
如下圖:
例如(Qt下):
QSqlQuery query; query.prepare(" PRAGMA table_info('tableview_data')"); if(query.exec()){ while(query.next()){ this->xl_debug(query.value(2).toString()); } }