Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2015-03-29 14:00:53 +02:00
commit 103dc7e210
2 changed files with 25 additions and 9 deletions

View File

@ -100,6 +100,7 @@ explanation
- bug #4802 Changelog page is not working
- bug #4815 Infinite calls to index.php
- bug #4820 Invalid links to dev.mysql.com
- bug #4718 simulate query fails, but actual query does not
4.3.12.0 (2015-03-14)
- bug #4746 Right-aligned columns have left-aligned header

View File

@ -1484,11 +1484,12 @@ function PMA_getMatchedRows($analyzed_sql_results = array())
function PMA_getSimulatedUpdateQuery($analyzed_sql_results)
{
$where_clause = '';
$extra_where_clause = '';
$extra_where_clause = array();
$target_cols = array();
$prev_term = '';
$i = 0;
$in_function = 0;
foreach ($analyzed_sql_results['parsed_sql'] as $key => $term) {
if (! isset($get_set_expr)
&& preg_match(
@ -1508,19 +1509,33 @@ function PMA_getSimulatedUpdateQuery($analyzed_sql_results)
) {
break;
}
if(!$in_function){
if ($term['type'] == 'punct_listsep') {
$extra_where_clause[] = ' OR ';
} else if ($term['type'] == 'punct') {
$extra_where_clause[] = ' <> ';
} else if($term['type'] == 'alpha_functionName') {
array_pop($extra_where_clause);
array_pop($extra_where_clause);
} else {
$extra_where_clause[] = $term['data'];
}
}
else if($term['type'] == 'punct_bracket_close_round') {
$in_function--;
}
if ($term['type'] == 'punct_listsep') {
$extra_where_clause .= ' OR ';
} else if ($term['type'] == 'punct') {
$extra_where_clause .= ' <> ';
} else {
$extra_where_clause .= $term['data'];
if($term['type'] == 'alpha_functionName') {
$in_function++;
}
// Get columns in SET expression.
if ($prev_term != 'punct') {
if ($term['type'] != 'punct_listsep'
&& $term['type'] != 'punct'
&& $term['type'] != 'punct_bracket_open_round'
&& $term['type'] != 'punct_bracket_close_round'
&& !$in_function
&& isset($term['data'])
) {
if (isset($target_cols[$i])) {
@ -1544,8 +1559,8 @@ function PMA_getSimulatedUpdateQuery($analyzed_sql_results)
// Get WHERE clause.
$where_clause .= $analyzed_sql_results['analyzed_sql'][0]['where_clause'];
if (empty($where_clause) && empty($extra_where_clause)) {
$where_clause = '1';
if (empty($where_clause)) {
$where_clause = (!empty($extra_where_clause) && $extra_where_clause[0]) ? implode(' ',$extra_where_clause) : '1';
}
$matched_row_query = 'SELECT '