You are here

function dba_sqlite_report_variables in Database Administration 7

The PRAGMA statement is an SQL extension specific to SQLite and used to modify the operation of the SQLite library or to query the SQLite library for internal (non-table) data. See https://sqlite.org/pragma.html

File

database/sqlite.report.inc, line 48
Provides database driver specific report functions.

Code

function dba_sqlite_report_variables() {
  $variables = new stdClass();

  // @todo: Is there some way to confirm that a given PRAGMA is available
  // with the active version of SQLite?
  $pragmas = array(
    'auto_vacuum',
    'automatic_index',
    'cache_size',
    'encoding',
    'freelist_count',
    'fullfsync',
    'ignore_check_constraints',
    'journal_mode',
    'journal_size_limit',
    'legacy_file_format',
    'locking_mode',
    'max_page_count',
    'mmap_size',
    'page_count',
    'page_size',
    'read_uncommitted',
    'recursive_triggers',
    'reverse_unordered_selects',
    'schema_version',
    'user_version',
    'secure_delete',
    'synchronous',
    'temp_store',
    'wal_autocheckpoint',
  );
  foreach ($pragmas as $pragma) {
    $result = db_query("PRAGMA {$pragma}");
    $value = $result
      ->fetchObject();
    $variables->{$pragma} = $value->{$pragma};
  }
  return $variables;
}