automatic layout for InnoDB

This commit is contained in:
Marc Delisle
2006-07-27 13:34:49 +00:00
parent dfd6adb11e
commit a8d75035e8
3 changed files with 80 additions and 51 deletions

View File

@@ -7,7 +7,7 @@ $Source$
2006-07-27 Marc Delisle <lem9@users.sourceforge.net> 2006-07-27 Marc Delisle <lem9@users.sourceforge.net>
* pdf_pages.php: prepare implementation for automatic layout on InnoDB * pdf_pages.php: automatic layout for InnoDB tables
* tbl_properties_operations.php: problem switching from InnoDB to MyISAM * tbl_properties_operations.php: problem switching from InnoDB to MyISAM
2006-07-26 Marc Delisle <lem9@users.sourceforge.net> 2006-07-26 Marc Delisle <lem9@users.sourceforge.net>

View File

@@ -2870,7 +2870,6 @@ RewriteRule .* - [E=REMOTE_USER:%{HTTP:Authorization},L]
or having more than one index field in the foreign key.<br /><br/> or having more than one index field in the foreign key.<br /><br/>
In Query-by-example (Query), automatic generation of the query In Query-by-example (Query), automatic generation of the query
LEFT JOIN from the foreign table.<br /><br/> LEFT JOIN from the foreign table.<br /><br/>
In <abbr title="Portable Document Format">PDF</abbr> schema editing, automatic layout.
</p> </p>
<h4 id="faq3_7"> <h4 id="faq3_7">

View File

@@ -80,13 +80,31 @@ if ($cfgRelation['pdfwork']) {
PMA_query_as_cu($ins_query, FALSE, $query_default_option); PMA_query_as_cu($ins_query, FALSE, $query_default_option);
// A u t o m a t i c l a y o u t // A u t o m a t i c l a y o u t
// // ================================
// TODO: support InnoDB if (isset($auto_layout_internal) || isset($auto_layout_innodb)) {
if (isset($auto_layout_internal)) {
// save the page number // save the page number
$pdf_page_number = PMA_DBI_insert_id((isset($controllink)?$controllink:'')); $pdf_page_number = PMA_DBI_insert_id((isset($controllink)?$controllink:''));
$all_tables = array();
}
if (isset($auto_layout_innodb)) {
// get the tables list
$tables = PMA_DBI_get_tables_full($db);
// find the InnoDB ones
$innodb_tables = array();
foreach($tables as $table_name => $table_properties) {
if ($table_properties['ENGINE'] == 'InnoDB') {
$innodb_tables[] = $table_name;
}
}
$all_tables = $innodb_tables;
// could be improved by finding the tables which have the
// most references keys and place them at the beginning
// of the array (so that they are all center of schema)
unset($tables, $innodb_tables);
} // endif auto_layout_innodb
if (isset($auto_layout_internal)) {
// get the tables that have relations, by descending // get the tables that have relations, by descending
// number of links // number of links
$master_tables = 'SELECT COUNT(master_table), master_table' $master_tables = 'SELECT COUNT(master_table), master_table'
@@ -124,6 +142,10 @@ if ($cfgRelation['pdfwork']) {
$all_tables[] = $foreign_table; $all_tables[] = $foreign_table;
} }
} }
} // endif there are master tables
} // endif auto_layout_internal
if (isset($auto_layout_internal) || isset($auto_layout_innodb)) {
// now generate the coordinates for the schema, // now generate the coordinates for the schema,
// in a clockwise spiral // in a clockwise spiral
@@ -163,11 +185,10 @@ if ($cfgRelation['pdfwork']) {
$delta *= $delta_mult; $delta *= $delta_mult;
break; break;
} // end switch } // end switch
} // end while } // end foreach
} // end if there are master tables } // end if some auto-layout to do
$chpage = $pdf_page_number; $chpage = $pdf_page_number;
} // end if isset auto_layout_internal
break; break;
@@ -236,7 +257,10 @@ if ($cfgRelation['pdfwork']) {
if ($page_rs && PMA_DBI_num_rows($page_rs) > 0) { if ($page_rs && PMA_DBI_num_rows($page_rs) > 0) {
?> ?>
<form method="get" action="pdf_pages.php" name="selpage"> <form method="get" action="pdf_pages.php" name="selpage">
<fieldset>
<legend>
<?php echo $strChoosePage . "\n"; ?> <?php echo $strChoosePage . "\n"; ?>
</legend>
<?php echo PMA_generate_common_hidden_inputs($db, $table); ?> <?php echo PMA_generate_common_hidden_inputs($db, $table); ?>
<input type="hidden" name="do" value="choosepage" /> <input type="hidden" name="do" value="choosepage" />
<select name="chpage" onchange="this.form.submit()"> <select name="chpage" onchange="this.form.submit()">
@@ -256,8 +280,8 @@ if ($cfgRelation['pdfwork']) {
<?php echo $strEdit; ?> </label> <?php echo $strEdit; ?> </label>
<input type="radio" name="action_choose" value="1" id="radio_choose1" style="vertical-align: middle" /><label for="radio_choose1"> <input type="radio" name="action_choose" value="1" id="radio_choose1" style="vertical-align: middle" /><label for="radio_choose1">
<?php echo $strDelete; ?> </label> <?php echo $strDelete; ?> </label>
<input type="submit" value="<?php echo $strGo; ?>" /><br />
<input type="submit" value="<?php echo $strGo; ?>" /><br /> </fieldset>
</form> </form>
<?php <?php
} }
@@ -266,13 +290,19 @@ if ($cfgRelation['pdfwork']) {
// Possibility to create a new page: // Possibility to create a new page:
?> ?>
<form method="post" action="pdf_pages.php" name="crpage"> <form method="post" action="pdf_pages.php" name="crpage">
<fieldset>
<legend>
<?php echo $strCreatePage . "\n"; ?> <?php echo $strCreatePage . "\n"; ?>
</legend>
<?php echo PMA_generate_common_hidden_inputs($db, $table); ?> <?php echo PMA_generate_common_hidden_inputs($db, $table); ?>
<input type="hidden" name="do" value="createpage" /> <input type="hidden" name="do" value="createpage" />
<input type="text" name="newpage" size="20" maxlength="50" /> <input type="text" name="newpage" size="20" maxlength="50" />
<input type="checkbox" name="auto_layout_internal" /> <input type="checkbox" name="auto_layout_internal" />
<?php echo '(' . $strAutomaticLayout . ' / ' . $strInternalRelations . ')' . "\n"; ?> <?php echo '(' . $strAutomaticLayout . ' / ' . $strInternalRelations . ')' . "\n"; ?>
<input type="checkbox" name="auto_layout_innodb" />
<?php echo '(' . $strAutomaticLayout . ' / InnoDB)' . "\n"; ?>
<input type="submit" value="<?php echo $strGo; ?>" /> <input type="submit" value="<?php echo $strGo; ?>" />
</fieldset>
</form> </form>
<?php <?php
// Now if we already have chosen a page number then we should show the // Now if we already have chosen a page number then we should show the