Display SQLite compile options

git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@1472 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
jakubvrana 2010-04-21 23:06:32 +00:00
parent 58c80e369c
commit b84252fc51
3 changed files with 20 additions and 10 deletions

View file

@ -470,18 +470,23 @@ if (isset($_GET["sqlite"]) || isset($_GET["sqlite2"])) {
function show_variables() { function show_variables() {
global $connection; global $connection;
$return = array(); $return = array();
foreach (array("auto_vacuum", "cache_size", "count_changes", "default_cache_size", "empty_result_callbacks", "encoding", "foreign_keys", "full_column_names", "fullfsync", "journal_mode", "journal_size_limit", "legacy_file_format", "locking_mode", "page_size", "max_page_count", "read_uncommitted", "recursive_triggers", "reverse_unordered_selects", "secure_delete", "short_column_names", "synchronous", "temp_store", "temp_store_directory", "schema_version", "compile_options", "integrity_check", "quick_check") as $key) { foreach (array("auto_vacuum", "cache_size", "count_changes", "default_cache_size", "empty_result_callbacks", "encoding", "foreign_keys", "full_column_names", "fullfsync", "journal_mode", "journal_size_limit", "legacy_file_format", "locking_mode", "page_size", "max_page_count", "read_uncommitted", "recursive_triggers", "reverse_unordered_selects", "secure_delete", "short_column_names", "synchronous", "temp_store", "temp_store_directory", "schema_version", "integrity_check", "quick_check") as $key) {
$return[$key] = $connection->result("PRAGMA $key"); $return[$key] = $connection->result("PRAGMA $key");
} }
return $return; return $return;
} }
function show_status() { function show_status() {
// not supported $return = array();
foreach (get_vals("PRAGMA compile_options") as $option) {
list($key, $val) = explode("=", $option, 2);
$return[$key] = $val;
}
return $return;
} }
function support($feature) { function support($feature) {
return ereg('^(view|trigger|variables)$', $feature); return ereg('^(view|trigger|variables|status)$', $feature);
} }
$driver = "sqlite"; $driver = "sqlite";

View file

@ -134,7 +134,7 @@ function get_vals($query, $column = 0) {
global $connection; global $connection;
$return = array(); $return = array();
$result = $connection->query($query); $result = $connection->query($query);
if ($result) { if (is_object($result)) {
while ($row = $result->fetch_row()) { while ($row = $result->fetch_row()) {
$return[] = $row[$column]; $return[] = $row[$column];
} }

View file

@ -2,10 +2,15 @@
$status = isset($_GET["status"]); $status = isset($_GET["status"]);
page_header($status ? lang('Status') : lang('Variables')); page_header($status ? lang('Status') : lang('Variables'));
echo "<table cellspacing='0'>\n"; $variables = ($status ? show_status() : show_variables());
foreach (($status ? show_status() : show_variables()) as $key => $val) { if (!$variables) {
echo "<tr>"; echo "<p class='message'>" . lang('No rows.') . "\n";
echo "<th><code class='jush-" . $driver . ($status ? "status" : "set") . "'>" . h($key) . "</code>"; } else {
echo "<td>" . nbsp($val); echo "<table cellspacing='0'>\n";
foreach ($variables as $key => $val) {
echo "<tr>";
echo "<th><code class='jush-" . $driver . ($status ? "status" : "set") . "'>" . h($key) . "</code>";
echo "<td>" . nbsp($val);
}
echo "</table>\n";
} }
echo "</table>\n";