diff --git a/ChangeLog b/ChangeLog index fad487a23..bda572dee 100644 --- a/ChangeLog +++ b/ChangeLog @@ -15,6 +15,7 @@ $HeadURL$ - bug #1666657 Cookie password delete on timeout / inactivity - bug #1648802 different mysql library and server version - bug #1239401 table dot numeric field name +- bug #1674972 no export with %afm% - [gui] avoid displaying a wide selector in server selection + [core] added PMA_fatalError() and made use of it . [i18n] use generic $strOptions diff --git a/tbl_export.php b/tbl_export.php index d4ea66b61..f96a11b5c 100644 --- a/tbl_export.php +++ b/tbl_export.php @@ -39,16 +39,21 @@ if (isset($sql_query)) { $sql_query .= ' FROM ' . $analyzed_sql[0]['from_clause']; } - if (isset($primary_key) && is_array($primary_key)) { - $sql_query .= ' WHERE '; - $conj = ''; - foreach ($primary_key AS $i => $key) { - $sql_query .= $conj . '( ' . $key . ' ) '; - $conj = 'OR '; - } - } elseif (!empty($analyzed_sql[0]['where_clause'])) { - $sql_query .= ' WHERE ' . $analyzed_sql[0]['where_clause']; + $wheres = array(); + + if (isset($primary_key) && is_array($primary_key) + && count($primary_key) > 0) { + $wheres[] = '(' . implode(') OR (',$primary_key) . ')'; } + + if (!empty($analyzed_sql[0]['where_clause'])) { + $wheres[] = $analyzed_sql[0]['where_clause']; + } + + if (count($wheres) > 0 ) { + $sql_query .= ' WHERE (' . implode(') AND (', $wheres) . ')'; + } + if (!empty($analyzed_sql[0]['group_by_clause'])) { $sql_query .= ' GROUP BY ' . $analyzed_sql[0]['group_by_clause']; } @@ -72,20 +77,20 @@ if (isset($sql_query)) { } if (!$inside_bracket && $parsed_sql[$i]['type'] == 'alpha_reservedWord' && strtoupper($parsed_sql[$i]['data']) == 'LIMIT') { // We found LIMIT to remove - + $sql_query = ''; - + // Concatenate parts before for ($j = 0; $j < $i; $j++) { $sql_query .= $parsed_sql[$j]['data'] . ' '; } - + // Skip LIMIT $i++; while ($i < $parsed_sql['len'] && - ($parsed_sql[$i]['type'] != 'alpha_reservedWord' || - ($parsed_sql[$i]['type'] == 'alpha_reservedWord' && $parsed_sql[$i]['data'] == 'OFFSET'))) { - $i++; + ($parsed_sql[$i]['type'] != 'alpha_reservedWord' || + ($parsed_sql[$i]['type'] == 'alpha_reservedWord' && $parsed_sql[$i]['data'] == 'OFFSET'))) { + $i++; } // Add remaining parts diff --git a/tbl_row_action.php b/tbl_row_action.php index 9c2b7c36a..d61839bab 100644 --- a/tbl_row_action.php +++ b/tbl_row_action.php @@ -81,7 +81,7 @@ if (!empty($submit_mult)) { foreach ($rows_to_delete AS $i_primary_key => $del_query) { $primary_key[] = urldecode($i_primary_key); } - + $active_page = 'tbl_change.php'; include './tbl_change.php'; break; @@ -91,7 +91,7 @@ if (!empty($submit_mult)) { $single_table = TRUE; $primary_key = array(); - $sql_query = urldecode($sql_query); + //$sql_query = urldecode($sql_query); // garvin: As we got the fields to be edited from the 'rows_to_delete' checkbox, we use the index of it as the // indicating primary key. Then we built the array which is used for the tbl_change.php script. foreach ($rows_to_delete AS $i_primary_key => $del_query) {