3 // vim: expandtab sw=4 ts=4 sts=4:
7 * Prepares the work and runs some other scripts if required
9 if (!empty($submit_mult)
10 && (!empty($selected_db) ||
!empty($selected_tbl) ||
!empty($selected_fld))) {
12 if (!empty($selected_db)) {
13 $selected = $selected_db;
15 } else if (!empty($selected_tbl)) {
16 if ($submit_mult == $strPrintView) {
17 include('./tbl_printview.php3');
20 $selected = $selected_tbl;
21 switch ($submit_mult) {
33 $query_type = 'check_tbl';
36 case $strOptimizeTable:
38 $query_type = 'optimize_tbl';
43 $query_type = 'repair_tbl';
46 case $strAnalyzeTable:
48 $query_type = 'analyze_tbl';
54 $selected = $selected_fld;
55 if ($submit_mult == $strDrop) {
58 include('./tbl_alter.php3');
66 * Displays the confirmation form if required
68 if (!empty($submit_mult) && !empty($what)) {
69 $js_to_run = 'functions.js';
72 include('./tbl_properties_common.php3');
73 $url_query .= '&goto=tbl_properties.php3&back=tbl_properties.php3';
74 include('./tbl_properties_table_info.php3');
76 elseif (!empty($db)) {
77 include('./db_details_common.php3');
78 include('./db_details_db_info.php3');
82 $selected_cnt = count($selected);
83 for ($i = 0; $i < $selected_cnt; $i++
) {
86 $full_query .= 'DROP DATABASE '
87 . PMA_backquote(htmlspecialchars(urldecode($selected[$i])))
92 $full_query .= (empty($full_query) ?
'DROP TABLE ' : ', ')
93 . PMA_backquote(htmlspecialchars(urldecode($selected[$i])))
94 . (($i == $selected_cnt - 1) ?
';<br />' : '');
98 if (PMA_MYSQL_INT_VERSION
>= 40000) {
99 $full_query .= 'TRUNCATE ';
101 $full_query .= 'DELETE FROM ';
103 $full_query .= PMA_backquote(htmlspecialchars(urldecode($selected[$i])))
108 if ($full_query == '') {
109 $full_query .= 'ALTER TABLE '
110 . PMA_backquote(htmlspecialchars($table))
111 . '<br /> DROP '
112 . PMA_backquote(htmlspecialchars(urldecode($selected[$i])))
115 $full_query .= '<br /> DROP '
116 . PMA_backquote(htmlspecialchars(urldecode($selected[$i])))
119 if ($i == $selected_cnt-1) {
120 $full_query = ereg_replace(',$', ';<br />', $full_query);
127 echo $strDoYouReally . ' :<br />' . "\n";
128 echo '<tt>' . $full_query . '</tt> ?<br/>' . "\n";
130 <form action
="<?php echo $action; ?>" method
="post">
133 if (strpos(' ' . $action, 'db_details') == 1) {
134 echo PMA_generate_common_hidden_inputs($db);
135 } else if (strpos(' ' . $action, 'tbl_properties') == 1) {
136 echo PMA_generate_common_hidden_inputs($db,$table);
138 echo PMA_generate_common_hidden_inputs();
140 for ($i = 0; $i < $selected_cnt; $i++
) {
141 echo ' <input type="hidden" name="selected[]" value="' . htmlspecialchars($selected[$i]) . '" />' . "\n";
144 <input type
="hidden" name
="query_type" value
="<?php echo $what; ?>" />
145 <input type
="submit" name
="mult_btn" value
="<?php echo $strYes; ?>" />
146 <input type
="submit" name
="mult_btn" value
="<?php echo $strNo; ?>" />
151 include('./footer.inc.php3');
159 else if ($mult_btn == $strYes) {
161 if ($query_type == 'drop_db' ||
$query_type == 'drop_tbl' ||
$query_type == 'drop_fld') {
162 include('./libraries/relation_cleanup.lib.php3');
166 $selected_cnt = count($selected);
167 for ($i = 0; $i < $selected_cnt; $i++
) {
168 switch ($query_type) {
170 PMA_relationsCleanupDatabase($selected[$i]);
171 $a_query = 'DROP DATABASE '
172 . PMA_backquote(urldecode($selected[$i]));
177 PMA_relationsCleanupTable($db, $selected[$i]);
178 $sql_query .= (empty($sql_query) ?
'DROP TABLE ' : ', ')
179 . PMA_backquote(urldecode($selected[$i]))
180 . (($i == $selected_cnt-1) ?
';' : '');
185 $sql_query .= (empty($sql_query) ?
'CHECK TABLE ' : ', ')
186 . PMA_backquote(urldecode($selected[$i]));
190 $sql_query .= (empty($sql_query) ?
'OPTIMIZE TABLE ' : ', ')
191 . PMA_backquote(urldecode($selected[$i]));
195 $sql_query .= (empty($sql_query) ?
'ANALYZE TABLE ' : ', ')
196 . PMA_backquote(urldecode($selected[$i]));
200 $sql_query .= (empty($sql_query) ?
'REPAIR TABLE ' : ', ')
201 . PMA_backquote(urldecode($selected[$i]));
205 if (PMA_MYSQL_INT_VERSION
>= 40000) {
206 $a_query .= 'TRUNCATE ';
208 $a_query .= 'DELETE FROM ';
210 $a_query .= PMA_backquote(htmlspecialchars(urldecode($selected[$i])));
214 PMA_relationsCleanupTable($db, $table, $selected[$i]);
215 $sql_query .= (empty($sql_query) ?
'ALTER TABLE ' . PMA_backquote($table) : ',')
216 . ' DROP ' . PMA_backquote(urldecode($selected[$i]))
217 . (($i == $selected_cnt-1) ?
';' : '');
221 // All "DROP TABLE","DROP FIELD", "OPTIMIZE TABLE" and "REPAIR TABLE"
222 // statements will be run at once below
223 if ($query_type != 'drop_tbl'
224 && $query_type != 'drop_fld'
225 && $query_type != 'repair_tbl'
226 && $query_type != 'analyze_tbl'
227 && $query_type != 'optimize_tbl'
228 && $query_type != 'check_tbl') {
230 $sql_query .= $a_query . ';' . "\n";
232 if ($query_type != 'drop_db') {
233 PMA_mysql_select_db($db);
235 $result = @PMA_mysql_query
($a_query) or PMA_mysqlDie('', $a_query, FALSE, $err_url);
239 if ($query_type == 'drop_tbl'
240 ||
$query_type == 'drop_fld') {
241 PMA_mysql_select_db($db);
242 $result = @PMA_mysql_query
($sql_query) or PMA_mysqlDie('', '', FALSE, $err_url);
243 } elseif ($query_type == 'repair_tbl'
244 ||
$query_type == 'analyze_tbl'
245 ||
$query_type == 'check_tbl'
246 ||
$query_type == 'optimize_tbl') {
247 include('./sql.php3');