enable Relation view for InnoDB even if the internal infrastructure is not available
This commit is contained in:
@@ -450,7 +450,10 @@ if ($cfg['PropertiesIconic']) {
|
|||||||
?></a>
|
?></a>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
if ($cfg['Server']['relation']) {
|
// if internal relations are available, or the table type is INNODB
|
||||||
|
// ($tbl_type comes from tbl_properties_table_info.php)
|
||||||
|
|
||||||
|
if ($cfg['Server']['relation'] || $tbl_type=="INNODB") {
|
||||||
?>
|
?>
|
||||||
<!-- Work on Relations -->
|
<!-- Work on Relations -->
|
||||||
<a href="tbl_relation.php?<?php echo $url_query; ?>"><?php
|
<a href="tbl_relation.php?<?php echo $url_query; ?>"><?php
|
||||||
|
@@ -12,7 +12,7 @@ $url_query .= '&goto=tbl_properties.php';
|
|||||||
|
|
||||||
// Note: in tbl_properties_table_info we get and display the table comment.
|
// Note: in tbl_properties_table_info we get and display the table comment.
|
||||||
// For InnoDB, this comment contains the REFER information but any update
|
// For InnoDB, this comment contains the REFER information but any update
|
||||||
// has not been done yet (will be done in tbl_relation later).
|
// has not been done yet (will be done in tbl_relation.php later).
|
||||||
$avoid_show_comment = TRUE;
|
$avoid_show_comment = TRUE;
|
||||||
require('./tbl_properties_table_info.php');
|
require('./tbl_properties_table_info.php');
|
||||||
require_once('./libraries/relation.lib.php');
|
require_once('./libraries/relation.lib.php');
|
||||||
@@ -64,17 +64,18 @@ $cfgRelation = PMA_getRelationsParam();
|
|||||||
|
|
||||||
if ($cfgRelation['relwork']) {
|
if ($cfgRelation['relwork']) {
|
||||||
$existrel = PMA_getForeigners($db, $table, '', 'internal');
|
$existrel = PMA_getForeigners($db, $table, '', 'internal');
|
||||||
|
}
|
||||||
if ($tbl_type=='INNODB') {
|
if ($tbl_type=='INNODB') {
|
||||||
$existrel_innodb = PMA_getForeigners($db, $table, '', 'innodb');
|
$existrel_innodb = PMA_getForeigners($db, $table, '', 'innodb');
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if ($cfgRelation['displaywork']) {
|
if ($cfgRelation['displaywork']) {
|
||||||
$disp = PMA_getDisplayField($db, $table);
|
$disp = PMA_getDisplayField($db, $table);
|
||||||
}
|
}
|
||||||
if ($cfgRelation['relwork']
|
|
||||||
&& isset($submit_rel) && $submit_rel == 'true') {
|
|
||||||
|
|
||||||
|
// updates for internal relations or innodb?
|
||||||
|
if (isset($submit_rel) && $submit_rel == 'true') {
|
||||||
// u p d a t e s f o r I n t e r n a l r e l a t i o n s
|
// u p d a t e s f o r I n t e r n a l r e l a t i o n s
|
||||||
|
if ($cfgRelation['relwork']) {
|
||||||
|
|
||||||
foreach ($destination AS $master_field => $foreign_string) {
|
foreach ($destination AS $master_field => $foreign_string) {
|
||||||
if ($foreign_string != 'nix') {
|
if ($foreign_string != 'nix') {
|
||||||
@@ -109,10 +110,10 @@ if ($cfgRelation['relwork']
|
|||||||
unset($upd_query);
|
unset($upd_query);
|
||||||
}
|
}
|
||||||
} // end while
|
} // end while
|
||||||
|
} // end if (updates for internal relations)
|
||||||
|
|
||||||
// u p d a t e s f o r I n n o D B
|
// u p d a t e s f o r I n n o D B
|
||||||
// ( for now, one index name; we keep the definitions if the
|
// ( for now, one index name only; we keep the definitions if the
|
||||||
// foreign db is not the same)
|
// foreign db is not the same)
|
||||||
if (isset($destination_innodb)) {
|
if (isset($destination_innodb)) {
|
||||||
foreach ($destination_innodb AS $master_field => $foreign_string) {
|
foreach ($destination_innodb AS $master_field => $foreign_string) {
|
||||||
@@ -197,7 +198,7 @@ if ($cfgRelation['relwork']
|
|||||||
} // end while
|
} // end while
|
||||||
} // end if isset($destination_innodb)
|
} // end if isset($destination_innodb)
|
||||||
|
|
||||||
} // end if
|
} // end if (updates for internal relations or InnoDB)
|
||||||
|
|
||||||
|
|
||||||
// U p d a t e s f o r d i s p l a y f i e l d
|
// U p d a t e s f o r d i s p l a y f i e l d
|
||||||
@@ -239,9 +240,10 @@ if ($cfgRelation['commwork']
|
|||||||
} // end if (commwork)
|
} // end if (commwork)
|
||||||
|
|
||||||
// If we did an update, refresh our data
|
// If we did an update, refresh our data
|
||||||
if ($cfgRelation['relwork']
|
if (isset($submit_rel) && $submit_rel == 'true') {
|
||||||
&& isset($submit_rel) && $submit_rel == 'true') {
|
if ($cfgRelation['relwork']) {
|
||||||
$existrel = PMA_getForeigners($db, $table, '', 'internal');
|
$existrel = PMA_getForeigners($db, $table, '', 'internal');
|
||||||
|
}
|
||||||
if ($tbl_type=='INNODB') {
|
if ($tbl_type=='INNODB') {
|
||||||
$existrel_innodb = PMA_getForeigners($db, $table, '', 'innodb');
|
$existrel_innodb = PMA_getForeigners($db, $table, '', 'innodb');
|
||||||
}
|
}
|
||||||
@@ -257,7 +259,7 @@ if ($cfgRelation['commwork']) {
|
|||||||
/**
|
/**
|
||||||
* Dialog
|
* Dialog
|
||||||
*/
|
*/
|
||||||
if ($cfgRelation['relwork']) {
|
if ($cfgRelation['relwork'] || $tbl_type=='INNODB') {
|
||||||
|
|
||||||
// To choose relations we first need all tables names in current db
|
// To choose relations we first need all tables names in current db
|
||||||
// and if PMA version permits and the main table is innodb,
|
// and if PMA version permits and the main table is innodb,
|
||||||
@@ -360,12 +362,15 @@ if ($col_rs && PMA_DBI_num_rows($col_rs) > 0) {
|
|||||||
<th colspan="<?php echo $tbl_type=='INNODB' ? '4' : '2'; ?>" align="center" class="tblHeaders"><b><?php echo $strLinksTo; ?></b></th>
|
<th colspan="<?php echo $tbl_type=='INNODB' ? '4' : '2'; ?>" align="center" class="tblHeaders"><b><?php echo $strLinksTo; ?></b></th>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th></th><th><b><?php echo $strInternalRelations;
|
<th></th>
|
||||||
|
<?php
|
||||||
|
if ($cfgRelation['relwork']) {
|
||||||
|
echo ' <th><b>' .$strInternalRelations;
|
||||||
if ($tbl_type=='INNODB') {
|
if ($tbl_type=='INNODB') {
|
||||||
echo ' (*)';
|
echo ' (*)';
|
||||||
}
|
}
|
||||||
?></b></th>
|
echo '</b></th>';
|
||||||
<?php
|
}
|
||||||
if ($tbl_type=='INNODB') {
|
if ($tbl_type=='INNODB') {
|
||||||
echo '<th colspan="2">InnoDB';
|
echo '<th colspan="2">InnoDB';
|
||||||
if (PMA_MYSQL_INT_VERSION < 40013) {
|
if (PMA_MYSQL_INT_VERSION < 40013) {
|
||||||
@@ -382,6 +387,9 @@ if ($col_rs && PMA_DBI_num_rows($col_rs) > 0) {
|
|||||||
?>
|
?>
|
||||||
<tr>
|
<tr>
|
||||||
<td align="center" bgcolor="<?php echo ($i % 2) ? $GLOBALS['cfg']['BgcolorOne'] : $GLOBALS['cfg']['BgcolorTwo']; ?>"><b><?php echo $save_row[$i]['Field']; ?></b></td>
|
<td align="center" bgcolor="<?php echo ($i % 2) ? $GLOBALS['cfg']['BgcolorOne'] : $GLOBALS['cfg']['BgcolorTwo']; ?>"><b><?php echo $save_row[$i]['Field']; ?></b></td>
|
||||||
|
<?php
|
||||||
|
if ($cfgRelation['relwork']) {
|
||||||
|
?>
|
||||||
<td bgcolor="<?php echo ($i % 2) ? $GLOBALS['cfg']['BgcolorOne'] : $GLOBALS['cfg']['BgcolorTwo']; ?>">
|
<td bgcolor="<?php echo ($i % 2) ? $GLOBALS['cfg']['BgcolorOne'] : $GLOBALS['cfg']['BgcolorTwo']; ?>">
|
||||||
<select name="destination[<?php echo htmlspecialchars($save_row[$i]['Field']); ?>]">
|
<select name="destination[<?php echo htmlspecialchars($save_row[$i]['Field']); ?>]">
|
||||||
<?php
|
<?php
|
||||||
@@ -419,6 +427,8 @@ if ($col_rs && PMA_DBI_num_rows($col_rs) > 0) {
|
|||||||
</select>
|
</select>
|
||||||
</td>
|
</td>
|
||||||
<?php
|
<?php
|
||||||
|
} // end if (internal relations)
|
||||||
|
|
||||||
if ($tbl_type=='INNODB') {
|
if ($tbl_type=='INNODB') {
|
||||||
?>
|
?>
|
||||||
<td bgcolor="<?php echo ($i % 2) ? $GLOBALS['cfg']['BgcolorOne'] : $GLOBALS['cfg']['BgcolorTwo']; ?>">
|
<td bgcolor="<?php echo ($i % 2) ? $GLOBALS['cfg']['BgcolorOne'] : $GLOBALS['cfg']['BgcolorTwo']; ?>">
|
||||||
@@ -486,7 +496,9 @@ if ($col_rs && PMA_DBI_num_rows($col_rs) > 0) {
|
|||||||
</table>
|
</table>
|
||||||
<?php
|
<?php
|
||||||
if ($tbl_type=='INNODB') {
|
if ($tbl_type=='INNODB') {
|
||||||
|
if ($cfgRelation['relwork']) {
|
||||||
echo $strInternalNotNecessary . '<br />';
|
echo $strInternalNotNecessary . '<br />';
|
||||||
|
}
|
||||||
if (PMA_MYSQL_INT_VERSION < 40013) {
|
if (PMA_MYSQL_INT_VERSION < 40013) {
|
||||||
echo '** ' . sprintf($strUpgrade, 'MySQL', '4.0.13') . '<br />';
|
echo '** ' . sprintf($strUpgrade, 'MySQL', '4.0.13') . '<br />';
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user