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 に答える