Skip to main content
Version: Fegg 5.x (next)

Model::pragma

Execute Pragma

Description​

public array Model::pragma( string $mode )

Runs an SQLite PRAGMA on the model's table and returns its rows. SQLite only.

Arguments​

NameData typeDefaultRemarks
$modestringPragma mode

Pragma mode​

ModeQuery
tablePRAGMA table_info("table") (also any unknown mode)
index_listPRAGMA index_list("table")
indexPRAGMA index_info("table")

Example​

Controller
$model = new Model(true, array(
'table' => 'cms_news',
));

// PRAGMA table_info("cms_news")
$columns = $model->pragma('table');

print_r($columns[0]);
Output
Array
(
[cid] => 0
[name] => news_id
[type] => INTEGER
[notnull] => 1
[dflt_value] =>
[pk] => 1
)