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 && ($submit_mult != $strWithChecked)
11 && ( !empty($selected_db)
12 ||
!empty($selected_tbl)
13 ||
!empty($selected_fld)
14 ||
!empty($rows_to_delete)
17 if (!empty($selected_db)) {
18 $selected = $selected_db;
20 } else if (!empty($selected_tbl)) {
21 if ($submit_mult == $strPrintView) {
22 require('./tbl_printview.php');
24 $selected = $selected_tbl;
25 switch ($submit_mult) {
37 $query_type = 'check_tbl';
40 case $strOptimizeTable:
42 $query_type = 'optimize_tbl';
47 $query_type = 'repair_tbl';
50 case $strAnalyzeTable:
52 $query_type = 'analyze_tbl';
57 } else if (!empty($selected_fld)) {
58 $selected = $selected_fld;
59 if ($submit_mult == $strDrop) {
62 require('./tbl_alter.php');
66 $selected = $rows_to_delete;
72 * Displays the confirmation form if required
74 if (!empty($submit_mult) && !empty($what)) {
75 $js_to_run = 'functions.js';
78 require('./tbl_properties_common.php');
79 $url_query .= '&goto=tbl_properties.php&back=tbl_properties.php';
80 require('./tbl_properties_table_info.php');
82 elseif (!empty($db)) {
83 require('./db_details_common.php');
84 require('./db_details_db_info.php');
88 $selected_cnt = count($selected);
90 foreach($selected AS $idx => $sval) {
94 $full_query .= htmlspecialchars(urldecode($sval))
98 $full_query .= 'DROP DATABASE '
99 . PMA_backquote(htmlspecialchars(urldecode($sval)))
104 $full_query .= (empty($full_query) ?
'DROP TABLE ' : ', ')
105 . PMA_backquote(htmlspecialchars(urldecode($sval)))
106 . (($i == $selected_cnt - 1) ?
';<br />' : '');
110 if (PMA_MYSQL_INT_VERSION
>= 40000) {
111 $full_query .= 'TRUNCATE ';
113 $full_query .= 'DELETE FROM ';
115 $full_query .= PMA_backquote(htmlspecialchars(urldecode($sval)))
120 if ($full_query == '') {
121 $full_query .= 'ALTER TABLE '
122 . PMA_backquote(htmlspecialchars($table))
123 . '<br /> DROP '
124 . PMA_backquote(htmlspecialchars(urldecode($sval)))
127 $full_query .= '<br /> DROP '
128 . PMA_backquote(htmlspecialchars(urldecode($sval)))
131 if ($i == $selected_cnt-1) {
132 $full_query = preg_replace('@,$@', ';<br />', $full_query);
139 echo $strDoYouReally . ' :<br />' . "\n";
140 echo '<tt>' . $full_query . '</tt> ?<br/>' . "\n";
142 <form action
="<?php echo $action; ?>" method
="post">
145 if (strpos(' ' . $action, 'db_details') == 1) {
146 echo PMA_generate_common_hidden_inputs($db);
147 } else if (strpos(' ' . $action, 'tbl_properties') == 1
148 ||
$what == 'row_delete') {
149 echo PMA_generate_common_hidden_inputs($db,$table);
151 echo PMA_generate_common_hidden_inputs();
153 foreach($selected AS $idx => $sval) {
154 echo ' <input type="hidden" name="selected[]" value="' . htmlspecialchars($sval) . '" />' . "\n";
157 <input type
="hidden" name
="query_type" value
="<?php echo $what; ?>" />
159 if ($what == 'row_delete') {
160 echo '<input type="hidden" name="original_sql_query" value="' . $original_sql_query . '" />' . "\n";
161 echo '<input type="hidden" name="original_pos" value="' . $original_pos . '" />' . "\n";
162 echo '<input type="hidden" name="original_url_query" value="' . $original_url_query . '" />' . "\n";
165 <input type
="submit" name
="mult_btn" value
="<?php echo $strYes; ?>" />
166 <input type
="submit" name
="mult_btn" value
="<?php echo $strNo; ?>" />
171 require_once('./footer.inc.php');
178 else if ($mult_btn == $strYes) {
180 if ($query_type == 'drop_db' ||
$query_type == 'drop_tbl' ||
$query_type == 'drop_fld') {
181 require_once('./libraries/relation_cleanup.lib.php');
185 $selected_cnt = count($selected);
186 for ($i = 0; $i < $selected_cnt; $i++
) {
187 switch ($query_type) {
189 $a_query = urldecode($selected[$i]);
193 PMA_relationsCleanupDatabase($selected[$i]);
194 $a_query = 'DROP DATABASE '
195 . PMA_backquote(urldecode($selected[$i]));
200 PMA_relationsCleanupTable($db, $selected[$i]);
201 $sql_query .= (empty($sql_query) ?
'DROP TABLE ' : ', ')
202 . PMA_backquote(urldecode($selected[$i]))
203 . (($i == $selected_cnt-1) ?
';' : '');
208 $sql_query .= (empty($sql_query) ?
'CHECK TABLE ' : ', ')
209 . PMA_backquote(urldecode($selected[$i]));
213 $sql_query .= (empty($sql_query) ?
'OPTIMIZE TABLE ' : ', ')
214 . PMA_backquote(urldecode($selected[$i]));
218 $sql_query .= (empty($sql_query) ?
'ANALYZE TABLE ' : ', ')
219 . PMA_backquote(urldecode($selected[$i]));
223 $sql_query .= (empty($sql_query) ?
'REPAIR TABLE ' : ', ')
224 . PMA_backquote(urldecode($selected[$i]));
228 if (PMA_MYSQL_INT_VERSION
>= 40000) {
229 $a_query = 'TRUNCATE ';
231 $a_query = 'DELETE FROM ';
233 $a_query .= PMA_backquote(htmlspecialchars(urldecode($selected[$i])));
237 PMA_relationsCleanupTable($db, $table, $selected[$i]);
238 $sql_query .= (empty($sql_query) ?
'ALTER TABLE ' . PMA_backquote($table) : ',')
239 . ' DROP ' . PMA_backquote(urldecode($selected[$i]))
240 . (($i == $selected_cnt-1) ?
';' : '');
244 // All "DROP TABLE","DROP FIELD", "OPTIMIZE TABLE" and "REPAIR TABLE"
245 // statements will be run at once below
246 if ($query_type != 'drop_tbl'
247 && $query_type != 'drop_fld'
248 && $query_type != 'repair_tbl'
249 && $query_type != 'analyze_tbl'
250 && $query_type != 'optimize_tbl'
251 && $query_type != 'check_tbl') {
253 $sql_query .= $a_query . ';' . "\n";
255 if ($query_type != 'drop_db') {
256 PMA_mysql_select_db($db);
258 $result = @PMA_mysql_query
($a_query) or PMA_mysqlDie('', $a_query, FALSE, $err_url);
262 if ($query_type == 'drop_tbl'
263 ||
$query_type == 'drop_fld') {
264 PMA_mysql_select_db($db);
265 $result = @PMA_mysql_query
($sql_query) or PMA_mysqlDie('', '', FALSE, $err_url);
266 } elseif ($query_type == 'repair_tbl'
267 ||
$query_type == 'analyze_tbl'
268 ||
$query_type == 'check_tbl'
269 ||
$query_type == 'optimize_tbl') {
270 require('./sql.php');