Pdo::pragma
SQLiteのPRAGMAのクエリを組み立てます
説明
public self Pdo::pragma( string $table, string $mode )
$tableに対するSQLiteのPRAGMAを組み立てます。executeの後、行をallで読みます。SQLite専用です。
引数
| 名前 | データ型 | デフォルト | 備考 |
|---|---|---|---|
| $table | string | テーブル名 | |
| $mode | string | PRAGMAのモード(下記) |
PRAGMAのモード
| モード | クエリ |
|---|---|
table | PRAGMA table_info("table")(不明なモードもこれになります) |
index_list | PRAGMA index_list("table") |
index | PRAGMA index_info("table") |
例
Controller
$db = new \Fegg\Database\Pdo();
// Columns of cms_news: cid, name, type, notnull, dflt_value, pk
$columns = $db->pragma('cms_news', 'table')->execute()->all();
// Indexes of cms_news: seq, name, unique, origin, partial
$indexes = $db->pragma('cms_news', 'index_list')->execute()->all();