Views
This commit is contained in:
@@ -5,6 +5,11 @@ phpMyAdmin - Changelog
|
|||||||
$Id$
|
$Id$
|
||||||
$Source$
|
$Source$
|
||||||
|
|
||||||
|
2005-01-12 Alexander M. Turek <me@derrabus.de>
|
||||||
|
* tbl_properties_table_info.inc.php: Basic view detection.
|
||||||
|
* tbl_properties_structure.php: Disabled table-specific interface elements
|
||||||
|
for views.
|
||||||
|
|
||||||
2005-01-11 Alexander M. Turek <me@derrabus.de>
|
2005-01-11 Alexander M. Turek <me@derrabus.de>
|
||||||
* libraries/relation.lib.php:
|
* libraries/relation.lib.php:
|
||||||
- Removed redundant code;
|
- Removed redundant code;
|
||||||
|
@@ -95,7 +95,7 @@ $i = 0;
|
|||||||
<?php echo PMA_generate_common_hidden_inputs($db, $table); ?>
|
<?php echo PMA_generate_common_hidden_inputs($db, $table); ?>
|
||||||
<table border="<?php echo $cfg['Border']; ?>" cellpadding="2" cellspacing="1">
|
<table border="<?php echo $cfg['Border']; ?>" cellpadding="2" cellspacing="1">
|
||||||
<tr>
|
<tr>
|
||||||
<th id="th<?php echo ++$i; ?>"> </th>
|
<?php echo $tbl_is_view ? '' : ' <th id="th' . ++$i . '"> </th>' . "\n"; ?>
|
||||||
<th id="th<?php echo ++$i; ?>"> <?php echo $strField; ?> </th>
|
<th id="th<?php echo ++$i; ?>"> <?php echo $strField; ?> </th>
|
||||||
<th id="th<?php echo ++$i; ?>"><?php echo $strType; ?></th>
|
<th id="th<?php echo ++$i; ?>"><?php echo $strType; ?></th>
|
||||||
<?php echo PMA_MYSQL_INT_VERSION >= 40100 ? ' <th id="th' . ++$i . '">' . $strCollation . '</th>' . "\n" : ''; ?>
|
<?php echo PMA_MYSQL_INT_VERSION >= 40100 ? ' <th id="th' . ++$i . '">' . $strCollation . '</th>' . "\n" : ''; ?>
|
||||||
@@ -103,7 +103,7 @@ $i = 0;
|
|||||||
<th id="th<?php echo ++$i; ?>"><?php echo $strNull; ?></th>
|
<th id="th<?php echo ++$i; ?>"><?php echo $strNull; ?></th>
|
||||||
<th id="th<?php echo ++$i; ?>"><?php echo $strDefault; ?></th>
|
<th id="th<?php echo ++$i; ?>"><?php echo $strDefault; ?></th>
|
||||||
<th id="th<?php echo ++$i; ?>"><?php echo $strExtra; ?></th>
|
<th id="th<?php echo ++$i; ?>"><?php echo $strExtra; ?></th>
|
||||||
<th colspan="6" id="th<?php echo ++$i; ?>"><?php echo $strAction; ?></th>
|
<?php echo $tbl_is_view ? '' : ' <th colspan="6" id="th' . ++$i . '">' . $strAction . '</th>' . "\n"; ?>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
@@ -302,9 +302,15 @@ while ($row = PMA_DBI_fetch_assoc($fields_rs)) {
|
|||||||
|
|
||||||
?>
|
?>
|
||||||
<tr <?php echo $on_mouse; ?>>
|
<tr <?php echo $on_mouse; ?>>
|
||||||
|
<?php
|
||||||
|
if (!$tbl_is_view) {
|
||||||
|
?>
|
||||||
<td align="center" bgcolor="<?php echo $bgcolor; ?>">
|
<td align="center" bgcolor="<?php echo $bgcolor; ?>">
|
||||||
<input type="checkbox" name="selected_fld[]" value="<?php echo $field_encoded; ?>" id="checkbox_row_<?php echo $i; ?>" <?php echo $checked; ?> />
|
<input type="checkbox" name="selected_fld[]" value="<?php echo $field_encoded; ?>" id="checkbox_row_<?php echo $i; ?>" <?php echo $checked; ?> />
|
||||||
</td>
|
</td>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
<td <?php echo $click_mouse; ?> bgcolor="<?php echo $bgcolor; ?>" nowrap="nowrap"> <label onclick="return (document.getElementById('checkbox_row_<?php echo $i; ?>') ? false : true)" for="checkbox_row_<?php echo $i; ?>"><?php echo $field_name; ?></label> </td>
|
<td <?php echo $click_mouse; ?> bgcolor="<?php echo $bgcolor; ?>" nowrap="nowrap"> <label onclick="return (document.getElementById('checkbox_row_<?php echo $i; ?>') ? false : true)" for="checkbox_row_<?php echo $i; ?>"><?php echo $field_name; ?></label> </td>
|
||||||
<td <?php echo $click_mouse; ?> bgcolor="<?php echo $bgcolor; ?>"<?php echo $type_nowrap; ?>><?php echo $type; echo $type_mime; ?><bdo dir="ltr"></bdo></td>
|
<td <?php echo $click_mouse; ?> bgcolor="<?php echo $bgcolor; ?>"<?php echo $type_nowrap; ?>><?php echo $type; echo $type_mime; ?><bdo dir="ltr"></bdo></td>
|
||||||
<?php echo PMA_MYSQL_INT_VERSION >= 40100 ? ' <td bgcolor="' . $bgcolor . '" ' . $click_mouse . '>' . (empty($field_charset) ? ' ' : '<dfn title="' . PMA_getCollationDescr($field_charset) . '">' . $field_charset . '</dfn>') . '</td>' . "\n" : '' ?>
|
<?php echo PMA_MYSQL_INT_VERSION >= 40100 ? ' <td bgcolor="' . $bgcolor . '" ' . $click_mouse . '>' . (empty($field_charset) ? ' ' : '<dfn title="' . PMA_getCollationDescr($field_charset) . '">' . $field_charset . '</dfn>') . '</td>' . "\n" : '' ?>
|
||||||
@@ -312,6 +318,9 @@ while ($row = PMA_DBI_fetch_assoc($fields_rs)) {
|
|||||||
<td <?php echo $click_mouse; ?> bgcolor="<?php echo $bgcolor; ?>"><?php echo (($row['Null'] == '') ? $strNo : $strYes); ?> </td>
|
<td <?php echo $click_mouse; ?> bgcolor="<?php echo $bgcolor; ?>"><?php echo (($row['Null'] == '') ? $strNo : $strYes); ?> </td>
|
||||||
<td <?php echo $click_mouse; ?> bgcolor="<?php echo $bgcolor; ?>" nowrap="nowrap"><?php if (isset($row['Default'])) echo $row['Default']; ?> </td>
|
<td <?php echo $click_mouse; ?> bgcolor="<?php echo $bgcolor; ?>" nowrap="nowrap"><?php if (isset($row['Default'])) echo $row['Default']; ?> </td>
|
||||||
<td <?php echo $click_mouse; ?> bgcolor="<?php echo $bgcolor; ?>" nowrap="nowrap"><?php echo $row['Extra']; ?> </td>
|
<td <?php echo $click_mouse; ?> bgcolor="<?php echo $bgcolor; ?>" nowrap="nowrap"><?php echo $row['Extra']; ?> </td>
|
||||||
|
<?php
|
||||||
|
if (!$tbl_is_view) {
|
||||||
|
?>
|
||||||
<td align="center" bgcolor="<?php echo $bgcolor; ?>">
|
<td align="center" bgcolor="<?php echo $bgcolor; ?>">
|
||||||
<a href="tbl_alter.php?<?php echo $url_query; ?>&field=<?php echo $field_encoded; ?>">
|
<a href="tbl_alter.php?<?php echo $url_query; ?>&field=<?php echo $field_encoded; ?>">
|
||||||
<?php echo $titles['Change']; ?></a>
|
<?php echo $titles['Change']; ?></a>
|
||||||
@@ -393,7 +402,8 @@ while ($row = PMA_DBI_fetch_assoc($fields_rs)) {
|
|||||||
</td>
|
</td>
|
||||||
<?php
|
<?php
|
||||||
} // end if... else...
|
} // end if... else...
|
||||||
echo "\n"
|
echo "\n";
|
||||||
|
} // end if (!$tbl_is_view)
|
||||||
?>
|
?>
|
||||||
</tr>
|
</tr>
|
||||||
<?php
|
<?php
|
||||||
@@ -402,8 +412,10 @@ while ($row = PMA_DBI_fetch_assoc($fields_rs)) {
|
|||||||
|
|
||||||
echo "\n";
|
echo "\n";
|
||||||
|
|
||||||
$checkall_url = 'tbl_properties_structure.php?' . PMA_generate_common_url($db,$table);
|
if (!$tbl_is_view) {
|
||||||
?>
|
|
||||||
|
$checkall_url = 'tbl_properties_structure.php?' . PMA_generate_common_url($db,$table);
|
||||||
|
?>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="<?php echo PMA_MYSQL_INT_VERSION >= 40100 ? '14' : '13'; ?>">
|
<td colspan="<?php echo PMA_MYSQL_INT_VERSION >= 40100 ? '14' : '13'; ?>">
|
||||||
@@ -422,7 +434,7 @@ $checkall_url = 'tbl_properties_structure.php?' . PMA_generate_common_url($db,$t
|
|||||||
<td>
|
<td>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
if ($cfg['PropertiesIconic']) {
|
if ($cfg['PropertiesIconic']) {
|
||||||
PMA_buttonOrImage('submit_mult', 'mult_submit', 'submit_mult_change', $strChange, 'b_edit.png');
|
PMA_buttonOrImage('submit_mult', 'mult_submit', 'submit_mult_change', $strChange, 'b_edit.png');
|
||||||
// Drop button if there is at least two fields
|
// Drop button if there is at least two fields
|
||||||
if ($fields_cnt > 1) {
|
if ($fields_cnt > 1) {
|
||||||
@@ -434,7 +446,7 @@ if ($cfg['PropertiesIconic']) {
|
|||||||
if ((!empty($tbl_type) && $tbl_type == 'MYISAM')) {
|
if ((!empty($tbl_type) && $tbl_type == 'MYISAM')) {
|
||||||
PMA_buttonOrImage('submit_mult', 'mult_submit', 'submit_mult_fulltext', $strIdxFulltext, 'b_ftext.png');
|
PMA_buttonOrImage('submit_mult', 'mult_submit', 'submit_mult_fulltext', $strIdxFulltext, 'b_ftext.png');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
echo '<input type="submit" name="submit_mult" value="' . $strChange . '" title="' . $strChange . '" />' . "\n";
|
echo '<input type="submit" name="submit_mult" value="' . $strChange . '" title="' . $strChange . '" />' . "\n";
|
||||||
// Drop button if there is at least two fields
|
// Drop button if there is at least two fields
|
||||||
if ($fields_cnt > 1) {
|
if ($fields_cnt > 1) {
|
||||||
@@ -451,14 +463,17 @@ if ($cfg['PropertiesIconic']) {
|
|||||||
echo ' <i>' . $strOr . '</i> ' . "\n"
|
echo ' <i>' . $strOr . '</i> ' . "\n"
|
||||||
. '<input type="submit" name="submit_mult" value="' . $strIdxFulltext . '" title="' . $strIdxFulltext . '" />' . "\n";
|
. '<input type="submit" name="submit_mult" value="' . $strIdxFulltext . '" title="' . $strIdxFulltext . '" />' . "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
</table>
|
</table>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
@@ -466,10 +481,11 @@ if ($cfg['PropertiesIconic']) {
|
|||||||
|
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
/**
|
if (!$tbl_is_view) {
|
||||||
|
/**
|
||||||
* Work on the table
|
* Work on the table
|
||||||
*/
|
*/
|
||||||
?>
|
?>
|
||||||
<!-- TABLE WORK -->
|
<!-- TABLE WORK -->
|
||||||
<!-- Printable view of the table -->
|
<!-- Printable view of the table -->
|
||||||
<a href="tbl_printview.php?<?php echo $url_query; ?>"><?php
|
<a href="tbl_printview.php?<?php echo $url_query; ?>"><?php
|
||||||
@@ -479,12 +495,12 @@ if ($cfg['PropertiesIconic']) {
|
|||||||
echo $strPrintView;
|
echo $strPrintView;
|
||||||
?></a>
|
?></a>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
// if internal relations are available, or the table type is INNODB
|
// if internal relations are available, or the table type is INNODB
|
||||||
// ($tbl_type comes from tbl_properties_table_info.php)
|
// ($tbl_type comes from tbl_properties_table_info.php)
|
||||||
|
|
||||||
if ($cfg['Server']['relation'] || $tbl_type=="INNODB") {
|
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
|
||||||
if ($cfg['PropertiesIconic']) {
|
if ($cfg['PropertiesIconic']) {
|
||||||
@@ -492,9 +508,9 @@ if ($cfg['Server']['relation'] || $tbl_type=="INNODB") {
|
|||||||
}
|
}
|
||||||
echo $strRelationView;
|
echo $strRelationView;
|
||||||
?></a>
|
?></a>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<!-- Let MySQL propose the optimal structure -->
|
<!-- Let MySQL propose the optimal structure -->
|
||||||
<a href="sql.php?<?php echo $url_query; ?>&session_max_rows=all&sql_query=<?php echo urlencode('SELECT * FROM ' . PMA_backquote($table) . ' PROCEDURE ANALYSE()'); ?>"><?php
|
<a href="sql.php?<?php echo $url_query; ?>&session_max_rows=all&sql_query=<?php echo urlencode('SELECT * FROM ' . PMA_backquote($table) . ' PROCEDURE ANALYSE()'); ?>"><?php
|
||||||
if ($cfg['PropertiesIconic']) {
|
if ($cfg['PropertiesIconic']) {
|
||||||
@@ -530,7 +546,9 @@ if ($cfg['Server']['relation'] || $tbl_type=="INNODB") {
|
|||||||
|
|
||||||
<hr />
|
<hr />
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If there are more than 20 rows, displays browse/select/insert/empty/drop
|
* If there are more than 20 rows, displays browse/select/insert/empty/drop
|
||||||
* links again
|
* links again
|
||||||
@@ -545,29 +563,30 @@ if ($fields_cnt > 20) {
|
|||||||
echo "\n\n";
|
echo "\n\n";
|
||||||
|
|
||||||
|
|
||||||
/**
|
if (!$tbl_is_view) {
|
||||||
|
/**
|
||||||
* Displays indexes
|
* Displays indexes
|
||||||
*/
|
*/
|
||||||
?>
|
?>
|
||||||
<!-- Indexes, space usage and row statistics -->
|
<!-- Indexes, space usage and row statistics -->
|
||||||
<table border="0" cellspacing="0" cellpadding="0">
|
<table border="0" cellspacing="0" cellpadding="0">
|
||||||
<tr>
|
<tr>
|
||||||
<td valign="top">
|
<td valign="top">
|
||||||
<?php
|
<?php
|
||||||
define('PMA_IDX_INCLUDED', 1);
|
define('PMA_IDX_INCLUDED', 1);
|
||||||
require ('./tbl_indexes.php');
|
require ('./tbl_indexes.php');
|
||||||
?>
|
?>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* Displays Space usage and row statistics
|
* Displays Space usage and row statistics
|
||||||
*/
|
*/
|
||||||
// BEGIN - Calc Table Space - staybyte - 9 June 2001
|
// BEGIN - Calc Table Space - staybyte - 9 June 2001
|
||||||
// loic1, 22 feb. 2002: updated with patch from
|
// loic1, 22 feb. 2002: updated with patch from
|
||||||
// Joshua Nye <josh at boxcarmedia.com> to get valid
|
// Joshua Nye <josh at boxcarmedia.com> to get valid
|
||||||
// statistics whatever is the table type
|
// statistics whatever is the table type
|
||||||
if ($cfg['ShowStats']) {
|
if ($cfg['ShowStats']) {
|
||||||
$nonisam = FALSE;
|
$nonisam = FALSE;
|
||||||
$is_innodb = (isset($showtable['Type']) && $showtable['Type'] == 'InnoDB');
|
$is_innodb = (isset($showtable['Type']) && $showtable['Type'] == 'InnoDB');
|
||||||
if (isset($showtable['Type']) && !preg_match('@ISAM|HEAP@i', $showtable['Type'])) {
|
if (isset($showtable['Type']) && !preg_match('@ISAM|HEAP@i', $showtable['Type'])) {
|
||||||
@@ -704,7 +723,7 @@ if ($cfg['ShowStats']) {
|
|||||||
</tr>
|
</tr>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
if (PMA_MYSQL_INT_VERSION >= 40100) {
|
if (PMA_MYSQL_INT_VERSION >= 40100 && !empty($tbl_collation)) {
|
||||||
$bgcolor = ((++$i%2) ? $cfg['BgcolorTwo'] : $cfg['BgcolorOne']);
|
$bgcolor = ((++$i%2) ? $cfg['BgcolorTwo'] : $cfg['BgcolorOne']);
|
||||||
?>
|
?>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -813,14 +832,16 @@ if ($cfg['ShowStats']) {
|
|||||||
</td>
|
</td>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// END - Calc Table Space
|
// END - Calc Table Space
|
||||||
echo "\n";
|
echo "\n";
|
||||||
?>
|
?>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
<hr />
|
<hr />
|
||||||
<?php
|
<?php
|
||||||
|
} // end if (!$tbl_is_view)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Query box, bookmark, insert data from textfile
|
* Query box, bookmark, insert data from textfile
|
||||||
*/
|
*/
|
||||||
|
@@ -20,10 +20,17 @@ $showtable = PMA_DBI_fetch_assoc($table_info_result);
|
|||||||
if (!isset($showtable['Type']) && isset($showtable['Engine'])) {
|
if (!isset($showtable['Type']) && isset($showtable['Engine'])) {
|
||||||
$showtable['Type'] =& $showtable['Engine'];
|
$showtable['Type'] =& $showtable['Engine'];
|
||||||
}
|
}
|
||||||
$tbl_type = isset($showtable['Type']) ? strtoupper($showtable['Type']) : '';
|
if (PMA_MYSQL_INT_VERSION >= 50000 && !isset($showtable['Type']) && isset($showtable['Comment']) && $showtable['Comment'] == 'view') {
|
||||||
|
$tbl_is_view = TRUE;
|
||||||
|
$tbl_type = $strView;
|
||||||
|
$show_comment = NULL;
|
||||||
|
} else {
|
||||||
|
$tbl_is_view = FALSE;
|
||||||
|
$tbl_type = isset($showtable['Type']) ? strtoupper($showtable['Type']) : '';
|
||||||
|
$show_comment = (isset($showtable['Comment']) ? $showtable['Comment'] : '');
|
||||||
|
}
|
||||||
$tbl_collation = empty($showtable['Collation']) ? '' : $showtable['Collation'];
|
$tbl_collation = empty($showtable['Collation']) ? '' : $showtable['Collation'];
|
||||||
$table_info_num_rows = (isset($showtable['Rows']) ? $showtable['Rows'] : 0);
|
$table_info_num_rows = (isset($showtable['Rows']) ? $showtable['Rows'] : 0);
|
||||||
$show_comment = (isset($showtable['Comment']) ? $showtable['Comment'] : '');
|
|
||||||
$auto_increment = (isset($showtable['Auto_increment']) ? $showtable['Auto_increment'] : '');
|
$auto_increment = (isset($showtable['Auto_increment']) ? $showtable['Auto_increment'] : '');
|
||||||
|
|
||||||
$tmp = isset($showtable['Create_options']) ? explode(' ', $showtable['Create_options']) : array();
|
$tmp = isset($showtable['Create_options']) ? explode(' ', $showtable['Create_options']) : array();
|
||||||
@@ -34,6 +41,6 @@ for ($i = 0; $i < $tmp_cnt; $i++) {
|
|||||||
$$tmp1[0] = $tmp1[1];
|
$$tmp1[0] = $tmp1[1];
|
||||||
}
|
}
|
||||||
} // end for
|
} // end for
|
||||||
unset($tmp1, $tmp);
|
|
||||||
PMA_DBI_free_result($table_info_result);
|
PMA_DBI_free_result($table_info_result);
|
||||||
|
unset($tmp1, $tmp, $table_info_result);
|
||||||
?>
|
?>
|
||||||
|
Reference in New Issue
Block a user