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) {
30 $query_type = 'check_tbl';
33 case $strOptimizeTable:
35 $query_type = 'optimize_tbl';
40 $query_type = 'repair_tbl';
43 case $strAnalyzeTable:
45 $query_type = 'analyze_tbl';
51 $selected = $selected_fld;
52 if ($submit_mult == $strDrop) {
55 include('./tbl_alter.php3');
63 * Displays the confirmation form if required
65 if (!empty($submit_mult) && !empty($what)) {
66 $js_to_run = 'functions.js';
69 include('./tbl_properties_common.php3');
70 $url_query .= '&goto=tbl_properties.php3&back=tbl_properties.php3';
71 include('./tbl_properties_table_info.php3');
74 include('./db_details_common.php3');
75 include('./db_details_db_info.php3');
79 $selected_cnt = count($selected);
80 for ($i = 0; $i < $selected_cnt; $i++
) {
83 $full_query .= 'DROP DATABASE '
84 . PMA_backquote(htmlspecialchars(urldecode($selected[$i])))
89 $full_query .= (empty($full_query) ?
'DROP TABLE ' : ', ')
90 . PMA_backquote(htmlspecialchars(urldecode($selected[$i])))
91 . (($i == $selected_cnt - 1) ?
';<br />' : '');
95 if (PMA_MYSQL_INT_VERSION
>= 40000) {
96 $full_query .= 'TRUNCATE ';
98 $full_query .= 'DELETE FROM ';
100 $full_query .= PMA_backquote(htmlspecialchars(urldecode($selected[$i])))
105 if ($full_query == '') {
106 $full_query .= 'ALTER TABLE '
107 . PMA_backquote(htmlspecialchars($table))
108 . '<br /> DROP '
109 . PMA_backquote(htmlspecialchars(urldecode($selected[$i])))
112 $full_query .= '<br /> DROP '
113 . PMA_backquote(htmlspecialchars(urldecode($selected[$i])))
116 if ($i == $selected_cnt-1) {
117 $full_query = ereg_replace(',$', ';<br />', $full_query);
124 echo $strDoYouReally . ' :<br />' . "\n";
125 echo '<tt>' . $full_query . '</tt> ?<br/>' . "\n";
127 <form action
="<?php echo $action; ?>" method
="post">
130 if (strpos(' ' . $action, 'db_details') == 1) {
131 echo PMA_generate_common_hidden_inputs($db);
132 } else if (strpos(' ' . $action, 'tbl_properties') == 1) {
133 echo PMA_generate_common_hidden_inputs($db,$table);
135 for ($i = 0; $i < $selected_cnt; $i++
) {
136 echo ' <input type="hidden" name="selected[]" value="' . htmlspecialchars($selected[$i]) . '" />' . "\n";
139 <input type
="hidden" name
="query_type" value
="<?php echo $what; ?>" />
140 <input type
="submit" name
="mult_btn" value
="<?php echo $strYes; ?>" />
141 <input type
="submit" name
="mult_btn" value
="<?php echo $strNo; ?>" />
146 include('./footer.inc.php3');
154 else if ($mult_btn == $strYes) {
157 $selected_cnt = count($selected);
158 for ($i = 0; $i < $selected_cnt; $i++
) {
159 switch ($query_type) {
161 $a_query = 'DROP DATABASE '
162 . PMA_backquote(urldecode($selected[$i]));
167 $sql_query .= (empty($sql_query) ?
'DROP TABLE ' : ', ')
168 . PMA_backquote(urldecode($selected[$i]))
169 . (($i == $selected_cnt-1) ?
';' : '');
174 $sql_query .= (empty($sql_query) ?
'CHECK TABLE ' : ', ')
175 . PMA_backquote(urldecode($selected[$i]));
179 $sql_query .= (empty($sql_query) ?
'OPTIMIZE TABLE ' : ', ')
180 . PMA_backquote(urldecode($selected[$i]));
184 $sql_query .= (empty($sql_query) ?
'ANALYZE TABLE ' : ', ')
185 . PMA_backquote(urldecode($selected[$i]));
189 $sql_query .= (empty($sql_query) ?
'REPAIR TABLE ' : ', ')
190 . PMA_backquote(urldecode($selected[$i]));
194 $a_query = 'DELETE FROM '
195 . PMA_backquote(urldecode($selected[$i]));
199 $sql_query .= (empty($sql_query) ?
'ALTER TABLE ' . PMA_backquote($table) : ',')
200 . ' DROP ' . PMA_backquote(urldecode($selected[$i]))
201 . (($i == $selected_cnt-1) ?
';' : '');
205 // All "DROP TABLE","DROP FIELD", "OPTIMIZE TABLE" and "REPAIR TABLE"
206 // statements will be run at once below
207 if ($query_type != 'drop_tbl'
208 && $query_type != 'drop_fld'
209 && $query_type != 'repair_tbl'
210 && $query_type != 'analyze_tbl'
211 && $query_type != 'optimize_tbl'
212 && $query_type != 'check_tbl') {
213 $sql_query .= $a_query . ';' . "\n";
215 if ($query_type != 'drop_db') {
216 PMA_mysql_select_db($db);
218 $result = @PMA_mysql_query
($a_query) or PMA_mysqlDie('', $a_query, FALSE, $err_url);
222 if ($query_type == 'drop_tbl'
223 ||
$query_type == 'drop_fld') {
224 PMA_mysql_select_db($db);
225 $result = @PMA_mysql_query
($sql_query) or PMA_mysqlDie('', '', FALSE, $err_url);
226 } elseif ($query_type == 'repair_tbl'
227 ||
$query_type == 'analyze_tbl'
228 ||
$query_type == 'check_tbl'
229 ||
$query_type == 'optimize_tbl') {
230 include('./sql.php3');