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) ||
!empty($selected_tbl) ||
!empty($selected_fld))) {
13 if (!empty($selected_db)) {
14 $selected = $selected_db;
16 } else if (!empty($selected_tbl)) {
17 if ($submit_mult == $strPrintView) {
18 include('./tbl_printview.php3');
21 $selected = $selected_tbl;
22 switch ($submit_mult) {
34 $query_type = 'check_tbl';
37 case $strOptimizeTable:
39 $query_type = 'optimize_tbl';
44 $query_type = 'repair_tbl';
47 case $strAnalyzeTable:
49 $query_type = 'analyze_tbl';
55 $selected = $selected_fld;
56 if ($submit_mult == $strDrop) {
59 include('./tbl_alter.php3');
67 * Displays the confirmation form if required
69 if (!empty($submit_mult) && !empty($what)) {
70 $js_to_run = 'functions.js';
73 include('./tbl_properties_common.php3');
74 $url_query .= '&goto=tbl_properties.php3&back=tbl_properties.php3';
75 include('./tbl_properties_table_info.php3');
77 elseif (!empty($db)) {
78 include('./db_details_common.php3');
79 include('./db_details_db_info.php3');
83 $selected_cnt = count($selected);
84 for ($i = 0; $i < $selected_cnt; $i++
) {
87 $full_query .= 'DROP DATABASE '
88 . PMA_backquote(htmlspecialchars(urldecode($selected[$i])))
93 $full_query .= (empty($full_query) ?
'DROP TABLE ' : ', ')
94 . PMA_backquote(htmlspecialchars(urldecode($selected[$i])))
95 . (($i == $selected_cnt - 1) ?
';<br />' : '');
99 if (PMA_MYSQL_INT_VERSION
>= 40000) {
100 $full_query .= 'TRUNCATE ';
102 $full_query .= 'DELETE FROM ';
104 $full_query .= PMA_backquote(htmlspecialchars(urldecode($selected[$i])))
109 if ($full_query == '') {
110 $full_query .= 'ALTER TABLE '
111 . PMA_backquote(htmlspecialchars($table))
112 . '<br /> DROP '
113 . PMA_backquote(htmlspecialchars(urldecode($selected[$i])))
116 $full_query .= '<br /> DROP '
117 . PMA_backquote(htmlspecialchars(urldecode($selected[$i])))
120 if ($i == $selected_cnt-1) {
121 $full_query = ereg_replace(',$', ';<br />', $full_query);
128 echo $strDoYouReally . ' :<br />' . "\n";
129 echo '<tt>' . $full_query . '</tt> ?<br/>' . "\n";
131 <form action
="<?php echo $action; ?>" method
="post">
134 if (strpos(' ' . $action, 'db_details') == 1) {
135 echo PMA_generate_common_hidden_inputs($db);
136 } else if (strpos(' ' . $action, 'tbl_properties') == 1) {
137 echo PMA_generate_common_hidden_inputs($db,$table);
139 echo PMA_generate_common_hidden_inputs();
141 for ($i = 0; $i < $selected_cnt; $i++
) {
142 echo ' <input type="hidden" name="selected[]" value="' . htmlspecialchars($selected[$i]) . '" />' . "\n";
145 <input type
="hidden" name
="query_type" value
="<?php echo $what; ?>" />
146 <input type
="submit" name
="mult_btn" value
="<?php echo $strYes; ?>" />
147 <input type
="submit" name
="mult_btn" value
="<?php echo $strNo; ?>" />
152 include('./footer.inc.php3');
160 else if ($mult_btn == $strYes) {
162 if ($query_type == 'drop_db' ||
$query_type == 'drop_tbl' ||
$query_type == 'drop_fld') {
163 include('./libraries/relation_cleanup.lib.php3');
167 $selected_cnt = count($selected);
168 for ($i = 0; $i < $selected_cnt; $i++
) {
169 switch ($query_type) {
171 PMA_relationsCleanupDatabase($selected[$i]);
172 $a_query = 'DROP DATABASE '
173 . PMA_backquote(urldecode($selected[$i]));
178 PMA_relationsCleanupTable($db, $selected[$i]);
179 $sql_query .= (empty($sql_query) ?
'DROP TABLE ' : ', ')
180 . PMA_backquote(urldecode($selected[$i]))
181 . (($i == $selected_cnt-1) ?
';' : '');
186 $sql_query .= (empty($sql_query) ?
'CHECK TABLE ' : ', ')
187 . PMA_backquote(urldecode($selected[$i]));
191 $sql_query .= (empty($sql_query) ?
'OPTIMIZE TABLE ' : ', ')
192 . PMA_backquote(urldecode($selected[$i]));
196 $sql_query .= (empty($sql_query) ?
'ANALYZE TABLE ' : ', ')
197 . PMA_backquote(urldecode($selected[$i]));
201 $sql_query .= (empty($sql_query) ?
'REPAIR TABLE ' : ', ')
202 . PMA_backquote(urldecode($selected[$i]));
206 if (PMA_MYSQL_INT_VERSION
>= 40000) {
207 $a_query = 'TRUNCATE ';
209 $a_query = 'DELETE FROM ';
211 $a_query .= PMA_backquote(htmlspecialchars(urldecode($selected[$i])));
215 PMA_relationsCleanupTable($db, $table, $selected[$i]);
216 $sql_query .= (empty($sql_query) ?
'ALTER TABLE ' . PMA_backquote($table) : ',')
217 . ' DROP ' . PMA_backquote(urldecode($selected[$i]))
218 . (($i == $selected_cnt-1) ?
';' : '');
222 // All "DROP TABLE","DROP FIELD", "OPTIMIZE TABLE" and "REPAIR TABLE"
223 // statements will be run at once below
224 if ($query_type != 'drop_tbl'
225 && $query_type != 'drop_fld'
226 && $query_type != 'repair_tbl'
227 && $query_type != 'analyze_tbl'
228 && $query_type != 'optimize_tbl'
229 && $query_type != 'check_tbl') {
231 $sql_query .= $a_query . ';' . "\n";
233 if ($query_type != 'drop_db') {
234 PMA_mysql_select_db($db);
236 $result = @PMA_mysql_query
($a_query) or PMA_mysqlDie('', $a_query, FALSE, $err_url);
240 if ($query_type == 'drop_tbl'
241 ||
$query_type == 'drop_fld') {
242 PMA_mysql_select_db($db);
243 $result = @PMA_mysql_query
($sql_query) or PMA_mysqlDie('', '', FALSE, $err_url);
244 } elseif ($query_type == 'repair_tbl'
245 ||
$query_type == 'analyze_tbl'
246 ||
$query_type == 'check_tbl'
247 ||
$query_type == 'optimize_tbl') {
248 include('./sql.php3');