Allow exporting views dependent on each other (bug #3459151)
This commit is contained in:
parent
34adf46293
commit
63c400f95d
|
@ -70,12 +70,13 @@ SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
|
||||||
$table = (DB == "" || in_array($name, (array) $_POST["tables"]));
|
$table = (DB == "" || in_array($name, (array) $_POST["tables"]));
|
||||||
$data = (DB == "" || in_array($name, (array) $_POST["data"]));
|
$data = (DB == "" || in_array($name, (array) $_POST["data"]));
|
||||||
if ($table || $data) {
|
if ($table || $data) {
|
||||||
if (!is_view($table_status)) {
|
|
||||||
if ($ext == "tar") {
|
if ($ext == "tar") {
|
||||||
ob_start();
|
ob_start();
|
||||||
}
|
}
|
||||||
$adminer->dumpTable($name, ($table ? $_POST["table_style"] : ""));
|
$adminer->dumpTable($name, ($table ? $_POST["table_style"] : ""), (is_view($table_status) ? 2 : 0));
|
||||||
if ($data) {
|
if (is_view($table_status)) {
|
||||||
|
$views[] = $name;
|
||||||
|
} elseif ($data) {
|
||||||
$fields = fields($name);
|
$fields = fields($name);
|
||||||
$adminer->dumpData($name, $_POST["data_style"], "SELECT *" . convert_fields($fields, $fields) . " FROM " . table($name));
|
$adminer->dumpData($name, $_POST["data_style"], "SELECT *" . convert_fields($fields, $fields) . " FROM " . table($name));
|
||||||
}
|
}
|
||||||
|
@ -87,13 +88,10 @@ SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
|
||||||
} elseif ($is_sql) {
|
} elseif ($is_sql) {
|
||||||
echo "\n";
|
echo "\n";
|
||||||
}
|
}
|
||||||
} elseif ($is_sql) {
|
|
||||||
$views[] = $name;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
foreach ($views as $view) {
|
foreach ($views as $view) {
|
||||||
$adminer->dumpTable($view, $_POST["table_style"], true);
|
$adminer->dumpTable($view, $_POST["table_style"], 1);
|
||||||
}
|
}
|
||||||
if ($ext == "tar") {
|
if ($ext == "tar") {
|
||||||
echo pack("x512");
|
echo pack("x512");
|
||||||
|
|
|
@ -590,22 +590,30 @@ username.form['auth[driver]'].onchange();
|
||||||
/** Export table structure
|
/** Export table structure
|
||||||
* @param string
|
* @param string
|
||||||
* @param string
|
* @param string
|
||||||
* @param bool
|
* @param int 0 table, 1 view, 2 temporary view table
|
||||||
* @return null prints data
|
* @return null prints data
|
||||||
*/
|
*/
|
||||||
function dumpTable($table, $style, $is_view = false) {
|
function dumpTable($table, $style, $is_view = 0) {
|
||||||
if ($_POST["format"] != "sql") {
|
if ($_POST["format"] != "sql") {
|
||||||
echo "\xef\xbb\xbf"; // UTF-8 byte order mark
|
echo "\xef\xbb\xbf"; // UTF-8 byte order mark
|
||||||
if ($style) {
|
if ($style) {
|
||||||
dump_csv(array_keys(fields($table)));
|
dump_csv(array_keys(fields($table)));
|
||||||
}
|
}
|
||||||
} elseif ($style) {
|
} elseif ($style) {
|
||||||
$create = create_sql($table, $_POST["auto_increment"]);
|
if ($is_view == 2) {
|
||||||
if ($create) {
|
$fields = array();
|
||||||
if ($style == "DROP+CREATE") {
|
foreach (fields($table) as $name => $field) {
|
||||||
echo "DROP " . ($is_view ? "VIEW" : "TABLE") . " IF EXISTS " . table($table) . ";\n";
|
$fields[] = idf_escape($name) . " $field[full_type]";
|
||||||
}
|
}
|
||||||
if ($is_view) {
|
$create = "CREATE TABLE " . table($table) . " (" . implode(", ", $fields) . ")";
|
||||||
|
} else {
|
||||||
|
$create = create_sql($table, $_POST["auto_increment"]);
|
||||||
|
}
|
||||||
|
if ($create) {
|
||||||
|
if ($style == "DROP+CREATE" || $is_view == 1) {
|
||||||
|
echo "DROP " . ($is_view == 2 ? "VIEW" : "TABLE") . " IF EXISTS " . table($table) . ";\n";
|
||||||
|
}
|
||||||
|
if ($is_view == 1) {
|
||||||
$create = remove_definer($create);
|
$create = remove_definer($create);
|
||||||
}
|
}
|
||||||
echo "$create;\n\n";
|
echo "$create;\n\n";
|
||||||
|
|
|
@ -4,6 +4,7 @@ Print run time next to executed queries
|
||||||
Disable SQL export when applying functions in select
|
Disable SQL export when applying functions in select
|
||||||
Allow using lang() in plugins (customization)
|
Allow using lang() in plugins (customization)
|
||||||
Remove bzip2 compression support
|
Remove bzip2 compression support
|
||||||
|
Allow exporting views dependent on each other (bug #3459151)
|
||||||
MySQL: Optimize create table page and Editor navigation
|
MySQL: Optimize create table page and Editor navigation
|
||||||
MySQL: Display bit type as binary number
|
MySQL: Display bit type as binary number
|
||||||
MySQL: Improve export of binary data types
|
MySQL: Improve export of binary data types
|
||||||
|
|
Loading…
Reference in a new issue