Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 986 lines (906 sloc) 40.963 kb
6f03a58 Marc Delisle new
lem9 authored
1 <?php
817e790 synced/fixed vim line
Sebastian Mendel authored
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
374abd5 fixed/added page level docblock
Sebastian Mendel authored
3 /**
a73ffff fixed notice;
Sebastian Mendel authored
4 * Displays table structure infos like fields/columns, indexes, size, rows
5 * and allows manipulation of indexes and columns/fields
84ae042 Michal Čihař Adding @package, third part.
nijel authored
6 * @package phpMyAdmin
374abd5 fixed/added page level docblock
Sebastian Mendel authored
7 */
6f03a58 Marc Delisle new
lem9 authored
8
374abd5 fixed/added page level docblock
Sebastian Mendel authored
9 /**
10 *
11 */
d0facc3 splitted common.lib.php into common.inc.php, core.lib.php and common.lib...
Sebastian Mendel authored
12 require_once './libraries/common.inc.php';
d69c350 - fixed bug #1420474 'Consistency (order of truncate/drop)'
Sebastian Mendel authored
13 require_once './libraries/mysql_charsets.lib.php';
1a96a31 Marc Delisle more complete check before showing Relation View
lem9 authored
14
c2de4dd Michal Čihař Add full uncompressed version of jquery ui.
nijel authored
15 $GLOBALS['js_include'][] = 'jquery/jquery-ui-1.8.custom.js';
bbb94f6 Created a new js file for the tbl_structure.php page and moved jQuery sc...
ninadsp authored
16 $GLOBALS['js_include'][] = 'tbl_structure.js';
2a6119d Marc Delisle start to use Mootools for slider effects
lem9 authored
17
1a96a31 Marc Delisle more complete check before showing Relation View
lem9 authored
18 /**
2a6119d Marc Delisle start to use Mootools for slider effects
lem9 authored
19 * handle multiple field commands if required
a73ffff fixed notice;
Sebastian Mendel authored
20 *
21 * submit_mult_*_x comes from IE if <input type="img" ...> is used
6f03a58 Marc Delisle new
lem9 authored
22 */
a73ffff fixed notice;
Sebastian Mendel authored
23 if (isset($_REQUEST['submit_mult_change_x'])) {
0e63bd0 Michal Čihař Fix multi submits for MSIE with <input type="image"..
nijel authored
24 $submit_mult = 'change';
a73ffff fixed notice;
Sebastian Mendel authored
25 } elseif (isset($_REQUEST['submit_mult_drop_x'])) {
0e63bd0 Michal Čihař Fix multi submits for MSIE with <input type="image"..
nijel authored
26 $submit_mult = 'drop';
a73ffff fixed notice;
Sebastian Mendel authored
27 } elseif (isset($_REQUEST['submit_mult_primary_x'])) {
0e63bd0 Michal Čihař Fix multi submits for MSIE with <input type="image"..
nijel authored
28 $submit_mult = 'primary';
a73ffff fixed notice;
Sebastian Mendel authored
29 } elseif (isset($_REQUEST['submit_mult_index_x'])) {
0e63bd0 Michal Čihař Fix multi submits for MSIE with <input type="image"..
nijel authored
30 $submit_mult = 'index';
a73ffff fixed notice;
Sebastian Mendel authored
31 } elseif (isset($_REQUEST['submit_mult_unique_x'])) {
0e63bd0 Michal Čihař Fix multi submits for MSIE with <input type="image"..
nijel authored
32 $submit_mult = 'unique';
f2569ac Madhura Jayaratne Spatial indexes added.
madhuracj authored
33 } elseif (isset($_REQUEST['submit_mult_spatial_x'])) {
34 $submit_mult = 'spatial';
a73ffff fixed notice;
Sebastian Mendel authored
35 } elseif (isset($_REQUEST['submit_mult_fulltext_x'])) {
0e63bd0 Michal Čihař Fix multi submits for MSIE with <input type="image"..
nijel authored
36 $submit_mult = 'ftext';
a73ffff fixed notice;
Sebastian Mendel authored
37 } elseif (isset($_REQUEST['submit_mult_browse_x'])) {
0e63bd0 Michal Čihař Fix multi submits for MSIE with <input type="image"..
nijel authored
38 $submit_mult = 'browse';
a73ffff fixed notice;
Sebastian Mendel authored
39 } elseif (isset($_REQUEST['submit_mult'])) {
40 $submit_mult = $_REQUEST['submit_mult'];
f55823f Marc Delisle strings to gettext, first batch
lem9 authored
41 } elseif (isset($_REQUEST['mult_btn']) && $_REQUEST['mult_btn'] == __('Yes')) {
a73ffff fixed notice;
Sebastian Mendel authored
42 $submit_mult = 'row_delete';
43 if (isset($_REQUEST['selected'])) {
44 $_REQUEST['selected_fld'] = $_REQUEST['selected'];
45 }
6f6abb0 Marc Delisle bug 786710
lem9 authored
46 }
47
a73ffff fixed notice;
Sebastian Mendel authored
48 if (! empty($submit_mult) && isset($_REQUEST['selected_fld'])) {
ad06b4a Michal Čihař Rename tbl_* files to drop useless _properties part.
nijel authored
49 $err_url = 'tbl_structure.php?' . PMA_generate_common_url($db, $table);
0e63bd0 Michal Čihař Fix multi submits for MSIE with <input type="image"..
nijel authored
50 if ($submit_mult == 'browse') {
a73ffff fixed notice;
Sebastian Mendel authored
51 // browsing the table displaying only selected fields/columns
a375c17 better handling for 'view distinct' from table structure page
Sebastian Mendel authored
52 $GLOBALS['active_page'] = 'sql.php';
53 $sql_query = '';
54 foreach ($_REQUEST['selected_fld'] as $idx => $sval) {
55 if ($sql_query == '') {
56 $sql_query .= 'SELECT ' . PMA_backquote($sval);
57 } else {
58 $sql_query .= ', ' . PMA_backquote($sval);
59 }
60 }
61
62 // what is this htmlspecialchars() for??
63 //$sql_query .= ' FROM ' . PMA_backquote(htmlspecialchars($table));
a73ffff fixed notice;
Sebastian Mendel authored
64 $sql_query .= ' FROM ' . PMA_backquote($db) . '.' . PMA_backquote($table);
a375c17 better handling for 'view distinct' from table structure page
Sebastian Mendel authored
65 require './sql.php';
a73ffff fixed notice;
Sebastian Mendel authored
66 exit;
a375c17 better handling for 'view distinct' from table structure page
Sebastian Mendel authored
67 } else {
a73ffff fixed notice;
Sebastian Mendel authored
68 // handle multiple field commands
69 // handle confirmation of deleting multiple fields/columns
a375c17 better handling for 'view distinct' from table structure page
Sebastian Mendel authored
70 $action = 'tbl_structure.php';
71 require './libraries/mult_submits.inc.php';
a73ffff fixed notice;
Sebastian Mendel authored
72 //require_once './libraries/header.inc.php';
73 //require_once './libraries/tbl_links.inc.php';
74
10130dd do not sometimes silently prevent dropping of last column(s) - but alway...
Sebastian Mendel authored
75 if (empty($message)) {
76 $message = PMA_Message::success();
77 }
a375c17 better handling for 'view distinct' from table structure page
Sebastian Mendel authored
78 }
6f03a58 Marc Delisle new
lem9 authored
79 }
80
9d24001 Michal Čihař Show result of CHECK/OPTIMIZE/REPAIR queries for multiple tables.
nijel authored
81 /**
a73ffff fixed notice;
Sebastian Mendel authored
82 * Gets the relation settings
83 */
84 $cfgRelation = PMA_getRelationsParam();
85
86 /**
9d24001 Michal Čihař Show result of CHECK/OPTIMIZE/REPAIR queries for multiple tables.
nijel authored
87 * Runs common work
88 */
ad06b4a Michal Čihař Rename tbl_* files to drop useless _properties part.
nijel authored
89 require_once './libraries/tbl_common.php';
90 $url_query .= '&amp;goto=tbl_structure.php&amp;back=tbl_structure.php';
4dea5b6 new Class PMA_Index;
Sebastian Mendel authored
91 $url_params['goto'] = 'tbl_structure.php';
92 $url_params['back'] = 'tbl_structure.php';
9d24001 Michal Čihař Show result of CHECK/OPTIMIZE/REPAIR queries for multiple tables.
nijel authored
93
6f03a58 Marc Delisle new
lem9 authored
94 /**
95 * Prepares the table structure display
96 */
3f258cf Michal Čihař Cleanup of message displaying and navigation reloading.
nijel authored
97
a73ffff fixed notice;
Sebastian Mendel authored
98
3f258cf Michal Čihař Cleanup of message displaying and navigation reloading.
nijel authored
99 /**
100 * Gets tables informations
101 */
ad06b4a Michal Čihař Rename tbl_* files to drop useless _properties part.
nijel authored
102 require_once './libraries/tbl_info.inc.php';
6f03a58 Marc Delisle new
lem9 authored
103
44ebf6e Michal Čihař Show multi submits result after headers and tabs from originating place.
nijel authored
104 /**
3f258cf Michal Čihař Cleanup of message displaying and navigation reloading.
nijel authored
105 * Displays top menu links
106 */
ad06b4a Michal Čihař Rename tbl_* files to drop useless _properties part.
nijel authored
107 require_once './libraries/tbl_links.inc.php';
4dea5b6 new Class PMA_Index;
Sebastian Mendel authored
108 require_once './libraries/Index.class.php';
3f258cf Michal Čihař Cleanup of message displaying and navigation reloading.
nijel authored
109
6f03a58 Marc Delisle new
lem9 authored
110 // 2. Gets table keys and retains them
4dea5b6 new Class PMA_Index;
Sebastian Mendel authored
111 // @todo should be: $server->db($db)->table($table)->primary()
112 $primary = PMA_Index::getPrimary($table, $db);
113
be348f6 Marc Delisle rfe #854911 [interface] Grey out non applicable actions in structure
lem9 authored
114 $columns_with_unique_index = array();
115 foreach (PMA_Index::getFromTable($table, $db) as $index) {
116 if ($index->isUnique() && $index->getChoice() == 'UNIQUE') {
117 $columns = $index->getColumns();
118 foreach ($columns as $column_name => $dummy) {
119 $columns_with_unique_index[$column_name] = 1;
a2a0d9b Michal Čihař Avoid multiple loading of jQuery.
nijel authored
120 }
be348f6 Marc Delisle rfe #854911 [interface] Grey out non applicable actions in structure
lem9 authored
121 }
122 }
123 unset($index, $columns, $column_name, $dummy);
6f03a58 Marc Delisle new
lem9 authored
124
125 // 3. Get fields
5afcef0 Azhari Harahap (Drizzle) Listing/change table structure small fix
back2arie authored
126 $fields_rs = PMA_DRIZZLE
f2569ac Madhura Jayaratne Spatial indexes added.
madhuracj authored
127 ? PMA_DBI_query('SHOW COLUMNS FROM ' . PMA_backquote($table) . ';', null, PMA_DBI_QUERY_STORE)
128 : PMA_DBI_query('SHOW FULL FIELDS FROM ' . PMA_backquote($table) . ';', null, PMA_DBI_QUERY_STORE);
28a5d04 Marc Delisle PMA_DBI_num_rows
lem9 authored
129 $fields_cnt = PMA_DBI_num_rows($fields_rs);
6f03a58 Marc Delisle new
lem9 authored
130
de39a0d Marc Delisle start merging code for MySQL 4.1.2 TIMESTAMPs
lem9 authored
131 // Get more complete field information
132 // For now, this is done just for MySQL 4.1.2+ new TIMESTAMP options
133 // but later, if the analyser returns more information, it
134 // could be executed for any MySQL version and replace
b8b9334 Marc Delisle experimental support in table structure editing for MySQL 4.1.2+ TIMESTA...
lem9 authored
135 // the info given by SHOW FULL FIELDS FROM.
6d4db42 Marc Delisle bug #1320470, timestamp is not shown as being NULL under MySQL < 4.1.x
lem9 authored
136 //
137 // We also need this to correctly learn if a TIMESTAMP is NOT NULL, since
75f072b Marc Delisle comment timestamp NULL bug
lem9 authored
138 // SHOW FULL FIELDS or INFORMATION_SCHEMA incorrectly says NULL
139 // and SHOW CREATE TABLE says NOT NULL (tested
d38542b Marc Delisle bug shortcut, thanks Sebastian
lem9 authored
140 // in MySQL 4.0.25 and 5.0.21, http://bugs.mysql.com/20910).
6d4db42 Marc Delisle bug #1320470, timestamp is not shown as being NULL under MySQL < 4.1.x
lem9 authored
141
5760c8f Marc Delisle no need to check the version
lem9 authored
142 $show_create_table = PMA_DBI_fetch_value(
64bd56d Michal Čihař Support for browsing selected columns (RFE #1275909).
nijel authored
143 'SHOW CREATE TABLE ' . PMA_backquote($db) . '.' . PMA_backquote($table),
d69c350 - fixed bug #1420474 'Consistency (order of truncate/drop)'
Sebastian Mendel authored
144 0, 1);
145 $analyzed_sql = PMA_SQP_analyze(PMA_SQP_parse($show_create_table));
6f03a58 Marc Delisle new
lem9 authored
146
147 /**
41f8199 - added browser icon for each field (count unique values)
Sebastian Mendel authored
148 * prepare table infos
6f03a58 Marc Delisle new
lem9 authored
149 */
41f8199 - added browser icon for each field (count unique values)
Sebastian Mendel authored
150 // action titles (image or string)
151 $titles = array();
f55823f Marc Delisle strings to gettext, first batch
lem9 authored
152 $titles['Change'] = PMA_getIcon('b_edit.png', __('Change'), true);
153 $titles['Drop'] = PMA_getIcon('b_drop.png', __('Drop'), true);
154 $titles['NoDrop'] = PMA_getIcon('b_drop.png', __('Drop'), true);
155 $titles['Primary'] = PMA_getIcon('b_primary.png', __('Primary'), true);
156 $titles['Index'] = PMA_getIcon('b_index.png', __('Index'), true);
157 $titles['Unique'] = PMA_getIcon('b_unique.png', __('Unique'), true);
f2569ac Madhura Jayaratne Spatial indexes added.
madhuracj authored
158 $titles['Spatial'] = PMA_getIcon('b_ftext.png', __('Spatial'), true);
f55823f Marc Delisle strings to gettext, first batch
lem9 authored
159 $titles['IdxFulltext'] = PMA_getIcon('b_ftext.png', __('Fulltext'), true);
160 $titles['NoPrimary'] = PMA_getIcon('bd_primary.png', __('Primary'), true);
161 $titles['NoIndex'] = PMA_getIcon('bd_index.png', __('Index'), true);
162 $titles['NoUnique'] = PMA_getIcon('bd_unique.png', __('Unique'), true);
f2569ac Madhura Jayaratne Spatial indexes added.
madhuracj authored
163 $titles['NoSpatial'] = PMA_getIcon('bd_ftext.png', __('Spatial'), true);
f55823f Marc Delisle strings to gettext, first batch
lem9 authored
164 $titles['NoIdxFulltext'] = PMA_getIcon('bd_ftext.png', __('Fulltext'), true);
165 $titles['BrowseDistinctValues'] = PMA_getIcon('b_browse.png', __('Browse distinct values'), true);
6f03a58 Marc Delisle new
lem9 authored
166
9badb87 Lori Reveal-on-hover table structure actions
teekirol authored
167 // hidden action titles (image and string)
168 $hidden_titles = array();
1faaa80 Lori Fixing HTML markup
teekirol authored
169 $hidden_titles['BrowseDistinctValues'] = PMA_getIcon('b_browse.png', __('Browse distinct values'), false, true);
17b7ac6 Marc Delisle Add action verbs to More choices in Structure page
lem9 authored
170 $hidden_titles['Primary'] = PMA_getIcon('b_primary.png', __('Add primary key'), false, true);
171 $hidden_titles['NoPrimary'] = PMA_getIcon('bd_primary.png', __('Add primary key'), false, true);
172 $hidden_titles['Index'] = PMA_getIcon('b_index.png', __('Add index'), false, true);
173 $hidden_titles['NoIndex'] = PMA_getIcon('bd_index.png', __('Add index'), false, true);
174 $hidden_titles['Unique'] = PMA_getIcon('b_unique.png', __('Add unique index'), false, true);
175 $hidden_titles['NoUnique'] = PMA_getIcon('bd_unique.png', __('Add unique index'), false, true);
f2569ac Madhura Jayaratne Spatial indexes added.
madhuracj authored
176 $hidden_titles['Spatial'] = PMA_getIcon('b_ftext.png', __('Add SPATIAL index'), false, true);
177 $hidden_titles['NoSpatial'] = PMA_getIcon('bd_ftext.png', __('Add SPATIAL index'), false, true);
17b7ac6 Marc Delisle Add action verbs to More choices in Structure page
lem9 authored
178 $hidden_titles['IdxFulltext'] = PMA_getIcon('b_ftext.png', __('Add FULLTEXT index'), false, true);
179 $hidden_titles['NoIdxFulltext'] = PMA_getIcon('bd_ftext.png', __('Add FULLTEXT index'), false, true);
9badb87 Lori Reveal-on-hover table structure actions
teekirol authored
180
41f8199 - added browser icon for each field (count unique values)
Sebastian Mendel authored
181 /**
182 * Displays the table structure ('show table' works correct since 3.23.03)
183 */
184 /* TABLE INFORMATION */
185 // table header
186 $i = 0;
187 ?>
ad06b4a Michal Čihař Rename tbl_* files to drop useless _properties part.
nijel authored
188 <form method="post" action="tbl_structure.php" name="fieldsForm" id="fieldsForm">
1faaa80 Lori Fixing HTML markup
teekirol authored
189 <?php echo PMA_generate_common_hidden_inputs($db, $table);
190 echo '<input type="hidden" name="table_type" value=';
191 if($db_is_information_schema) {
192 echo '"information_schema" />';
193 } else if ($tbl_is_view) {
194 echo '"view" />';
195 } else {
196 echo '"table" />';
197 } ?>
198
41f8199 - added browser icon for each field (count unique values)
Sebastian Mendel authored
199 <table id="tablestructure" class="data">
64bd56d Michal Čihař Support for browsing selected columns (RFE #1275909).
nijel authored
200 <thead>
6f03a58 Marc Delisle new
lem9 authored
201 <tr>
41f8199 - added browser icon for each field (count unique values)
Sebastian Mendel authored
202 <th id="th<?php echo ++$i; ?>"></th>
2c8133a Michal Čihař rfe #1340812 [interface] Show numbers of columns in table structure.
nijel authored
203 <th id="th<?php echo ++$i; ?>">#</th>
8214c32 Lori Colspan should change to 3 when actions are hidden
teekirol authored
204 <th id="th<?php echo ++$i; ?>" class="column"><?php echo __('Column'); ?></th>
205 <th id="th<?php echo ++$i; ?>" class="type"><?php echo __('Type'); ?></th>
206 <th id="th<?php echo ++$i; ?>" class="collation"><?php echo __('Collation'); ?></th>
207 <th id="th<?php echo ++$i; ?>" class="attributes"><?php echo __('Attributes'); ?></th>
208 <th id="th<?php echo ++$i; ?>" class="null"><?php echo __('Null'); ?></th>
209 <th id="th<?php echo ++$i; ?>" class="default"><?php echo __('Default'); ?></th>
210 <th id="th<?php echo ++$i; ?>" class="extra"><?php echo __('Extra'); ?></th>
d69c350 - fixed bug #1420474 'Consistency (order of truncate/drop)'
Sebastian Mendel authored
211 <?php if ($db_is_information_schema || $tbl_is_view) { ?>
8214c32 Lori Colspan should change to 3 when actions are hidden
teekirol authored
212 <th id="th<?php echo ++$i; ?>" class="view"><?php echo __('View'); ?></th>
41f8199 - added browser icon for each field (count unique values)
Sebastian Mendel authored
213 <?php } else { ?>
8214c32 Lori Colspan should change to 3 when actions are hidden
teekirol authored
214 <th colspan="7" id="th<?php echo ++$i; ?>" class="action"><?php echo __('Action'); ?></th>
41f8199 - added browser icon for each field (count unique values)
Sebastian Mendel authored
215 <?php } ?>
6f03a58 Marc Delisle new
lem9 authored
216 </tr>
64bd56d Michal Čihař Support for browsing selected columns (RFE #1275909).
nijel authored
217 </thead>
218 <tbody>
64b5900 Lori Fixing bug for when the table is a view or information_schema
teekirol authored
219
6f03a58 Marc Delisle new
lem9 authored
220 <?php
ad67746 Alexander M. Turek TH numbering
derrabus authored
221 unset($i);
41f8199 - added browser icon for each field (count unique values)
Sebastian Mendel authored
222
223 // table body
224
225 // prepare comments
30b1873 Update and display column comments in Add/Edit Fieldmode and CREATE tabl...
Garvin Hicking authored
226 $comments_map = array();
dba8ecc Display MIME types to transform any table cell. You can only choose from...
Garvin Hicking authored
227 $mime_map = array();
30b1873 Update and display column comments in Add/Edit Fieldmode and CREATE tabl...
Garvin Hicking authored
228
229 if ($GLOBALS['cfg']['ShowPropertyComments']) {
d69c350 - fixed bug #1420474 'Consistency (order of truncate/drop)'
Sebastian Mendel authored
230 require_once './libraries/transformations.lib.php';
30b1873 Update and display column comments in Add/Edit Fieldmode and CREATE tabl...
Garvin Hicking authored
231
a73ffff fixed notice;
Sebastian Mendel authored
232 //$cfgRelation = PMA_getRelationsParam();
1fb6de5 Alexander M. Turek Feature #623665, part 1
derrabus authored
233
3737060 removed MySQL < 5 code
Sebastian Mendel authored
234 $comments_map = PMA_getComments($db, $table);
1fb6de5 Alexander M. Turek Feature #623665, part 1
derrabus authored
235
3737060 removed MySQL < 5 code
Sebastian Mendel authored
236 if ($cfgRelation['mimework'] && $cfg['BrowseMIME']) {
237 $mime_map = PMA_getMIME($db, $table, true);
30b1873 Update and display column comments in Add/Edit Fieldmode and CREATE tabl...
Garvin Hicking authored
238 }
239 }
240
41f8199 - added browser icon for each field (count unique values)
Sebastian Mendel authored
241 $rownum = 0;
df4a128 "Add field" dialog moved to Structure page
Loïc Chapeaux authored
242 $aryFields = array();
99f08d6 Michal Čihař Added (un)check all for fields selection.
nijel authored
243 $checked = (!empty($checkall) ? ' checked="checked"' : '');
b8df10e Get rid of mysql_data_seek(). Use pre-cached PHP array for mysqli
Garvin Hicking authored
244 $save_row = array();
41f8199 - added browser icon for each field (count unique values)
Sebastian Mendel authored
245 $odd_row = true;
2915b5c Alexander M. Turek Added MySQLi library; Removed calls to old mysql_wrappers library.
derrabus authored
246 while ($row = PMA_DBI_fetch_assoc($fields_rs)) {
b8df10e Get rid of mysql_data_seek(). Use pre-cached PHP array for mysqli
Garvin Hicking authored
247 $save_row[] = $row;
41f8199 - added browser icon for each field (count unique values)
Sebastian Mendel authored
248 $rownum++;
df4a128 "Add field" dialog moved to Structure page
Loïc Chapeaux authored
249 $aryFields[] = $row['Field'];
6f03a58 Marc Delisle new
lem9 authored
250
251 $type = $row['Type'];
1ce9daf Marc Delisle bug #1982315 [GUI] Comma and quote in ENUM, thanks to Joshua Hogendorn
lem9 authored
252 $extracted_fieldspec = PMA_extractFieldSpec($row['Type']);
42a4a8c Marc Delisle bug #1926357 [data] BIT defaults displayed incorrectly
lem9 authored
253
84ae042 Michal Čihař Adding @package, third part.
nijel authored
254 if ('set' == $extracted_fieldspec['type'] || 'enum' == $extracted_fieldspec['type']) {
8417db5 Michal Čihař rfe #2956556 [interface] Allow to wrap enum values.
nijel authored
255 $type = $extracted_fieldspec['type'] . '(' .
256 str_replace("','", "', '", $extracted_fieldspec['spec_in_brackets']) . ')';
3b0a77b Marc Delisle bug #1157230, escape special chars in ENUM or SET
lem9 authored
257
258 // for the case ENUM('&#8211;','&ldquo;')
259 $type = htmlspecialchars($type);
ddd5860 Lori Truncates long enum and set values
teekirol authored
260 if(strlen($type) > $GLOBALS['cfg']['LimitChars']) {
a37b66b Lori Forgot to add <abbr> tags
teekirol authored
261 $type = '<abbr title="full text">' . substr($type, 0, $GLOBALS['cfg']['LimitChars']) . '</abbr>';
ddd5860 Lori Truncates long enum and set values
teekirol authored
262 }
9fde856 - added js:markAllRows(), js:unMarkAllRows()
Sebastian Mendel authored
263
6f03a58 Marc Delisle new
lem9 authored
264 $type_nowrap = '';
cac9bb9 Michal Čihař Fixed bug #667682 ("UNSIGNED" option in SET or ENUM).
nijel authored
265
266 $binary = 0;
267 $unsigned = 0;
268 $zerofill = 0;
6f03a58 Marc Delisle new
lem9 authored
269 } else {
270 $type_nowrap = ' nowrap="nowrap"';
c5b3b01 Marc Delisle support of BINARY and VARBINARY field types
lem9 authored
271 // strip the "BINARY" attribute, except if we find "BINARY(" because
272 // this would be a BINARY or VARBINARY field type
273 if (!preg_match('@BINARY[\(]@i', $type)) {
274 $type = preg_replace('@BINARY@i', '', $type);
275 }
c2b46ac Final batch of PHP3-Compatibility fixes. Please test. :-)
Garvin Hicking authored
276 $type = preg_replace('@ZEROFILL@i', '', $type);
277 $type = preg_replace('@UNSIGNED@i', '', $type);
cac9bb9 Michal Čihař Fixed bug #667682 ("UNSIGNED" option in SET or ENUM).
nijel authored
278 if (empty($type)) {
41f8199 - added browser icon for each field (count unique values)
Sebastian Mendel authored
279 $type = ' ';
cac9bb9 Michal Čihař Fixed bug #667682 ("UNSIGNED" option in SET or ENUM).
nijel authored
280 }
6f03a58 Marc Delisle new
lem9 authored
281
c5b3b01 Marc Delisle support of BINARY and VARBINARY field types
lem9 authored
282 if (!preg_match('@BINARY[\(]@i', $row['Type'])) {
283 $binary = stristr($row['Type'], 'blob') || stristr($row['Type'], 'binary');
284 } else {
d69c350 - fixed bug #1420474 'Consistency (order of truncate/drop)'
Sebastian Mendel authored
285 $binary = false;
c5b3b01 Marc Delisle support of BINARY and VARBINARY field types
lem9 authored
286 }
287
c2b46ac Final batch of PHP3-Compatibility fixes. Please test. :-)
Garvin Hicking authored
288 $unsigned = stristr($row['Type'], 'unsigned');
289 $zerofill = stristr($row['Type'], 'zerofill');
cac9bb9 Michal Čihař Fixed bug #667682 ("UNSIGNED" option in SET or ENUM).
nijel authored
290 }
dba8ecc Display MIME types to transform any table cell. You can only choose from...
Garvin Hicking authored
291
a1875b0 Alexander M. Turek Improved MySQL 4.1 support
derrabus authored
292 unset($field_charset);
3737060 removed MySQL < 5 code
Sebastian Mendel authored
293 if ((substr($type, 0, 4) == 'char'
294 || substr($type, 0, 7) == 'varchar'
295 || substr($type, 0, 4) == 'text'
296 || substr($type, 0, 8) == 'tinytext'
297 || substr($type, 0, 10) == 'mediumtext'
298 || substr($type, 0, 8) == 'longtext'
299 || substr($type, 0, 3) == 'set'
300 || substr($type, 0, 4) == 'enum'
301 ) && !$binary) {
302 if (strpos($type, ' character set ')) {
303 $type = substr($type, 0, strpos($type, ' character set '));
304 }
305 if (!empty($row['Collation'])) {
306 $field_charset = $row['Collation'];
a1875b0 Alexander M. Turek Improved MySQL 4.1 support
derrabus authored
307 } else {
308 $field_charset = '';
36a1167 Alexander M. Turek Experimental MySQL 4.1 support (RFE #623665) and some small fixes.
derrabus authored
309 }
3737060 removed MySQL < 5 code
Sebastian Mendel authored
310 } else {
311 $field_charset = '';
1fb6de5 Alexander M. Turek Feature #623665, part 1
derrabus authored
312 }
313
9785bbc Marc Delisle remove author names
lem9 authored
314 // Display basic mimetype [MIME]
63c5582 Basic detection if mime-features are available, better check on error
Garvin Hicking authored
315 if ($cfgRelation['commwork'] && $cfgRelation['mimework'] && $cfg['BrowseMIME'] && isset($mime_map[$row['Field']]['mimetype'])) {
743d832 Michal Čihař fixed enabling/disabling links for index generating
nijel authored
316 $type_mime = '<br />MIME: ' . str_replace('_', '/', $mime_map[$row['Field']]['mimetype']);
317 } else {
318 $type_mime = '';
dba8ecc Display MIME types to transform any table cell. You can only choose from...
Garvin Hicking authored
319 }
320
41f8199 - added browser icon for each field (count unique values)
Sebastian Mendel authored
321 $attribute = ' ';
6f03a58 Marc Delisle new
lem9 authored
322 if ($binary) {
b8b9334 Marc Delisle experimental support in table structure editing for MySQL 4.1.2+ TIMESTA...
lem9 authored
323 $attribute = 'BINARY';
6f03a58 Marc Delisle new
lem9 authored
324 }
325 if ($unsigned) {
b8b9334 Marc Delisle experimental support in table structure editing for MySQL 4.1.2+ TIMESTA...
lem9 authored
326 $attribute = 'UNSIGNED';
6f03a58 Marc Delisle new
lem9 authored
327 }
328 if ($zerofill) {
b8b9334 Marc Delisle experimental support in table structure editing for MySQL 4.1.2+ TIMESTA...
lem9 authored
329 $attribute = 'UNSIGNED ZEROFILL';
330 }
9fde856 - added js:markAllRows(), js:unMarkAllRows()
Sebastian Mendel authored
331
b8b9334 Marc Delisle experimental support in table structure editing for MySQL 4.1.2+ TIMESTA...
lem9 authored
332 // MySQL 4.1.2+ TIMESTAMP options
333 // (if on_update_current_timestamp is set, then it's TRUE)
334 if (isset($analyzed_sql[0]['create_table_fields'][$row['Field']]['on_update_current_timestamp'])) {
206f4ad refactored complete table/column creation altering;
Sebastian Mendel authored
335 $attribute = 'on update CURRENT_TIMESTAMP';
6f03a58 Marc Delisle new
lem9 authored
336 }
b8b9334 Marc Delisle experimental support in table structure editing for MySQL 4.1.2+ TIMESTA...
lem9 authored
337
9fde856 - added js:markAllRows(), js:unMarkAllRows()
Sebastian Mendel authored
338 // here, we have a TIMESTAMP that SHOW FULL FIELDS reports as having the
fe8cd66 Marc Delisle bug #1163595, NULL detection for TIMESTAMP
lem9 authored
339 // NULL attribute, but SHOW CREATE TABLE says the contrary. Believe
340 // the latter.
321bfbf Alexander M. Turek Undefined index
derrabus authored
341 if (!empty($analyzed_sql[0]['create_table_fields'][$row['Field']]['type']) && $analyzed_sql[0]['create_table_fields'][$row['Field']]['type'] == 'TIMESTAMP' && $analyzed_sql[0]['create_table_fields'][$row['Field']]['timestamp_not_null']) {
fe8cd66 Marc Delisle bug #1163595, NULL detection for TIMESTAMP
lem9 authored
342 $row['Null'] = '';
343 }
344
345
13b3195 Marc Delisle For easier reading, replace "!isset" with "! isset"
lem9 authored
346 if (! isset($row['Default'])) {
6bedb51 Marc Delisle bug 1190092, wrong detection of NULL fields with MySQL 5.0.x
lem9 authored
347 if ($row['Null'] == 'YES') {
6f03a58 Marc Delisle new
lem9 authored
348 $row['Default'] = '<i>NULL</i>';
349 }
350 } else {
351 $row['Default'] = htmlspecialchars($row['Default']);
352 }
353
354 $field_encoded = urlencode($row['Field']);
355 $field_name = htmlspecialchars($row['Field']);
be348f6 Marc Delisle rfe #854911 [interface] Grey out non applicable actions in structure
lem9 authored
356 $displayed_field_name = $field_name;
30b1873 Update and display column comments in Add/Edit Fieldmode and CREATE tabl...
Garvin Hicking authored
357
9785bbc Marc Delisle remove author names
lem9 authored
358 // underline commented fields and display a hover-title (CSS only)
30b1873 Update and display column comments in Add/Edit Fieldmode and CREATE tabl...
Garvin Hicking authored
359
360 if (isset($comments_map[$row['Field']])) {
abc229d Marc Delisle bug #3004216 Field attributes use inline CSS
lem9 authored
361 $displayed_field_name = '<span class="commented_column" title="' . htmlspecialchars($comments_map[$row['Field']]) . '">' . $field_name . '</span>';
30b1873 Update and display column comments in Add/Edit Fieldmode and CREATE tabl...
Garvin Hicking authored
362 }
363
4dea5b6 new Class PMA_Index;
Sebastian Mendel authored
364 if ($primary && $primary->hasColumn($field_name)) {
be348f6 Marc Delisle rfe #854911 [interface] Grey out non applicable actions in structure
lem9 authored
365 $displayed_field_name = '<u>' . $field_name . '</u>';
6f03a58 Marc Delisle new
lem9 authored
366 }
367 echo "\n";
368 ?>
41f8199 - added browser icon for each field (count unique values)
Sebastian Mendel authored
369 <tr class="<?php echo $odd_row ? 'odd': 'even'; $odd_row = !$odd_row; ?>">
370 <td align="center">
97aaf42 do not urlencode() form values
Sebastian Mendel authored
371 <input type="checkbox" name="selected_fld[]" value="<?php echo htmlspecialchars($row['Field']); ?>" id="checkbox_row_<?php echo $rownum; ?>" <?php echo $checked; ?> />
6f03a58 Marc Delisle new
lem9 authored
372 </td>
2c8133a Michal Čihař rfe #1340812 [interface] Show numbers of columns in table structure.
nijel authored
373 <td align="right">
374 <?php echo $rownum; ?>
375 </td>
be348f6 Marc Delisle rfe #854911 [interface] Grey out non applicable actions in structure
lem9 authored
376 <th nowrap="nowrap"><label for="checkbox_row_<?php echo $rownum; ?>"><?php echo $displayed_field_name; ?></label></th>
7a0d5c0 fixed bdo tag
Sebastian Mendel authored
377 <td<?php echo $type_nowrap; ?>><bdo dir="ltr" xml:lang="en"><?php echo $type; echo $type_mime; ?></bdo></td>
3737060 removed MySQL < 5 code
Sebastian Mendel authored
378 <td><?php echo (empty($field_charset) ? '' : '<dfn title="' . PMA_getCollationDescr($field_charset) . '">' . $field_charset . '</dfn>'); ?></td>
abc229d Marc Delisle bug #3004216 Field attributes use inline CSS
lem9 authored
379 <td nowrap="nowrap" class="column_attribute"><?php echo $attribute; ?></td>
f55823f Marc Delisle strings to gettext, first batch
lem9 authored
380 <td><?php echo (($row['Null'] == 'YES') ? __('Yes') : __('No')); ?></td>
42a4a8c Marc Delisle bug #1926357 [data] BIT defaults displayed incorrectly
lem9 authored
381 <td nowrap="nowrap"><?php
84ae042 Michal Čihař Adding @package, third part.
nijel authored
382 if (isset($row['Default'])) {
1ce9daf Marc Delisle bug #1982315 [GUI] Comma and quote in ENUM, thanks to Joshua Hogendorn
lem9 authored
383 if ($extracted_fieldspec['type'] == 'bit') {
15441de Marc Delisle do not try to display a tab that was not built
lem9 authored
384 // here, $row['Default'] contains something like b'010'
385 echo PMA_convert_bit_default_value($row['Default']);
42a4a8c Marc Delisle bug #1926357 [data] BIT defaults displayed incorrectly
lem9 authored
386 } else {
84ae042 Michal Čihař Adding @package, third part.
nijel authored
387 echo $row['Default'];
42a4a8c Marc Delisle bug #1926357 [data] BIT defaults displayed incorrectly
lem9 authored
388 }
0bac6c1 Marc Delisle patch #2099972 [structure] Display None when there is no default value
lem9 authored
389 }
390 else {
17c9fb4 Marc Delisle gettext conversion
lem9 authored
391 echo '<i>' . _pgettext('None for default','None') . '</i>';
42a4a8c Marc Delisle bug #1926357 [data] BIT defaults displayed incorrectly
lem9 authored
392 } ?></td>
ef2a411 Marc Delisle bug #2994168 Show auto_increment in uppercase
lem9 authored
393 <td nowrap="nowrap"><?php echo strtoupper($row['Extra']); ?></td>
9badb87 Lori Reveal-on-hover table structure actions
teekirol authored
394 <td align="center" class="browse">
f55823f Marc Delisle strings to gettext, first batch
lem9 authored
395 <a href="sql.php?<?php echo $url_query; ?>&amp;sql_query=<?php echo urlencode('SELECT COUNT(*) AS ' . PMA_backquote(__('Rows')) . ', ' . PMA_backquote($row['Field']) . ' FROM ' . PMA_backquote($table) . ' GROUP BY ' . PMA_backquote($row['Field']) . ' ORDER BY ' . PMA_backquote($row['Field'])); ?>">
e0a640f Marc Delisle Browse distinct values
lem9 authored
396 <?php echo $titles['BrowseDistinctValues']; ?></a>
41f8199 - added browser icon for each field (count unique values)
Sebastian Mendel authored
397 </td>
d69c350 - fixed bug #1420474 'Consistency (order of truncate/drop)'
Sebastian Mendel authored
398 <?php if (! $tbl_is_view && ! $db_is_information_schema) { ?>
9badb87 Lori Reveal-on-hover table structure actions
teekirol authored
399 <td align="center" class="edit">
ca5b16f Michal Čihař Change look of adding fields into table (bug #991095).
nijel authored
400 <a href="tbl_alter.php?<?php echo $url_query; ?>&amp;field=<?php echo $field_encoded; ?>">
2df5509 Image-stuff, multi-column display
Garvin Hicking authored
401 <?php echo $titles['Change']; ?></a>
6f03a58 Marc Delisle new
lem9 authored
402 </td>
9badb87 Lori Reveal-on-hover table structure actions
teekirol authored
403 <td align="center" class="drop">
5b900ea Marc Delisle Conditional Ajax on table Structure
lem9 authored
404 <a <?php echo ($GLOBALS['cfg']['AjaxEnable'] ? ' class="drop_column_anchor"' : ''); ?> href="sql.php?<?php echo $url_query; ?>&amp;sql_query=<?php echo urlencode('ALTER TABLE ' . PMA_backquote($table) . ' DROP ' . PMA_backquote($row['Field'])); ?>&amp;dropped_column=<?php echo urlencode($row['Field']); ?>&amp;message_to_show=<?php echo urlencode(sprintf(__('Column %s has been dropped'), htmlspecialchars($row['Field']))); ?>" >
2df5509 Image-stuff, multi-column display
Garvin Hicking authored
405 <?php echo $titles['Drop']; ?></a>
6f03a58 Marc Delisle new
lem9 authored
406 </td>
9badb87 Lori Reveal-on-hover table structure actions
teekirol authored
407 <td align="center" class="primary">
6f03a58 Marc Delisle new
lem9 authored
408 <?php
be348f6 Marc Delisle rfe #854911 [interface] Grey out non applicable actions in structure
lem9 authored
409 if ($type == 'text' || $type == 'blob' || 'ARCHIVE' == $tbl_type || ($primary && $primary->hasColumn($field_name))) {
2df5509 Image-stuff, multi-column display
Garvin Hicking authored
410 echo $titles['NoPrimary'] . "\n";
9b2ff19 Lori Fixed bug where table rows don't show up because of conflicting variable...
teekirol authored
411 $primary_enabled = false;
6f03a58 Marc Delisle new
lem9 authored
412 } else {
413 echo "\n";
414 ?>
98a5ba7 Marc Delisle misleading variable name
lem9 authored
415 <a class="add_primary_key_anchor" href="sql.php?<?php echo $url_query; ?>&amp;sql_query=<?php echo urlencode('ALTER TABLE ' . PMA_backquote($table) . ($primary ? ' DROP PRIMARY KEY,' : '') . ' ADD PRIMARY KEY(' . PMA_backquote($row['Field']) . ')'); ?>&amp;message_to_show=<?php echo urlencode(sprintf(__('A primary key has been added on %s'), htmlspecialchars($row['Field']))); ?>" >
2df5509 Image-stuff, multi-column display
Garvin Hicking authored
416 <?php echo $titles['Primary']; ?></a>
9b2ff19 Lori Fixed bug where table rows don't show up because of conflicting variable...
teekirol authored
417 <?php $primary_enabled = true;
6f03a58 Marc Delisle new
lem9 authored
418 }
419 echo "\n";
420 ?>
421 </td>
9badb87 Lori Reveal-on-hover table structure actions
teekirol authored
422 <td align="center" class="unique">
6f03a58 Marc Delisle new
lem9 authored
423 <?php
be348f6 Marc Delisle rfe #854911 [interface] Grey out non applicable actions in structure
lem9 authored
424 if ($type == 'text' || $type == 'blob' || 'ARCHIVE' == $tbl_type || isset($columns_with_unique_index[$field_name])) {
d69c350 - fixed bug #1420474 'Consistency (order of truncate/drop)'
Sebastian Mendel authored
425 echo $titles['NoUnique'] . "\n";
9b2ff19 Lori Fixed bug where table rows don't show up because of conflicting variable...
teekirol authored
426 $unique_enabled = false;
6f03a58 Marc Delisle new
lem9 authored
427 } else {
428 echo "\n";
429 ?>
98a5ba7 Marc Delisle misleading variable name
lem9 authored
430 <a href="sql.php?<?php echo $url_query; ?>&amp;sql_query=<?php echo urlencode('ALTER TABLE ' . PMA_backquote($table) . ' ADD UNIQUE(' . PMA_backquote($row['Field']) . ')'); ?>&amp;message_to_show=<?php echo urlencode(sprintf(__('An index has been added on %s'), htmlspecialchars($row['Field']))); ?>">
d69c350 - fixed bug #1420474 'Consistency (order of truncate/drop)'
Sebastian Mendel authored
431 <?php echo $titles['Unique']; ?></a>
9b2ff19 Lori Fixed bug where table rows don't show up because of conflicting variable...
teekirol authored
432 <?php $unique_enabled = true;
6f03a58 Marc Delisle new
lem9 authored
433 }
434 echo "\n";
435 ?>
436 </td>
9badb87 Lori Reveal-on-hover table structure actions
teekirol authored
437 <td align="center" class="index">
6f03a58 Marc Delisle new
lem9 authored
438 <?php
688f8aa Marc Delisle bug #2001005 [GUI] ARCHIVE cannot have indexes
lem9 authored
439 if ($type == 'text' || $type == 'blob' || 'ARCHIVE' == $tbl_type) {
d69c350 - fixed bug #1420474 'Consistency (order of truncate/drop)'
Sebastian Mendel authored
440 echo $titles['NoIndex'] . "\n";
9b2ff19 Lori Fixed bug where table rows don't show up because of conflicting variable...
teekirol authored
441 $index_enabled = false;
6f03a58 Marc Delisle new
lem9 authored
442 } else {
443 echo "\n";
444 ?>
98a5ba7 Marc Delisle misleading variable name
lem9 authored
445 <a href="sql.php?<?php echo $url_query; ?>&amp;sql_query=<?php echo urlencode('ALTER TABLE ' . PMA_backquote($table) . ' ADD INDEX(' . PMA_backquote($row['Field']) . ')'); ?>&amp;message_to_show=<?php echo urlencode(sprintf(__('An index has been added on %s'), htmlspecialchars($row['Field']))); ?>">
d69c350 - fixed bug #1420474 'Consistency (order of truncate/drop)'
Sebastian Mendel authored
446 <?php echo $titles['Index']; ?></a>
6f03a58 Marc Delisle new
lem9 authored
447 <?php
9b2ff19 Lori Fixed bug where table rows don't show up because of conflicting variable...
teekirol authored
448 $index_enabled = true;
6f03a58 Marc Delisle new
lem9 authored
449 }
450 echo "\n";
451 ?>
452 </td>
f2569ac Madhura Jayaratne Spatial indexes added.
madhuracj authored
453 <td align="center" class="index">
454 <?php
455 $spatial_types = array(
456 'geometry', 'point', 'linestring', 'polygon', 'multipoint',
457 'multilinestring', 'multipolygon', 'geomtrycollection'
458 );
459 if (! in_array($type, $spatial_types) || 'MYISAM' != $tbl_type) {
460 echo $titles['NoSpatial'] . "\n";
461 $spatial_enabled = false;
462 } else {
463 echo "\n";
464 ?>
465 <a href="sql.php?<?php echo $url_query; ?>&amp;sql_query=<?php echo urlencode('ALTER TABLE ' . PMA_backquote($table) . ' ADD SPATIAL(' . PMA_backquote($row['Field']) . ')'); ?>&amp;message_to_show=<?php echo urlencode(sprintf(__('An index has been added on %s'), htmlspecialchars($row['Field']))); ?>">
466 <?php echo $titles['Spatial']; ?></a>
467 <?php
468 $spatial_enabled = true;
469 }
470 echo "\n";
471 ?>
472 </td>
6f03a58 Marc Delisle new
lem9 authored
473 <?php
2d4b9e2 Marc Delisle support ARIA storage engine as well as its previous name MARIA
lem9 authored
474 if (! empty($tbl_type) && ($tbl_type == 'MYISAM' || $tbl_type == 'ARIA' || $tbl_type == 'MARIA')
86b1747 Marc Delisle bug #1828913 [structure] no FULLTEXT index on CHAR column
lem9 authored
475 // FULLTEXT is possible on TEXT, CHAR and VARCHAR
476 && (strpos(' ' . $type, 'text') || strpos(' ' . $type, 'char'))) {
6f03a58 Marc Delisle new
lem9 authored
477 echo "\n";
478 ?>
9badb87 Lori Reveal-on-hover table structure actions
teekirol authored
479 <td align="center" nowrap="nowrap" class="fulltext">
98a5ba7 Marc Delisle misleading variable name
lem9 authored
480 <a href="sql.php?<?php echo $url_query; ?>&amp;sql_query=<?php echo urlencode('ALTER TABLE ' . PMA_backquote($table) . ' ADD FULLTEXT(' . PMA_backquote($row['Field']) . ')'); ?>&amp;message_to_show=<?php echo urlencode(sprintf(__('An index has been added on %s'), htmlspecialchars($row['Field']))); ?>">
2df5509 Image-stuff, multi-column display
Garvin Hicking authored
481 <?php echo $titles['IdxFulltext']; ?></a>
9b2ff19 Lori Fixed bug where table rows don't show up because of conflicting variable...
teekirol authored
482 <?php $fulltext_enabled = true; ?>
6f03a58 Marc Delisle new
lem9 authored
483 </td>
484 <?php
485 } else {
486 echo "\n";
c2b46ac Final batch of PHP3-Compatibility fixes. Please test. :-)
Garvin Hicking authored
487 ?>
9badb87 Lori Reveal-on-hover table structure actions
teekirol authored
488 <td align="center" nowrap="nowrap" class="fulltext">
2df5509 Image-stuff, multi-column display
Garvin Hicking authored
489 <?php echo $titles['NoIdxFulltext'] . "\n"; ?>
9b2ff19 Lori Fixed bug where table rows don't show up because of conflicting variable...
teekirol authored
490 <?php $fulltext_enabled = false; ?>
6f03a58 Marc Delisle new
lem9 authored
491 </td>
c2b46ac Final batch of PHP3-Compatibility fixes. Please test. :-)
Garvin Hicking authored
492 <?php
6f03a58 Marc Delisle new
lem9 authored
493 } // end if... else...
a47d428 Alexander M. Turek Views
derrabus authored
494 echo "\n";
2c3fa8a Piotr Przybylski Don't display More for views and information_schema tables
Crack authored
495 ?>
1faaa80 Lori Fixing HTML markup
teekirol authored
496 <td class="more_opts" id="more_opts<?php echo $rownum; ?>">
bc0a0bc Michal Čihař Mark texts translatable
nijel authored
497 <?php echo __('More'); ?> <img src="<?php echo $pmaThemeImage . 'more.png'; ?>" alt="<?php echo __('Show more actions'); ?>" />
9badb87 Lori Reveal-on-hover table structure actions
teekirol authored
498 <div class="structure_actions_dropdown" id="row_<?php echo $rownum; ?>">
499
500 <div class="action_browse">
501 <a href="sql.php?<?php echo $url_query; ?>&amp;sql_query=<?php echo urlencode('SELECT COUNT(*) AS ' . PMA_backquote(__('Rows')) . ', ' . PMA_backquote($row['Field']) . ' FROM ' . PMA_backquote($table) . ' GROUP BY ' . PMA_backquote($row['Field']) . ' ORDER BY ' . PMA_backquote($row['Field'])); ?>">
502 <?php echo $hidden_titles['BrowseDistinctValues']; ?>
503 </a>
504 </div>
5b900ea Marc Delisle Conditional Ajax on table Structure
lem9 authored
505 <div <?php echo ($GLOBALS['cfg']['AjaxEnable'] ? ' class="action_primary"' : ''); ?>>
9badb87 Lori Reveal-on-hover table structure actions
teekirol authored
506 <?php
64b5900 Lori Fixing bug for when the table is a view or information_schema
teekirol authored
507 if(isset($primary_enabled)) {
508 if($primary_enabled) { ?>
98a5ba7 Marc Delisle misleading variable name
lem9 authored
509 <a href="sql.php?<?php echo $url_query; ?>&amp;sql_query=<?php echo urlencode('ALTER TABLE ' . PMA_backquote($table) . ($primary ? ' DROP PRIMARY KEY,' : '') . ' ADD PRIMARY KEY(' . PMA_backquote($row['Field']) . ')'); ?>&amp;message_to_show=<?php echo urlencode(sprintf(__('A primary key has been added on %s'), htmlspecialchars($row['Field']))); ?>">
64b5900 Lori Fixing bug for when the table is a view or information_schema
teekirol authored
510 <?php echo $hidden_titles['Primary']; ?>
511 </a>
512 <?php
513 } else {
514 echo $hidden_titles['NoPrimary'];
515 }
516 } ?>
9badb87 Lori Reveal-on-hover table structure actions
teekirol authored
517 </div>
518 <div class="action_unique">
519 <?php
64b5900 Lori Fixing bug for when the table is a view or information_schema
teekirol authored
520 if(isset($unique_enabled)) {
542fe56 Lori Fixed a typo
teekirol authored
521 if($unique_enabled) { ?>
98a5ba7 Marc Delisle misleading variable name
lem9 authored
522 <a href="sql.php?<?php echo $url_query; ?>&amp;sql_query=<?php echo urlencode('ALTER TABLE ' . PMA_backquote($table) . ' ADD UNIQUE(' . PMA_backquote($row['Field']) . ')'); ?>&amp;message_to_show=<?php echo urlencode(sprintf(__('An index has been added on %s'), htmlspecialchars($row['Field']))); ?>">
64b5900 Lori Fixing bug for when the table is a view or information_schema
teekirol authored
523 <?php echo $hidden_titles['Unique']; ?>
524 </a>
525 <?php
526 } else {
527 echo $hidden_titles['NoUnique'];
528 }
529 } ?>
9badb87 Lori Reveal-on-hover table structure actions
teekirol authored
530 </div>
531 <div class="action_index">
532 <?php
64b5900 Lori Fixing bug for when the table is a view or information_schema
teekirol authored
533 if(isset($index_enabled)) {
534 if($index_enabled) { ?>
98a5ba7 Marc Delisle misleading variable name
lem9 authored
535 <a href="sql.php?<?php echo $url_query; ?>&amp;sql_query=<?php echo urlencode('ALTER TABLE ' . PMA_backquote($table) . ' ADD INDEX(' . PMA_backquote($row['Field']) . ')'); ?>&amp;message_to_show=<?php echo urlencode(sprintf(__('An index has been added on %s'), htmlspecialchars($row['Field']))); ?>">
64b5900 Lori Fixing bug for when the table is a view or information_schema
teekirol authored
536 <?php echo $hidden_titles['Index']; ?>
537 </a>
538 <?php
539 } else {
540 echo $hidden_titles['NoIndex'];
541 }
542 } ?>
f2569ac Madhura Jayaratne Spatial indexes added.
madhuracj authored
543 </div>
544 <div class="action_spatial">
545 <?php
546 if(isset($spatial_enabled)) {
547 if($spatial_enabled) { ?>
548 <a href="sql.php?<?php echo $url_query; ?>&amp;sql_query=<?php echo urlencode('ALTER TABLE ' . PMA_backquote($table) . ' ADD SPATIAL(' . PMA_backquote($row['Field']) . ')'); ?>&amp;message_to_show=<?php echo urlencode(sprintf(__('An index has been added on %s'), htmlspecialchars($row['Field']))); ?>">
549 <?php echo $hidden_titles['Spatial']; ?>
550 </a>
551 <?php
552 } else {
553 echo $hidden_titles['NoSpatial'];
554 }
555 } ?>
556 </div>
9badb87 Lori Reveal-on-hover table structure actions
teekirol authored
557 <div class="action_fulltext">
558 <?php
64b5900 Lori Fixing bug for when the table is a view or information_schema
teekirol authored
559 if(isset($fulltext_enabled)) {
560 if($fulltext_enabled) { ?>
98a5ba7 Marc Delisle misleading variable name
lem9 authored
561 <a href="sql.php?<?php echo $url_query; ?>&amp;sql_query=<?php echo urlencode('ALTER TABLE ' . PMA_backquote($table) . ' ADD FULLTEXT(' . PMA_backquote($row['Field']) . ')'); ?>&amp;message_to_show=<?php echo urlencode(sprintf(__('An index has been added on %s'), htmlspecialchars($row['Field']))); ?>">
64b5900 Lori Fixing bug for when the table is a view or information_schema
teekirol authored
562 <?php echo $hidden_titles['IdxFulltext']; ?>
563 </a>
564 <?php
565 } else {
566 echo $hidden_titles['NoIdxFulltext'];
567 }
568 } ?>
9badb87 Lori Reveal-on-hover table structure actions
teekirol authored
569 </div>
570 </div>
571 </td>
2c3fa8a Piotr Przybylski Don't display More for views and information_schema tables
Crack authored
572 <?php
573 } // end if (! $tbl_is_view && ! $db_is_information_schema)
574 ?>
6f03a58 Marc Delisle new
lem9 authored
575 </tr>
576 <?php
36a1167 Alexander M. Turek Experimental MySQL 4.1 support (RFE #623665) and some small fixes.
derrabus authored
577 unset($field_charset);
6f03a58 Marc Delisle new
lem9 authored
578 } // end while
579
64bd56d Michal Čihař Support for browsing selected columns (RFE #1275909).
nijel authored
580 echo '</tbody>' . "\n"
581 .'</table>' . "\n";
99f08d6 Michal Čihař Added (un)check all for fields selection.
nijel authored
582
ad06b4a Michal Čihař Rename tbl_* files to drop useless _properties part.
nijel authored
583 $checkall_url = 'tbl_structure.php?' . PMA_generate_common_url($db, $table);
41f8199 - added browser icon for each field (count unique values)
Sebastian Mendel authored
584 ?>
a47d428 Alexander M. Turek Views
derrabus authored
585
41f8199 - added browser icon for each field (count unique values)
Sebastian Mendel authored
586 <img class="selectallarrow" src="<?php echo $pmaThemeImage . 'arrow_' . $text_dir . '.png'; ?>"
f55823f Marc Delisle strings to gettext, first batch
lem9 authored
587 width="38" height="22" alt="<?php echo __('With selected:'); ?>" />
41f8199 - added browser icon for each field (count unique values)
Sebastian Mendel authored
588 <a href="<?php echo $checkall_url; ?>&amp;checkall=1"
d69c350 - fixed bug #1420474 'Consistency (order of truncate/drop)'
Sebastian Mendel authored
589 onclick="if (markAllRows('fieldsForm')) return false;">
f55823f Marc Delisle strings to gettext, first batch
lem9 authored
590 <?php echo __('Check All'); ?></a>
41f8199 - added browser icon for each field (count unique values)
Sebastian Mendel authored
591 /
592 <a href="<?php echo $checkall_url; ?>"
d69c350 - fixed bug #1420474 'Consistency (order of truncate/drop)'
Sebastian Mendel authored
593 onclick="if (unMarkAllRows('fieldsForm')) return false;">
f55823f Marc Delisle strings to gettext, first batch
lem9 authored
594 <?php echo __('Uncheck All'); ?></a>
6f03a58 Marc Delisle new
lem9 authored
595
f55823f Marc Delisle strings to gettext, first batch
lem9 authored
596 <i><?php echo __('With selected:'); ?></i>
3f8e1f5 Alexander M. Turek Don't ignore $cfg['PropertiesIconic']...
derrabus authored
597
41f8199 - added browser icon for each field (count unique values)
Sebastian Mendel authored
598 <?php
cb377c3 Michal Čihař Use non translated string for identification of submited value in table ...
nijel authored
599 PMA_buttonOrImage('submit_mult', 'mult_submit', 'submit_mult_browse', __('Browse'), 'b_browse.png', 'browse');
caf6159 $cfg['PropertiesIconic'] is checked inside PMA_buttonOrImage()
Sebastian Mendel authored
600
d69c350 - fixed bug #1420474 'Consistency (order of truncate/drop)'
Sebastian Mendel authored
601 if (! $tbl_is_view && ! $db_is_information_schema) {
cb377c3 Michal Čihař Use non translated string for identification of submited value in table ...
nijel authored
602 PMA_buttonOrImage('submit_mult', 'mult_submit', 'submit_mult_change', __('Change'), 'b_edit.png', 'change');
603 PMA_buttonOrImage('submit_mult', 'mult_submit', 'submit_mult_drop', __('Drop'), 'b_drop.png', 'drop');
688f8aa Marc Delisle bug #2001005 [GUI] ARCHIVE cannot have indexes
lem9 authored
604 if ('ARCHIVE' != $tbl_type) {
cb377c3 Michal Čihař Use non translated string for identification of submited value in table ...
nijel authored
605 PMA_buttonOrImage('submit_mult', 'mult_submit', 'submit_mult_primary', __('Primary'), 'b_primary.png', 'primary');
606 PMA_buttonOrImage('submit_mult', 'mult_submit', 'submit_mult_unique', __('Unique'), 'b_unique.png', 'unique');
607 PMA_buttonOrImage('submit_mult', 'mult_submit', 'submit_mult_index', __('Index'), 'b_index.png', 'index');
688f8aa Marc Delisle bug #2001005 [GUI] ARCHIVE cannot have indexes
lem9 authored
608 }
7cbdcd6 Marc Delisle fix merge conflicts
lem9 authored
609
f2569ac Madhura Jayaratne Spatial indexes added.
madhuracj authored
610 if (! empty($tbl_type) && $tbl_type == 'MYISAM') {
611 PMA_buttonOrImage('submit_mult', 'mult_submit', 'submit_mult_spatial', __('Spatial'), 'b_ftext.png', 'spatial');
612 }
2d4b9e2 Marc Delisle support ARIA storage engine as well as its previous name MARIA
lem9 authored
613 if (! empty($tbl_type) && ($tbl_type == 'MYISAM' || $tbl_type == 'ARIA' || $tbl_type == 'MARIA')) {
cb377c3 Michal Čihař Use non translated string for identification of submited value in table ...
nijel authored
614 PMA_buttonOrImage('submit_mult', 'mult_submit', 'submit_mult_fulltext', __('Fulltext'), 'b_ftext.png', 'ftext');
3f8e1f5 Alexander M. Turek Don't ignore $cfg['PropertiesIconic']...
derrabus authored
615 }
a47d428 Alexander M. Turek Views
derrabus authored
616 }
617 ?>
6f03a58 Marc Delisle new
lem9 authored
618 </form>
0b6975f Alexander M. Turek Patch #947190
derrabus authored
619 <hr />
620
621 <?php
41f8199 - added browser icon for each field (count unique values)
Sebastian Mendel authored
622 /**
623 * Work on the table
624 */
625 ?>
ca5b16f Michal Čihař Change look of adding fields into table (bug #991095).
nijel authored
626 <a href="tbl_printview.php?<?php echo $url_query; ?>"><?php
41f8199 - added browser icon for each field (count unique values)
Sebastian Mendel authored
627 if ($cfg['PropertiesIconic']) {
f55823f Marc Delisle strings to gettext, first batch
lem9 authored
628 echo '<img class="icon" src="' . $pmaThemeImage . 'b_print.png" width="16" height="16" alt="' . __('Print view') . '"/>';
41f8199 - added browser icon for each field (count unique values)
Sebastian Mendel authored
629 }
f55823f Marc Delisle strings to gettext, first batch
lem9 authored
630 echo __('Print view');
41f8199 - added browser icon for each field (count unique values)
Sebastian Mendel authored
631 ?></a>
9392a58 removed superfluous spaces, introduced more CSS ID attributes
Garvin Hicking authored
632
41f8199 - added browser icon for each field (count unique values)
Sebastian Mendel authored
633 <?php
1a96a31 Marc Delisle more complete check before showing Relation View
lem9 authored
634 if (! $tbl_is_view && ! $db_is_information_schema) {
1142f3c Marc Delisle enable Relation view for InnoDB even if the internal infrastructure is n...
lem9 authored
635
84ae042 Michal Čihař Adding @package, third part.
nijel authored
636 // if internal relations are available, or foreign keys are supported
ad06b4a Michal Čihař Rename tbl_* files to drop useless _properties part.
nijel authored
637 // ($tbl_type comes from libraries/tbl_info.inc.php)
7c5d5c4 Marc Delisle PBXT: foreign key support
lem9 authored
638 if ($cfgRelation['relwork'] || PMA_foreignkey_supported($tbl_type)) {
a47d428 Alexander M. Turek Views
derrabus authored
639 ?>
ca5b16f Michal Čihař Change look of adding fields into table (bug #991095).
nijel authored
640 <a href="tbl_relation.php?<?php echo $url_query; ?>"><?php
41f8199 - added browser icon for each field (count unique values)
Sebastian Mendel authored
641 if ($cfg['PropertiesIconic']) {
f55823f Marc Delisle strings to gettext, first batch
lem9 authored
642 echo '<img class="icon" src="' . $pmaThemeImage . 'b_relations.png" width="16" height="16" alt="' . __('Relation view') . '"/>';
41f8199 - added browser icon for each field (count unique values)
Sebastian Mendel authored
643 }
f55823f Marc Delisle strings to gettext, first batch
lem9 authored
644 echo __('Relation view');
41f8199 - added browser icon for each field (count unique values)
Sebastian Mendel authored
645 ?></a>
a47d428 Alexander M. Turek Views
derrabus authored
646 <?php
647 }
648 ?>
ca5b16f Michal Čihař Change look of adding fields into table (bug #991095).
nijel authored
649 <a href="sql.php?<?php echo $url_query; ?>&amp;session_max_rows=all&amp;sql_query=<?php echo urlencode('SELECT * FROM ' . PMA_backquote($table) . ' PROCEDURE ANALYSE()'); ?>"><?php
650 if ($cfg['PropertiesIconic']) {
f55823f Marc Delisle strings to gettext, first batch
lem9 authored
651 echo '<img class="icon" src="' . $pmaThemeImage . 'b_tblanalyse.png" width="16" height="16" alt="' . __('Propose table structure') . '" />';
ca5b16f Michal Čihař Change look of adding fields into table (bug #991095).
nijel authored
652 }
f55823f Marc Delisle strings to gettext, first batch
lem9 authored
653 echo __('Propose table structure');
41f8199 - added browser icon for each field (count unique values)
Sebastian Mendel authored
654 ?></a><?php
ca5b16f Michal Čihař Change look of adding fields into table (bug #991095).
nijel authored
655 echo PMA_showMySQLDocu('Extending_MySQL', 'procedure_analyse') . "\n";
a2a0d9b Michal Čihař Avoid multiple loading of jQuery.
nijel authored
656
657
15441de Marc Delisle do not try to display a tab that was not built
lem9 authored
658 if(PMA_Tracker::isActive())
659 {
660 echo '<a href="tbl_tracking.php?' . $url_query . '">';
a2a0d9b Michal Čihař Avoid multiple loading of jQuery.
nijel authored
661
662 if ($cfg['PropertiesIconic'])
15441de Marc Delisle do not try to display a tab that was not built
lem9 authored
663 {
f55823f Marc Delisle strings to gettext, first batch
lem9 authored
664 echo '<img class="icon" src="' . $pmaThemeImage . 'eye.png" width="16" height="16" alt="' . __('Track table') . '" /> ';
15441de Marc Delisle do not try to display a tab that was not built
lem9 authored
665 }
f55823f Marc Delisle strings to gettext, first batch
lem9 authored
666 echo __('Track table') . '</a>';
15441de Marc Delisle do not try to display a tab that was not built
lem9 authored
667 }
668 ?>
a2a0d9b Michal Čihař Avoid multiple loading of jQuery.
nijel authored
669
15441de Marc Delisle do not try to display a tab that was not built
lem9 authored
670 <br />
ca5b16f Michal Čihař Change look of adding fields into table (bug #991095).
nijel authored
671 <form method="post" action="tbl_addfield.php"
caa9844 Marc Delisle conform to relational terminology regarding columns and rows
lem9 authored
672 onsubmit="return checkFormElementInRange(this, 'num_fields', '<?php echo str_replace('\'', '\\\'', __('You have to add at least one column.')); ?>', 1)">
9392a58 removed superfluous spaces, introduced more CSS ID attributes
Garvin Hicking authored
673 <?php
41f8199 - added browser icon for each field (count unique values)
Sebastian Mendel authored
674 echo PMA_generate_common_hidden_inputs($db, $table);
675 if ($cfg['PropertiesIconic']) {
e8ba43e Marc Delisle this really means a column
lem9 authored
676 echo '<img class="icon" src="' . $pmaThemeImage . 'b_insrow.png" width="16" height="16" alt="' . __('Add column') . '"/>';
41f8199 - added browser icon for each field (count unique values)
Sebastian Mendel authored
677 }
caa9844 Marc Delisle conform to relational terminology regarding columns and rows
lem9 authored
678 echo sprintf(__('Add %s column(s)'), '<input type="text" name="num_fields" size="2" maxlength="2" value="1" onfocus="this.select()" />');
9e4d476 Marc Delisle use PMA_generate_html_radio()
lem9 authored
679
fdd0498 Marc Delisle bug #2121287 [display] Drop-down menu blinking in FF
lem9 authored
680 // I tried displaying the drop-down inside the label but with Firefox
681 // the drop-down was blinking
abc229d Marc Delisle bug #3004216 Field attributes use inline CSS
lem9 authored
682 $fieldOptions = '<select name="after_field" onclick="this.form.field_where[2].checked=true" onchange="this.form.field_where[2].checked=true">';
d69c350 - fixed bug #1420474 'Consistency (order of truncate/drop)'
Sebastian Mendel authored
683 foreach ($aryFields as $fieldname) {
41f8199 - added browser icon for each field (count unique values)
Sebastian Mendel authored
684 $fieldOptions .= '<option value="' . htmlspecialchars($fieldname) . '">' . htmlspecialchars($fieldname) . '</option>' . "\n";
685 }
686 unset($aryFields);
9e4d476 Marc Delisle use PMA_generate_html_radio()
lem9 authored
687 $fieldOptions .= '</select>';
688
689 $choices = array(
f55823f Marc Delisle strings to gettext, first batch
lem9 authored
690 'last' => __('At End of Table'),
691 'first' => __('At Beginning of Table'),
692 'after' => sprintf(__('After %s'), '')
9e4d476 Marc Delisle use PMA_generate_html_radio()
lem9 authored
693 );
8480ffb Marc Delisle improve function names
lem9 authored
694 PMA_display_html_radio('field_where', $choices, 'last', false);
fdd0498 Marc Delisle bug #2121287 [display] Drop-down menu blinking in FF
lem9 authored
695 echo $fieldOptions;
9e4d476 Marc Delisle use PMA_generate_html_radio()
lem9 authored
696 unset($fieldOptions, $choices);
41f8199 - added browser icon for each field (count unique values)
Sebastian Mendel authored
697 ?>
abc229d Marc Delisle bug #3004216 Field attributes use inline CSS
lem9 authored
698 <input type="submit" value="<?php echo __('Go'); ?>" />
ca5b16f Michal Čihař Change look of adding fields into table (bug #991095).
nijel authored
699 </form>
9877db1 Lori Fix for positioning in different browsers plus IE6 bug
teekirol authored
700 <iframe class="IE_hack" scrolling="no"></iframe>
0b6975f Alexander M. Turek Patch #947190
derrabus authored
701 <hr />
a47d428 Alexander M. Turek Views
derrabus authored
702 <?php
703 }
704
6f03a58 Marc Delisle new
lem9 authored
705 /**
706 * If there are more than 20 rows, displays browse/select/insert/empty/drop
707 * links again
708 */
709 if ($fields_cnt > 20) {
ad06b4a Michal Čihař Rename tbl_* files to drop useless _properties part.
nijel authored
710 require './libraries/tbl_links.inc.php';
6f03a58 Marc Delisle new
lem9 authored
711 } // end if ($fields_cnt > 20)
712
41f8199 - added browser icon for each field (count unique values)
Sebastian Mendel authored
713 /**
714 * Displays indexes
715 */
f619053 Marc Delisle rest of the "remove flickering" fix
lem9 authored
716
688f8aa Marc Delisle bug #2001005 [GUI] ARCHIVE cannot have indexes
lem9 authored
717 if (! $tbl_is_view && ! $db_is_information_schema && 'ARCHIVE' != $tbl_type) {
4dea5b6 new Class PMA_Index;
Sebastian Mendel authored
718 /**
719 * Display indexes
720 */
721 echo PMA_Index::getView($table, $db);
722 ?>
723 <br />
724 <form action="./tbl_indexes.php" method="post"
725 onsubmit="return checkFormElementInRange(this, 'idx_num_fields',
2182098 Marc Delisle strings to gettext, second batch
lem9 authored
726 '<?php echo str_replace('\'', '\\\'', __('Column count has to be larger than zero.')); ?>',
4dea5b6 new Class PMA_Index;
Sebastian Mendel authored
727 1)">
728 <fieldset>
729 <?php
730 echo PMA_generate_common_hidden_inputs($db, $table);
f55823f Marc Delisle strings to gettext, first batch
lem9 authored
731 echo sprintf(__('Create an index on &nbsp;%s&nbsp;columns'),
bda5a21 more cleanup/refactoring on index code
Sebastian Mendel authored
732 '<input type="text" size="2" name="added_fields" value="1" />');
4dea5b6 new Class PMA_Index;
Sebastian Mendel authored
733 ?>
f55823f Marc Delisle strings to gettext, first batch
lem9 authored
734 <input type="submit" name="create_index" value="<?php echo __('Go'); ?>"
4dea5b6 new Class PMA_Index;
Sebastian Mendel authored
735 onclick="return checkFormElementInRange(this.form,
736 'idx_num_fields',
2182098 Marc Delisle strings to gettext, second batch
lem9 authored
737 '<?php echo str_replace('\'', '\\\'', __('Column count has to be larger than zero.')); ?>',
4dea5b6 new Class PMA_Index;
Sebastian Mendel authored
738 1)" />
739 </fieldset>
740 </form>
741 <br />
742 <?php
41f8199 - added browser icon for each field (count unique values)
Sebastian Mendel authored
743 }
d524c87 Marc Delisle rfe #2129902 [structure] Do not hide indexes
lem9 authored
744
41f8199 - added browser icon for each field (count unique values)
Sebastian Mendel authored
745 /**
746 * Displays Space usage and row statistics
747 */
819324e Marc Delisle remove author names, as discussed at the 2010 developer meeting and acco...
lem9 authored
748 // BEGIN - Calc Table Space
749 // Get valid statistics whatever is the table type
d69c350 - fixed bug #1420474 'Consistency (order of truncate/drop)'
Sebastian Mendel authored
750 if ($cfg['ShowStats']) {
84006bf Marc Delisle Put back the div that was generated by previous slider
lem9 authored
751 echo '<div id="tablestatistics">';
09fa904 Marc Delisle showtable undefined after table creation
lem9 authored
752 if (empty($showtable)) {
753 $showtable = PMA_Table::sGetStatusInfo($GLOBALS['db'], $GLOBALS['table'], null, true);
754 }
755
d69c350 - fixed bug #1420474 'Consistency (order of truncate/drop)'
Sebastian Mendel authored
756 $nonisam = false;
41f8199 - added browser icon for each field (count unique values)
Sebastian Mendel authored
757 $is_innodb = (isset($showtable['Type']) && $showtable['Type'] == 'InnoDB');
758 if (isset($showtable['Type']) && !preg_match('@ISAM|HEAP@i', $showtable['Type'])) {
d69c350 - fixed bug #1420474 'Consistency (order of truncate/drop)'
Sebastian Mendel authored
759 $nonisam = true;
41f8199 - added browser icon for each field (count unique values)
Sebastian Mendel authored
760 }
6f03a58 Marc Delisle new
lem9 authored
761
41f8199 - added browser icon for each field (count unique values)
Sebastian Mendel authored
762 // Gets some sizes
7c818d0 Dieter Adriaenssens patch #2969449 Name for MERGE engine varies depending on the MySQL versi...
ruleant authored
763
764 $mergetable = PMA_Table::isMerge($GLOBALS['db'], $GLOBALS['table']);
765
713dfc4 Marc Delisle bug #1884911 [GUI] Space usage
lem9 authored
766 // this is to display for example 261.2 MiB instead of 268k KiB
767 $max_digits = 5;
768 $decimals = 1;
769 list($data_size, $data_unit) = PMA_formatByteDown($showtable['Data_length'], $max_digits, $decimals);
d69c350 - fixed bug #1420474 'Consistency (order of truncate/drop)'
Sebastian Mendel authored
770 if ($mergetable == false) {
713dfc4 Marc Delisle bug #1884911 [GUI] Space usage
lem9 authored
771 list($index_size, $index_unit) = PMA_formatByteDown($showtable['Index_length'], $max_digits, $decimals);
41f8199 - added browser icon for each field (count unique values)
Sebastian Mendel authored
772 }
7e409e1 Marc Delisle bug #2802870 [display] Incorrect overhead value for InnoDB
lem9 authored
773 // InnoDB returns a huge value in Data_free, do not use it
774 if (! $is_innodb && isset($showtable['Data_free']) && $showtable['Data_free'] > 0) {
713dfc4 Marc Delisle bug #1884911 [GUI] Space usage
lem9 authored
775 list($free_size, $free_unit) = PMA_formatByteDown($showtable['Data_free'], $max_digits, $decimals);
776 list($effect_size, $effect_unit) = PMA_formatByteDown($showtable['Data_length'] + $showtable['Index_length'] - $showtable['Data_free'], $max_digits, $decimals);
41f8199 - added browser icon for each field (count unique values)
Sebastian Mendel authored
777 } else {
713dfc4 Marc Delisle bug #1884911 [GUI] Space usage
lem9 authored
778 list($effect_size, $effect_unit) = PMA_formatByteDown($showtable['Data_length'] + $showtable['Index_length'], $max_digits, $decimals);
41f8199 - added browser icon for each field (count unique values)
Sebastian Mendel authored
779 }
713dfc4 Marc Delisle bug #1884911 [GUI] Space usage
lem9 authored
780 list($tot_size, $tot_unit) = PMA_formatByteDown($showtable['Data_length'] + $showtable['Index_length'], $max_digits, $decimals);
41f8199 - added browser icon for each field (count unique values)
Sebastian Mendel authored
781 if ($table_info_num_rows > 0) {
782 list($avg_size, $avg_unit) = PMA_formatByteDown(($showtable['Data_length'] + $showtable['Index_length']) / $showtable['Rows'], 6, 1);
783 }
6f03a58 Marc Delisle new
lem9 authored
784
41f8199 - added browser icon for each field (count unique values)
Sebastian Mendel authored
785 // Displays them
786 $odd_row = false;
787 ?>
788
789 <a name="showusage"></a>
d69c350 - fixed bug #1420474 'Consistency (order of truncate/drop)'
Sebastian Mendel authored
790 <?php if (! $tbl_is_view && ! $db_is_information_schema) { ?>
41f8199 - added browser icon for each field (count unique values)
Sebastian Mendel authored
791 <table id="tablespaceusage" class="data">
f55823f Marc Delisle strings to gettext, first batch
lem9 authored
792 <caption class="tblHeaders"><?php echo __('Space usage'); ?></caption>
41f8199 - added browser icon for each field (count unique values)
Sebastian Mendel authored
793 <thead>
794 <tr>
f55823f Marc Delisle strings to gettext, first batch
lem9 authored
795 <th><?php echo __('Type'); ?></th>
796 <th colspan="2"><?php echo __('Usage'); ?></th>
41f8199 - added browser icon for each field (count unique values)
Sebastian Mendel authored
797 </tr>
798 </thead>
799 <tbody>
800 <tr class="<?php echo ($odd_row = !$odd_row) ? 'odd' : 'even'; ?>">
f55823f Marc Delisle strings to gettext, first batch
lem9 authored
801 <th class="name"><?php echo __('Data'); ?></th>
41f8199 - added browser icon for each field (count unique values)
Sebastian Mendel authored
802 <td class="value"><?php echo $data_size; ?></td>
803 <td class="unit"><?php echo $data_unit; ?></td>
804 </tr>
805 <?php
d69c350 - fixed bug #1420474 'Consistency (order of truncate/drop)'
Sebastian Mendel authored
806 if (isset($index_size)) {
41f8199 - added browser icon for each field (count unique values)
Sebastian Mendel authored
807 ?>
808 <tr class="<?php echo ($odd_row = !$odd_row) ? 'odd' : 'even'; ?>">
f55823f Marc Delisle strings to gettext, first batch
lem9 authored
809 <th class="name"><?php echo __('Index'); ?></th>
41f8199 - added browser icon for each field (count unique values)
Sebastian Mendel authored
810 <td class="value"><?php echo $index_size; ?></td>
811 <td class="unit"><?php echo $index_unit; ?></td>
812 </tr>
a47d428 Alexander M. Turek Views
derrabus authored
813 <?php
41f8199 - added browser icon for each field (count unique values)
Sebastian Mendel authored
814 }
d69c350 - fixed bug #1420474 'Consistency (order of truncate/drop)'
Sebastian Mendel authored
815 if (isset($free_size)) {
a47d428 Alexander M. Turek Views
derrabus authored
816 ?>
73c57b0 Marc Delisle Continue to replace warning level with error level
lem9 authored
817 <tr class="<?php echo ($odd_row = !$odd_row) ? 'odd' : 'even'; ?> error">
f55823f Marc Delisle strings to gettext, first batch
lem9 authored
818 <th class="name"><?php echo __('Overhead'); ?></th>
41f8199 - added browser icon for each field (count unique values)
Sebastian Mendel authored
819 <td class="value"><?php echo $free_size; ?></td>
820 <td class="unit"><?php echo $free_unit; ?></td>
821 </tr>
822 <tr class="<?php echo ($odd_row = !$odd_row) ? 'odd' : 'even'; ?>">
f55823f Marc Delisle strings to gettext, first batch
lem9 authored
823 <th class="name"><?php echo __('Effective'); ?></th>
41f8199 - added browser icon for each field (count unique values)
Sebastian Mendel authored
824 <td class="value"><?php echo $effect_size; ?></td>
825 <td class="unit"><?php echo $effect_unit; ?></td>
826 </tr>
827 <?php
828 }
d69c350 - fixed bug #1420474 'Consistency (order of truncate/drop)'
Sebastian Mendel authored
829 if (isset($tot_size) && $mergetable == false) {
a47d428 Alexander M. Turek Views
derrabus authored
830 ?>
41f8199 - added browser icon for each field (count unique values)
Sebastian Mendel authored
831 <tr class="<?php echo ($odd_row = !$odd_row) ? 'odd' : 'even'; ?>">
f55823f Marc Delisle strings to gettext, first batch
lem9 authored
832 <th class="name"><?php echo __('Total'); ?></th>
41f8199 - added browser icon for each field (count unique values)
Sebastian Mendel authored
833 <td class="value"><?php echo $tot_size; ?></td>
834 <td class="unit"><?php echo $tot_unit; ?></td>
835 </tr>
a47d428 Alexander M. Turek Views
derrabus authored
836 <?php
41f8199 - added browser icon for each field (count unique values)
Sebastian Mendel authored
837 }
838 // Optimize link if overhead
2d4b9e2 Marc Delisle support ARIA storage engine as well as its previous name MARIA
lem9 authored
839 if (isset($free_size) && ($tbl_type == 'MYISAM' || $tbl_type == 'ARIA' || $tbl_type == 'MARIA' || $tbl_type == 'BDB')) {
a47d428 Alexander M. Turek Views
derrabus authored
840 ?>
0237ab7 revised XHTML output
Sebastian Mendel authored
841 <tr class="tblFooters">
41f8199 - added browser icon for each field (count unique values)
Sebastian Mendel authored
842 <td colspan="3" align="center">
843 <a href="sql.php?<?php echo $url_query; ?>&pos=0&amp;sql_query=<?php echo urlencode('OPTIMIZE TABLE ' . PMA_backquote($table)); ?>"><?php
844 if ($cfg['PropertiesIconic']) {
f55823f Marc Delisle strings to gettext, first batch
lem9 authored
845 echo '<img class="icon" src="' . $pmaThemeImage . 'b_tbloptimize.png" width="16" height="16" alt="' . __('Optimize table'). '" />';
41f8199 - added browser icon for each field (count unique values)
Sebastian Mendel authored
846 }
f55823f Marc Delisle strings to gettext, first batch
lem9 authored
847 echo __('Optimize table');
41f8199 - added browser icon for each field (count unique values)
Sebastian Mendel authored
848 ?></a>
849 </td>
850 </tr>
a47d428 Alexander M. Turek Views
derrabus authored
851 <?php
852 }
41f8199 - added browser icon for each field (count unique values)
Sebastian Mendel authored
853 ?>
854 </tbody>
855 </table>
856 <?php
857 }
858 $odd_row = false;
859 ?>
860 <table id="tablerowstats" class="data">
f55823f Marc Delisle strings to gettext, first batch
lem9 authored
861 <caption class="tblHeaders"><?php echo __('Row Statistics'); ?></caption>
41f8199 - added browser icon for each field (count unique values)
Sebastian Mendel authored
862 <thead>
863 <tr>
f55823f Marc Delisle strings to gettext, first batch
lem9 authored
864 <th><?php echo __('Statements'); ?></th>
865 <th><?php echo __('Value'); ?></th>
41f8199 - added browser icon for each field (count unique values)
Sebastian Mendel authored
866 </tr>
867 </thead>
868 <tbody>
869 <?php
870 if (isset($showtable['Row_format'])) {
871 ?>
872 <tr class="<?php echo ($odd_row = !$odd_row) ? 'odd' : 'even'; ?>">
f55823f Marc Delisle strings to gettext, first batch
lem9 authored
873 <th class="name"><?php echo __('Format'); ?></th>
41f8199 - added browser icon for each field (count unique values)
Sebastian Mendel authored
874 <td class="value"><?php
875 if ($showtable['Row_format'] == 'Fixed') {
f55823f Marc Delisle strings to gettext, first batch
lem9 authored
876 echo __('static');
0ae8842 (not complete) PEAR coding standard
Sebastian Mendel authored
877 } elseif ($showtable['Row_format'] == 'Dynamic') {
f55823f Marc Delisle strings to gettext, first batch
lem9 authored
878 echo __('dynamic');
0ae8842 (not complete) PEAR coding standard
Sebastian Mendel authored
879 } else {
41f8199 - added browser icon for each field (count unique values)
Sebastian Mendel authored
880 echo $showtable['Row_format'];
881 }
882 ?></td>
883 </tr>
884 <?php
885 }
84be802 Marc Delisle Partitioned status in table Structure
lem9 authored
886 if (! empty($showtable['Create_options'])) {
887 ?>
888 <tr class="<?php echo ($odd_row = !$odd_row) ? 'odd' : 'even'; ?>">
f55823f Marc Delisle strings to gettext, first batch
lem9 authored
889 <th class="name"><?php echo __('Options'); ?></th>
84be802 Marc Delisle Partitioned status in table Structure
lem9 authored
890 <td class="value"><?php
891 if ($showtable['Create_options'] == 'partitioned') {
f55823f Marc Delisle strings to gettext, first batch
lem9 authored
892 echo __('partitioned');
84be802 Marc Delisle Partitioned status in table Structure
lem9 authored
893 } else {
894 echo $showtable['Create_options'];
895 }
896 ?></td>
897 </tr>
898 <?php
899 }
3737060 removed MySQL < 5 code
Sebastian Mendel authored
900 if (!empty($tbl_collation)) {
41f8199 - added browser icon for each field (count unique values)
Sebastian Mendel authored
901 ?>
902 <tr class="<?php echo ($odd_row = !$odd_row) ? 'odd' : 'even'; ?>">
f55823f Marc Delisle strings to gettext, first batch
lem9 authored
903 <th class="name"><?php echo __('Collation'); ?></th>
41f8199 - added browser icon for each field (count unique values)
Sebastian Mendel authored
904 <td class="value"><?php
905 echo '<dfn title="' . PMA_getCollationDescr($tbl_collation) . '">' . $tbl_collation . '</dfn>';
906 ?></td>
907 </tr>
908 <?php
909 }
910 if (!$is_innodb && isset($showtable['Rows'])) {
911 ?>
912 <tr class="<?php echo ($odd_row = !$odd_row) ? 'odd' : 'even'; ?>">
f55823f Marc Delisle strings to gettext, first batch
lem9 authored
913 <th class="name"><?php echo __('Rows'); ?></th>
d69c350 - fixed bug #1420474 'Consistency (order of truncate/drop)'
Sebastian Mendel authored
914 <td class="value"><?php echo PMA_formatNumber($showtable['Rows'], 0); ?></td>
41f8199 - added browser icon for each field (count unique values)
Sebastian Mendel authored
915 </tr>
916 <?php
917 }
918 if (!$is_innodb && isset($showtable['Avg_row_length']) && $showtable['Avg_row_length'] > 0) {
919 ?>
920 <tr class="<?php echo ($odd_row = !$odd_row) ? 'odd' : 'even'; ?>">
f55823f Marc Delisle strings to gettext, first batch
lem9 authored
921 <th class="name"><?php echo __('Row length'); ?> &oslash;</th>
d69c350 - fixed bug #1420474 'Consistency (order of truncate/drop)'
Sebastian Mendel authored
922 <td class="value"><?php echo PMA_formatNumber($showtable['Avg_row_length'], 0); ?></td>
41f8199 - added browser icon for each field (count unique values)
Sebastian Mendel authored
923 </tr>
924 <?php
925 }
d69c350 - fixed bug #1420474 'Consistency (order of truncate/drop)'
Sebastian Mendel authored
926 if (!$is_innodb && isset($showtable['Data_length']) && $showtable['Rows'] > 0 && $mergetable == false) {
41f8199 - added browser icon for each field (count unique values)
Sebastian Mendel authored
927 ?>
928 <tr class="<?php echo ($odd_row = !$odd_row) ? 'odd' : 'even'; ?>">
f55823f Marc Delisle strings to gettext, first batch
lem9 authored
929 <th class="name"><?php echo __(' Row size '); ?> &oslash;</th>
41f8199 - added browser icon for each field (count unique values)
Sebastian Mendel authored
930 <td class="value"><?php echo $avg_size . ' ' . $avg_unit; ?></td>
931 </tr>
932 <?php
933 }
934 if (isset($showtable['Auto_increment'])) {
935 ?>
936 <tr class="<?php echo ($odd_row = !$odd_row) ? 'odd' : 'even'; ?>">
f55823f Marc Delisle strings to gettext, first batch
lem9 authored
937 <th class="name"><?php echo __('Next'); ?> Autoindex</th>
d69c350 - fixed bug #1420474 'Consistency (order of truncate/drop)'
Sebastian Mendel authored
938 <td class="value"><?php echo PMA_formatNumber($showtable['Auto_increment'], 0); ?></td>
41f8199 - added browser icon for each field (count unique values)
Sebastian Mendel authored
939 </tr>
940 <?php
941 }
942 if (isset($showtable['Create_time'])) {
943 ?>
944 <tr class="<?php echo ($odd_row = !$odd_row) ? 'odd' : 'even'; ?>">
f55823f Marc Delisle strings to gettext, first batch
lem9 authored
945 <th class="name"><?php echo __('Creation'); ?></th>
41f8199 - added browser icon for each field (count unique values)
Sebastian Mendel authored
946 <td class="value"><?php echo PMA_localisedDate(strtotime($showtable['Create_time'])); ?></td>
947 </tr>
948 <?php
6f03a58 Marc Delisle new
lem9 authored
949 }
41f8199 - added browser icon for each field (count unique values)
Sebastian Mendel authored
950 if (isset($showtable['Update_time'])) {
951 ?>
952 <tr class="<?php echo ($odd_row = !$odd_row) ? 'odd' : 'even'; ?>">
f55823f Marc Delisle strings to gettext, first batch
lem9 authored
953 <th class="name"><?php echo __('Last update'); ?></th>
41f8199 - added browser icon for each field (count unique values)
Sebastian Mendel authored
954 <td class="value"><?php echo PMA_localisedDate(strtotime($showtable['Update_time'])); ?></td>
955 </tr>
956 <?php
957 }
958 if (isset($showtable['Check_time'])) {
959 ?>
960 <tr class="<?php echo ($odd_row = !$odd_row) ? 'odd' : 'even'; ?>">
f55823f Marc Delisle strings to gettext, first batch
lem9 authored
961 <th class="name"><?php echo __('Last check'); ?></th>
41f8199 - added browser icon for each field (count unique values)
Sebastian Mendel authored
962 <td class="value"><?php echo PMA_localisedDate(strtotime($showtable['Check_time'])); ?></td>
963 </tr>
964 <?php
965 }
966 ?>
967 </tbody>
968 </table>
2d8b20a Fix slider on table properties page.
s.troxler authored
969
84006bf Marc Delisle Put back the div that was generated by previous slider
lem9 authored
970 <!-- close tablestatistics div -->
2d8b20a Fix slider on table properties page.
s.troxler authored
971 </div>
972
41f8199 - added browser icon for each field (count unique values)
Sebastian Mendel authored
973 <?php
974 }
975 // END - Calc Table Space
573a616 fixed code indention
Sebastian Mendel authored
976
977 require './libraries/tbl_triggers.lib.php';
978
41f8199 - added browser icon for each field (count unique values)
Sebastian Mendel authored
979 echo '<div class="clearfloat"></div>' . "\n";
a47d428 Alexander M. Turek Views
derrabus authored
980
947de9c Marc Delisle distinct query box logic
lem9 authored
981 /**
6f03a58 Marc Delisle new
lem9 authored
982 * Displays the footer
983 */
d291827 Michal Čihař No need to require_once footer
nijel authored
984 require './libraries/footer.inc.php';
9270780 Michal Čihař Go back to tbl_properties_structure.php3 when not dropping table.
nijel authored
985 ?>
Something went wrong with that request. Please try again.