foreach ($table_status as $row) {
$id = addcslashes($row["Name"], "\\'/");
echo "setHtml('Comment-$id', '" . nbsp($row["Comment"]) . "');\n";
- if (!eregi("view", $row["Engine"])) {
+ if (!is_view($row)) {
foreach (array("Engine", "Collation") as $key) {
echo "setHtml('$key-$id', '" . nbsp($row[$key]) . "');\n";
}
return $return;
}
+ function is_view($table_status) {
+ return $table_status["Engine"] == "VIEW";
+ }
+
function fk_support($table_status) {
return true;
}
$row["Comment"] = preg_replace('~(?:(.+); )?InnoDB free: .*~', '\\1', $row["Comment"]);
}
if (!isset($row["Rows"])) {
- $row["Engine"] = "VIEW";
$row["Comment"] = "";
}
if ($name != "") {
return $return;
}
+ /** Find out whether the identifier is view
+ * @param array
+ * @return bool
+ */
+ function is_view($table_status) {
+ return !isset($table_status["Rows"]);
+ }
+
/** Check if table supports foreign keys
* @param array result of table_status
* @return bool
return $return;
}
+ function is_view($table_status) {
+ return $table_status["Engine"] == "view";
+ }
+
function fk_support($table_status) {
return true;
}
return ($name != "" ? $return[$name] : $return);
}
+ function is_view($table_status) {
+ return $table_status["Engine"] == "view";
+ }
+
function fk_support($table_status) {
return true;
}
return ($name != "" ? $return[$name] : $return);
}
+ function is_view($table_status) {
+ return $table_status["Engine"] == "view";
+ }
+
function fk_support($table_status) {
global $connection;
return !$connection->result("SELECT sqlite_compileoption_used('OMIT_FOREIGN_KEY')");
$table = (DB == "" || in_array($row["Name"], (array) $_POST["tables"]));
$data = (DB == "" || in_array($row["Name"], (array) $_POST["data"]));
if ($table || $data) {
- if (isset($row["Engine"])) {
+ if (!is_view($row)) {
if ($ext == "tar") {
ob_start();
}
$prefix = ereg_replace("_.*", "", $name);
$checked = ($TABLE == "" || $TABLE == (substr($TABLE, -1) == "%" ? "$prefix%" : $name)); //! % may be part of table name
$print = "<tr><td>" . checkbox("tables[]", $name, $checked, $name, "formUncheck('check-tables');");
- if (eregi("view", $row["Engine"])) {
+ if (is_view($row)) {
$views .= "$print\n";
} else {
echo "$print<td align='right'><label>" . ($row["Engine"] == "InnoDB" && $row["Rows"] ? "~ " : "") . $row["Rows"] . checkbox("data[]", $name, $checked, "", "formUncheck('check-data');") . "</label>\n";
function selectLinks($tableStatus, $set = "") {
echo '<p class="tabs">';
$links = array("select" => lang('Select data'), "table" => lang('Show structure'));
- if (eregi("view", $tableStatus["Engine"])) {
+ if (is_view($tableStatus)) {
$links["view"] = lang('Alter view');
} else {
$links["create"] = lang('Alter table');
}
$table_status = ($fields ? table_status($TABLE) : array());
-page_header(($fields && $table_status["Engine"] == "VIEW" ? lang('View') : lang('Table')) . ": " . h($TABLE), $error);
+page_header(($fields && is_view($table_status) ? lang('View') : lang('Table')) . ": " . h($TABLE), $error);
$adminer->selectLinks($table_status);
if ($fields) {
}
echo "</table>\n";
- if ($table_status["Engine"] != "VIEW") {
+ if (is_view($table_status)) {
echo "<h3>" . lang('Indexes') . "</h3>\n";
$indexes = indexes($TABLE);
if ($indexes) {