function dumpData($table, $style, $query) { if ($_POST["format"] == "json") { if ($this->database) { echo ",\n"; } else { $this->database = true; echo "{\n"; register_shutdown_function(array($this, '_database')); } $connection = connection(); $result = $connection->query($query, 1); if ($result) { echo '"' . addcslashes($table, "\r\n\"\\") . "\": [\n"; $first = true; while ($row = $result->fetch_assoc()) { echo $first ? "" : ", "; $first = false; foreach ($row as $key => $val) { json_row($key, $val); } json_row(""); } echo "]"; } return true; } }
/** Print action box in select * @param array * @return null */ function selectActionPrint($indexes) { echo "<fieldset><legend>" . lang('Action') . "</legend><div>"; echo "<input type='submit' value='" . lang('Select') . "'>"; echo " <span id='noindex' title='" . lang('Full table scan') . "'></span>"; echo "<script type='text/javascript'>\n"; echo "var indexColumns = "; $columns = array(); foreach ($indexes as $index) { if ($index["type"] != "FULLTEXT") { $columns[reset($index["columns"])] = 1; } } $columns[""] = 1; foreach ($columns as $key => $val) { json_row($key); } echo ";\n"; echo "selectFieldChange(document.getElementById('form'));\n"; echo "</script>\n"; echo "</div></fieldset>\n"; }
} foreach ($sums + array("Auto_increment" => 0, "Rows" => 0) as $key => $val) { if ($table_status[$key] != "") { $val = format_number($table_status[$key]); json_row("{$key}-{$id}", $key == "Rows" && $val && $table_status["Engine"] == ($sql == "pgsql" ? "table" : "InnoDB") ? "~ {$val}" : $val); if (isset($sums[$key])) { // ignore innodb_file_per_table because it is not active for tables created before it was enabled $sums[$key] += $table_status["Engine"] != "InnoDB" || $key != "Data_free" ? $table_status[$key] : 0; } } elseif (array_key_exists($key, $table_status)) { json_row("{$key}-{$id}"); } } } } foreach ($sums as $key => $val) { json_row("sum-{$key}", format_number($val)); } json_row(""); } elseif ($_GET["script"] == "kill") { $connection->query("KILL " . +$_POST["kill"]); } else { // connect foreach (count_tables($adminer->databases()) as $db => $val) { json_row("tables-{$db}", $val); json_row("size-{$db}", db_size($db)); } json_row(""); } exit; // don't print footer