メインコンテンツまでスキップ
Version: Fegg 5.x

Pdo::pragma

SQLiteのPRAGMAのクエリを組み立てます

説明​

public self Pdo::pragma( string $table, string $mode )

$tableに対するSQLiteのPRAGMAを組み立てます。executeの後、行をallで読みます。SQLite専用です。

引数​

名前データ型デフォルト備考
$tablestringテーブル名
$modestringPRAGMAのモード(下記)

PRAGMAのモード​

モードクエリ
tablePRAGMA table_info("table")(不明なモードもこれになります)
index_listPRAGMA index_list("table")
indexPRAGMA 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();