0

我想从当前数据库中获取所有表及其列的列表,例如:

 table1
  - column1
  - column2
  - column3
 table2
  - column1
  - column2

我试过:

SELECT * FROM sqlite_master WHERE type=? ORDER BY name;

?'table'

但我只得到表格列表,没有列:(

如果我删除 WHERE 子句,我会收到此错误:

SQLSTATE[HY000]: General error: 25 bind or column index out of range

如果我换成tablecolumn什么都得不到...

请帮忙?

4

1 回答 1

3

试试这个查询:

pragma table_info(table1);

您将获得以下列:

cid // Column Id
name // Column Name
type // Column Type
notnull // If the column is not null
dflt_value // Column default Value
pk // If the column is a primary key
于 2012-02-11T21:59:38.747 回答