diff options
-rw-r--r-- | sql/examples/ha_tina.h | 2 | ||||
-rw-r--r-- | sql/field_conv.cc | 4 | ||||
-rw-r--r-- | sql/ha_federated.cc | 39 | ||||
-rw-r--r-- | sql/item.cc | 2 | ||||
-rw-r--r-- | sql/spatial.h | 12 | ||||
-rw-r--r-- | sql/sql_acl.cc | 34 | ||||
-rw-r--r-- | sql/sql_analyse.cc | 2 | ||||
-rw-r--r-- | sql/sql_base.cc | 38 | ||||
-rw-r--r-- | sql/sql_delete.cc | 2 | ||||
-rw-r--r-- | sql/sql_help.cc | 2 | ||||
-rw-r--r-- | sql/sql_insert.cc | 9 | ||||
-rw-r--r-- | sql/sql_lex.cc | 12 | ||||
-rw-r--r-- | sql/sql_load.cc | 8 | ||||
-rw-r--r-- | sql/sql_parse.cc | 28 | ||||
-rw-r--r-- | sql/sql_prepare.cc | 4 | ||||
-rw-r--r-- | sql/sql_select.cc | 52 | ||||
-rw-r--r-- | sql/sql_show.cc | 8 | ||||
-rw-r--r-- | sql/sql_table.cc | 10 | ||||
-rw-r--r-- | sql/sql_trigger.cc | 2 | ||||
-rw-r--r-- | sql/sql_update.cc | 2 | ||||
-rw-r--r-- | sql/sql_view.cc | 6 | ||||
-rw-r--r-- | sql/sql_yacc.yy | 6 | ||||
-rw-r--r-- | sql/table.cc | 8 | ||||
-rw-r--r-- | sql/table.h | 2 | ||||
-rw-r--r-- | sql/time.cc | 8 | ||||
-rw-r--r-- | sql/tztime.cc | 4 | ||||
-rw-r--r-- | sql/uniques.cc | 4 |
27 files changed, 154 insertions, 156 deletions
diff --git a/sql/examples/ha_tina.h b/sql/examples/ha_tina.h index 98cba8bf4cd..a00e8887c7e 100644 --- a/sql/examples/ha_tina.h +++ b/sql/examples/ha_tina.h @@ -29,7 +29,7 @@ typedef struct st_tina_share { THR_LOCK lock; } TINA_SHARE; -typedef struct tina_set { +struct tina_set { off_t begin; off_t end; }; diff --git a/sql/field_conv.cc b/sql/field_conv.cc index 7beb41b8ff1..630372dfac1 100644 --- a/sql/field_conv.cc +++ b/sql/field_conv.cc @@ -761,8 +761,8 @@ int field_conv(Field *to,Field *from) to->table->s->db_low_byte_first == from->table->s->db_low_byte_first && (!(to->table->in_use->variables.sql_mode & (MODE_NO_ZERO_IN_DATE | MODE_NO_ZERO_DATE | MODE_INVALID_DATES)) || - to->type() != FIELD_TYPE_DATE && - to->type() != FIELD_TYPE_DATETIME) && + (to->type() != FIELD_TYPE_DATE && + to->type() != FIELD_TYPE_DATETIME)) && (from->real_type() != MYSQL_TYPE_VARCHAR || ((Field_varstring*)from)->length_bytes == ((Field_varstring*)to)->length_bytes)) diff --git a/sql/ha_federated.cc b/sql/ha_federated.cc index 6944dc5a030..9c2f73912ea 100644 --- a/sql/ha_federated.cc +++ b/sql/ha_federated.cc @@ -2596,30 +2596,27 @@ int ha_federated::info(uint flag) if (!(row= mysql_fetch_row(result))) goto error; - if (flag & HA_STATUS_VARIABLE | HA_STATUS_CONST) - { - /* - deleted is set in ha_federated::info - */ - /* - need to figure out what this means as far as federated is concerned, - since we don't have a "file" + /* + deleted is set in ha_federated::info + */ + /* + need to figure out what this means as far as federated is concerned, + since we don't have a "file" - data_file_length = ? - index_file_length = ? - delete_length = ? - */ - if (row[4] != NULL) - records= (ha_rows) my_strtoll10(row[4], (char**) 0, &error); + data_file_length = ? + index_file_length = ? + delete_length = ? + */ + if (row[4] != NULL) + records= (ha_rows) my_strtoll10(row[4], (char**) 0, &error); - mean_rec_length= table->s->reclength; - data_file_length= records * mean_rec_length; + mean_rec_length= table->s->reclength; + data_file_length= records * mean_rec_length; - if (row[12] != NULL) - update_time= (time_t) my_strtoll10(row[12], (char**) 0, &error); - if (row[13] != NULL) - check_time= (time_t) my_strtoll10(row[13], (char**) 0, &error); - } + if (row[12] != NULL) + update_time= (time_t) my_strtoll10(row[12], (char**) 0, &error); + if (row[13] != NULL) + check_time= (time_t) my_strtoll10(row[13], (char**) 0, &error); /* size of IO operations (This is based on a good guess, no high science diff --git a/sql/item.cc b/sql/item.cc index c20089694db..1e379527fb7 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -1477,8 +1477,6 @@ bool DTCollation::aggregate(DTCollation &dt, uint flags) { set(dt); } - else - ; // Do nothing } else if ((flags & MY_COLL_ALLOW_SUPERSET_CONV) && left_is_superset(this, &dt)) diff --git a/sql/spatial.h b/sql/spatial.h index 837ae153310..07aba4f925f 100644 --- a/sql/spatial.h +++ b/sql/spatial.h @@ -116,12 +116,12 @@ struct MBR int touches(const MBR *mbr) { /* The following should be safe, even if we compare doubles */ - return ((((mbr->xmin == xmax) || (mbr->xmax == xmin)) && - ((mbr->ymin >= ymin) && (mbr->ymin <= ymax) || - (mbr->ymax >= ymin) && (mbr->ymax <= ymax))) || - (((mbr->ymin == ymax) || (mbr->ymax == ymin)) && - ((mbr->xmin >= xmin) && (mbr->xmin <= xmax) || - (mbr->xmax >= xmin) && (mbr->xmax <= xmax)))); + return ((mbr->xmin == xmax || mbr->xmax == xmin) && + ((mbr->ymin >= ymin && mbr->ymin <= ymax) || + (mbr->ymax >= ymin && mbr->ymax <= ymax))) || + ((mbr->ymin == ymax || mbr->ymax == ymin) && + ((mbr->xmin >= xmin && mbr->xmin <= xmax) || + (mbr->xmax >= xmin && mbr->xmax <= xmax))); } int within(const MBR *mbr) diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index d5b79eaca4e..34d7e773ca2 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -1046,12 +1046,12 @@ static void acl_update_user(const char *user, const char *host, for (uint i=0 ; i < acl_users.elements ; i++) { ACL_USER *acl_user=dynamic_element(&acl_users,i,ACL_USER*); - if (!acl_user->user && !user[0] || - acl_user->user && !strcmp(user,acl_user->user)) + if ((!acl_user->user && !user[0]) || + (acl_user->user && !strcmp(user,acl_user->user))) { - if (!acl_user->host.hostname && !host[0] || - acl_user->host.hostname && - !my_strcasecmp(system_charset_info, host, acl_user->host.hostname)) + if ((!acl_user->host.hostname && !host[0]) || + (acl_user->host.hostname && + !my_strcasecmp(system_charset_info, host, acl_user->host.hostname))) { acl_user->access=privileges; if (mqh->specified_limits & USER_RESOURCES::QUERIES_PER_HOUR) @@ -1129,16 +1129,16 @@ static void acl_update_db(const char *user, const char *host, const char *db, for (uint i=0 ; i < acl_dbs.elements ; i++) { ACL_DB *acl_db=dynamic_element(&acl_dbs,i,ACL_DB*); - if (!acl_db->user && !user[0] || - acl_db->user && - !strcmp(user,acl_db->user)) + if ((!acl_db->user && !user[0]) || + (acl_db->user && + !strcmp(user,acl_db->user))) { - if (!acl_db->host.hostname && !host[0] || - acl_db->host.hostname && - !strcmp(host, acl_db->host.hostname)) + if ((!acl_db->host.hostname && !host[0]) || + (acl_db->host.hostname && + !strcmp(host, acl_db->host.hostname))) { - if (!acl_db->db && !db[0] || - acl_db->db && !strcmp(db,acl_db->db)) + if ((!acl_db->db && !db[0]) || + (acl_db->db && !strcmp(db,acl_db->db))) { if (privileges) acl_db->access=privileges; @@ -1345,8 +1345,8 @@ bool acl_check_host(const char *host, const char *ip) return 0; VOID(pthread_mutex_lock(&acl_cache->lock)); - if (host && hash_search(&acl_check_hosts,(byte*) host,(uint) strlen(host)) || - ip && hash_search(&acl_check_hosts,(byte*) ip,(uint) strlen(ip))) + if ((host && hash_search(&acl_check_hosts,(byte*) host,(uint) strlen(host))) || + (ip && hash_search(&acl_check_hosts,(byte*) ip,(uint) strlen(ip)))) { VOID(pthread_mutex_unlock(&acl_cache->lock)); return 0; // Found host @@ -1564,8 +1564,8 @@ find_acl_user(const char *host, const char *user, my_bool exact) host, acl_user->host.hostname ? acl_user->host.hostname : "")); - if (!acl_user->user && !user[0] || - acl_user->user && !strcmp(user,acl_user->user)) + if ((!acl_user->user && !user[0]) || + (acl_user->user && !strcmp(user,acl_user->user))) { if (exact ? !my_strcasecmp(system_charset_info, host, acl_user->host.hostname ? diff --git a/sql/sql_analyse.cc b/sql/sql_analyse.cc index 4b3264069b5..7de395d8d91 100644 --- a/sql/sql_analyse.cc +++ b/sql/sql_analyse.cc @@ -247,7 +247,7 @@ bool test_if_number(NUM_INFO *info, const char *str, uint str_len) } DBUG_RETURN(0); } - for (str++; *(end - 1) == '0'; end--); // jump over zeros at the end + for (str++; *(end - 1) == '0'; end--) ; // jump over zeros at the end if (str == end) // number was something like '123.000' { char *endpos= (char*) str; diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 854e603d21a..0f86a3dd311 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -1556,7 +1556,7 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root, it can not be cloned. Emit an error for an unsupported behaviour. */ if (table->query_id == thd->query_id || - thd->prelocked_mode && table->query_id) + (thd->prelocked_mode && table->query_id)) { my_error(ER_CANT_REOPEN_TABLE, MYF(0), table->alias); DBUG_RETURN(0); @@ -1610,8 +1610,8 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root, distance > 0 - we have lock mode higher then we require distance == 0 - we have lock mode exactly which we need */ - if (best_distance < 0 && distance > best_distance || - distance >= 0 && distance < best_distance) + if ((best_distance < 0 && distance > best_distance) || + (distance >= 0 && distance < best_distance)) { best_distance= distance; best_table= table; @@ -2298,8 +2298,8 @@ bool table_is_used(TABLE *table, bool wait_for_name_lock) search= (TABLE*) hash_next(&open_cache, (byte*) key, key_length, &state)) { - if (search->locked_by_name && wait_for_name_lock || - search->is_name_opened() && search->needs_reopen_or_name_lock()) + if ((search->locked_by_name && wait_for_name_lock) || + (search->is_name_opened() && search->needs_reopen_or_name_lock())) return 1; // Table is used } } while ((table=table->next)); @@ -5142,7 +5142,7 @@ bool setup_fields(THD *thd, Item **ref_pointer_array, thd->lex->current_select->cur_pos_in_select_list= 0; while ((item= it++)) { - if (!item->fixed && item->fix_fields(thd, it.ref()) || + if ((!item->fixed && item->fix_fields(thd, it.ref())) || (item= *(it.ref()))->check_cols(1)) { thd->lex->current_select->is_item_list_lookup= save_is_item_list_lookup; @@ -5476,16 +5476,16 @@ insert_fields(THD *thd, Name_resolution_context *context, const char *db_name, DBUG_ASSERT(tables->is_leaf_for_name_resolution()); - if (table_name && my_strcasecmp(table_alias_charset, table_name, - tables->alias) || + if ((table_name && my_strcasecmp(table_alias_charset, table_name, + tables->alias)) || (db_name && strcmp(tables->db,db_name))) continue; #ifndef NO_EMBEDDED_ACCESS_CHECKS /* Ensure that we have access rights to all fields to be inserted. */ - if (!((table && !tables->view && (table->grant.privilege & SELECT_ACL) || - tables->view && (tables->grant.privilege & SELECT_ACL))) && - !any_privileges) + if (!((table && !tables->view && (table->grant.privilege & SELECT_ACL)) || + (tables->view && (tables->grant.privilege & SELECT_ACL))) && + !any_privileges) { field_iterator.set(tables); if (check_grant_all_columns(thd, SELECT_ACL, &field_iterator)) @@ -5539,7 +5539,7 @@ insert_fields(THD *thd, Name_resolution_context *context, const char *db_name, */ if (any_privileges) { - DBUG_ASSERT(tables->field_translation == NULL && table || + DBUG_ASSERT((tables->field_translation == NULL && table) || tables->is_natural_join); DBUG_ASSERT(item->type() == Item::FIELD_ITEM); Item_field *fld= (Item_field*) item; @@ -5684,7 +5684,7 @@ int setup_conds(THD *thd, TABLE_LIST *tables, TABLE_LIST *leaves, if (*conds) { thd->where="where clause"; - if (!(*conds)->fixed && (*conds)->fix_fields(thd, conds) || + if ((!(*conds)->fixed && (*conds)->fix_fields(thd, conds)) || (*conds)->check_cols(1)) goto err_no_arena; } @@ -5704,8 +5704,8 @@ int setup_conds(THD *thd, TABLE_LIST *tables, TABLE_LIST *leaves, { /* Make a join an a expression */ thd->where="on clause"; - if (!embedded->on_expr->fixed && - embedded->on_expr->fix_fields(thd, &embedded->on_expr) || + if ((!embedded->on_expr->fixed && + embedded->on_expr->fix_fields(thd, &embedded->on_expr)) || embedded->on_expr->check_cols(1)) goto err_no_arena; select_lex->cond_count++; @@ -5860,8 +5860,8 @@ fill_record_n_invoke_before_triggers(THD *thd, List<Item> &fields, enum trg_event_type event) { return (fill_record(thd, fields, values, ignore_errors) || - triggers && triggers->process_triggers(thd, event, - TRG_ACTION_BEFORE, TRUE)); + (triggers && triggers->process_triggers(thd, event, + TRG_ACTION_BEFORE, TRUE))); } @@ -5955,8 +5955,8 @@ fill_record_n_invoke_before_triggers(THD *thd, Field **ptr, enum trg_event_type event) { return (fill_record(thd, ptr, values, ignore_errors) || - triggers && triggers->process_triggers(thd, event, - TRG_ACTION_BEFORE, TRUE)); + (triggers && triggers->process_triggers(thd, event, + TRG_ACTION_BEFORE, TRUE))); } diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc index 79fc4872f05..30b14209a7c 100644 --- a/sql/sql_delete.cc +++ b/sql/sql_delete.cc @@ -711,7 +711,7 @@ void multi_delete::send_error(uint errcode,const char *err) /* the error was handled or nothing deleted and no side effects return */ if (error_handled || - !thd->transaction.stmt.modified_non_trans_table && !deleted) + (!thd->transaction.stmt.modified_non_trans_table && !deleted)) DBUG_VOID_RETURN; /* Something already deleted so we have to invalidate cache */ diff --git a/sql/sql_help.cc b/sql/sql_help.cc index e369a72fa9f..93610ea22b7 100644 --- a/sql/sql_help.cc +++ b/sql/sql_help.cc @@ -522,7 +522,7 @@ int send_variant_2_list(MEM_ROOT *mem_root, Protocol *protocol, String **end= pointers + names->elements; List_iterator<String> it(*names); - for (pos= pointers; pos!=end; (*pos++= it++)); + for (pos= pointers; pos!=end; (*pos++= it++)) ; my_qsort(pointers,names->elements,sizeof(String*),string_ptr_cmp); diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index 6d63a0907df..28b8bcd320d 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -413,7 +413,7 @@ void upgrade_lock_type(THD *thd, thr_lock_type *lock_type, bool is_multi_insert) { if (duplic == DUP_UPDATE || - duplic == DUP_REPLACE && *lock_type == TL_WRITE_CONCURRENT_INSERT) + (duplic == DUP_REPLACE && *lock_type == TL_WRITE_CONCURRENT_INSERT)) { *lock_type= TL_WRITE_DEFAULT; return; @@ -887,7 +887,8 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list, if (changed) query_cache_invalidate3(thd, table_list, 1); } - if (changed && error <= 0 || thd->transaction.stmt.modified_non_trans_table + if ((changed && error <= 0) + || thd->transaction.stmt.modified_non_trans_table || was_insert_delayed) { if (mysql_bin_log.is_open()) @@ -3016,8 +3017,8 @@ bool select_insert::send_eof() We must invalidate the table in the query cache before binlog writing and ha_autocommit_or_rollback */ - - if (changed= (info.copied || info.deleted || info.updated)) + changed= (info.copied || info.deleted || info.updated); + if (changed) { query_cache_invalidate3(thd, table, 1); if (thd->transaction.stmt.modified_non_trans_table) diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 436f41dd209..061a20679e7 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -661,7 +661,7 @@ int MYSQLlex(void *arg, void *yythd) else #endif { - for (result_state= c; ident_map[c= yyGet()]; result_state|= c); + for (result_state= c; ident_map[c= yyGet()]; result_state|= c) ; /* If there were non-ASCII characters, mark that we must convert */ result_state= result_state & 0x80 ? IDENT_QUOTED : IDENT; } @@ -673,7 +673,7 @@ int MYSQLlex(void *arg, void *yythd) If we find a space then this can't be an identifier. We notice this below by checking start != lex->ptr. */ - for (; state_map[c] == MY_LEX_SKIP ; c= yyGet()); + for (; state_map[c] == MY_LEX_SKIP ; c= yyGet()) ; } if (start == lip->ptr && c == '.' && ident_map[yyPeek()]) lip->next_state=MY_LEX_IDENT_SEP; @@ -782,7 +782,7 @@ int MYSQLlex(void *arg, void *yythd) else #endif { - for (result_state=0; ident_map[c= yyGet()]; result_state|= c); + for (result_state=0; ident_map[c= yyGet()]; result_state|= c) ; /* If there were non-ASCII characters, mark that we must convert */ result_state= result_state & 0x80 ? IDENT_QUOTED : IDENT; } @@ -872,7 +872,7 @@ int MYSQLlex(void *arg, void *yythd) case MY_LEX_BIN_NUMBER: // Found b'bin-string' yyGet(); // Skip ' - while ((c= yyGet()) == '0' || c == '1'); + while ((c= yyGet()) == '0' || c == '1') ; length= (uint) (lip->ptr - lip->tok_start); // Length of bin-num + 3 if (c != '\'') return(ABORT_SYM); // Illegal hex constant @@ -1080,7 +1080,7 @@ int MYSQLlex(void *arg, void *yythd) [(global | local | session) .]variable_name */ - for (result_state= 0; ident_map[c= yyGet()]; result_state|= c); + for (result_state= 0; ident_map[c= yyGet()]; result_state|= c) ; /* If there were non-ASCII characters, mark that we must convert */ result_state= result_state & 0x80 ? IDENT_QUOTED : IDENT; @@ -1670,7 +1670,7 @@ void st_select_lex::print_limit(THD *thd, String *str) item->substype() == Item_subselect::ALL_SUBS)) { DBUG_ASSERT(!item->fixed || - select_limit->val_int() == LL(1) && offset_limit == 0); + (select_limit->val_int() == LL(1) && offset_limit == 0)); return; } diff --git a/sql/sql_load.cc b/sql/sql_load.cc index 5b9f8ea441d..83af6d477db 100644 --- a/sql/sql_load.cc +++ b/sql/sql_load.cc @@ -723,9 +723,9 @@ read_sep_field(THD *thd, COPY_INFO &info, TABLE_LIST *table_list, real_item= item->real_item(); - if (!read_info.enclosed && + if ((!read_info.enclosed && (enclosed_length && length == 4 && - !memcmp(pos, STRING_WITH_LEN("NULL"))) || + !memcmp(pos, STRING_WITH_LEN("NULL")))) || (length == 1 && read_info.found_null)) { @@ -1132,8 +1132,8 @@ int READ_INFO::read_field() } // End of enclosed field if followed by field_term or line_term if (chr == my_b_EOF || - chr == line_term_char && terminator(line_term_ptr, - line_term_length)) + (chr == line_term_char && terminator(line_term_ptr, + line_term_length))) { // Maybe unexpected linefeed enclosed=1; found_end_of_line=1; diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 507805ec0c4..79b9b479a0c 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -1238,7 +1238,7 @@ pthread_handler_t handle_one_connection(void *arg) decrease_user_connections(thd->user_connect); if (thd->killed || - net->vio && net->error && net->report_error) + (net->vio && net->error && net->report_error)) { statistic_increment(aborted_threads, &LOCK_status); } @@ -2366,11 +2366,11 @@ void log_slow_statement(THD *thd) if ((thd->start_time > thd->time_after_lock && (ulong) (thd->start_time - thd->time_after_lock) > thd->variables.long_query_time) || - (thd->server_status & + ((thd->server_status & (SERVER_QUERY_NO_INDEX_USED | SERVER_QUERY_NO_GOOD_INDEX_USED)) && opt_log_queries_not_using_indexes && /* == SQLCOM_END unless this is a SHOW command */ - thd->lex->orig_sql_command == SQLCOM_END) + thd->lex->orig_sql_command == SQLCOM_END)) { thd_proc_info(thd, "logging slow query"); thd->status_var.long_query_count++; @@ -2676,8 +2676,8 @@ mysql_execute_command(THD *thd) variables, but for now this is probably good enough. Don't reset warnings when executing a stored routine. */ - if ((all_tables || &lex->select_lex != lex->all_selects_list || - lex->sroutines.records) && !thd->spcont || + if (((all_tables || &lex->select_lex != lex->all_selects_list || + lex->sroutines.records) && !thd->spcont) || lex->time_zone_tables_used) mysql_reset_errors(thd, 0); @@ -5641,7 +5641,7 @@ check_access(THD *thd, ulong want_access, const char *db, ulong *save_priv, if (schema_db) { - if (!(sctx->master_access & FILE_ACL) && (want_access & FILE_ACL) || + if ((!(sctx->master_access & FILE_ACL) && (want_access & FILE_ACL)) || (want_access & ~(SELECT_ACL | EXTRA_ACL | FILE_ACL))) { if (!no_errors) @@ -5678,7 +5678,7 @@ check_access(THD *thd, ulong want_access, const char *db, ulong *save_priv, DBUG_RETURN(FALSE); } if (((want_access & ~sctx->master_access) & ~(DB_ACLS | EXTRA_ACL)) || - ! db && dont_check_global_grants) + (! db && dont_check_global_grants)) { // We can never grant this DBUG_PRINT("error",("No possible access")); if (!no_errors) @@ -6029,10 +6029,10 @@ bool check_some_access(THD *thd, ulong want_access, TABLE_LIST *table) { if (access & want_access) { - if (!check_access(thd, access, table->db, + if ((!check_access(thd, access, table->db, &table->grant.privilege, 0, 1, test(table->schema_table)) && - !grant_option || !check_grant(thd, access, table, 0, 1, 1)) + !grant_option) || !check_grant(thd, access, table, 0, 1, 1)) DBUG_RETURN(0); } } @@ -7710,12 +7710,12 @@ bool multi_update_precheck(THD *thd, TABLE_LIST *tables) else if ((check_access(thd, UPDATE_ACL, table->db, &table->grant.privilege, 0, 1, test(table->schema_table)) || - grant_option && - check_grant(thd, UPDATE_ACL, table, 0, 1, 1)) && + (grant_option && + check_grant(thd, UPDATE_ACL, table, 0, 1, 1))) && (check_access(thd, SELECT_ACL, table->db, &table->grant.privilege, 0, 0, test(table->schema_table)) || - grant_option && check_grant(thd, SELECT_ACL, table, 0, 1, 0))) + (grant_option && check_grant(thd, SELECT_ACL, table, 0, 1, 0)))) DBUG_RETURN(TRUE); table->table_in_first_from_clause= 1; @@ -7735,7 +7735,7 @@ bool multi_update_precheck(THD *thd, TABLE_LIST *tables) if (check_access(thd, SELECT_ACL, table->db, &table->grant.privilege, 0, 0, test(table->schema_table)) || - grant_option && check_grant(thd, SELECT_ACL, table, 0, 1, 0)) + (grant_option && check_grant(thd, SELECT_ACL, table, 0, 1, 0))) DBUG_RETURN(TRUE); } } @@ -7961,7 +7961,7 @@ static bool check_show_create_table_access(THD *thd, TABLE_LIST *table) return check_access(thd, SELECT_ACL | EXTRA_ACL, table->db, &table->grant.privilege, 0, 0, test(table->schema_table)) || - grant_option && check_grant(thd, SELECT_ACL, table, 2, UINT_MAX, 0); + (grant_option && check_grant(thd, SELECT_ACL, table, 2, UINT_MAX, 0)); } diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index a20f61436a7..d14f14b526e 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -1367,7 +1367,7 @@ static bool mysql_test_set_fields(Prepared_statement *stmt, THD *thd= stmt->thd; set_var_base *var; - if (tables && check_table_access(thd, SELECT_ACL, tables, 0) || + if ((tables && check_table_access(thd, SELECT_ACL, tables, 0)) || open_and_lock_tables(thd, tables)) goto error; @@ -2714,7 +2714,7 @@ Prepared_statement::Prepared_statement(THD *thd_arg, Protocol *protocol_arg) void Prepared_statement::setup_set_params() { /* Setup binary logging */ - if (mysql_bin_log.is_open() && is_update_query(lex->sql_command) || + if ((mysql_bin_log.is_open() && is_update_query(lex->sql_command)) || mysql_log.is_open() || mysql_slow_log.is_open()) { set_params_from_vars= insert_params_from_vars_with_log; diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 0417460fe4f..672ebaf9259 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -1305,7 +1305,7 @@ JOIN::optimize() join_tab[const_tables].type != JT_ALL && join_tab[const_tables].type != JT_FT && join_tab[const_tables].type != JT_REF_OR_NULL && - (order && simple_order || group_list && simple_group)) + ((order && simple_order) || (group_list && simple_group))) { if (add_ref_to_table_cond(thd,&join_tab[const_tables])) { DBUG_RETURN(1); @@ -1809,9 +1809,9 @@ JOIN::exec() like SEC_TO_TIME(SUM(...)). */ - if (curr_join->group_list && (!test_if_subpart(curr_join->group_list, + if ((curr_join->group_list && (!test_if_subpart(curr_join->group_list, curr_join->order) || - curr_join->select_distinct) || + curr_join->select_distinct)) || (curr_join->select_distinct && curr_join->tmp_table_param.using_indirect_summary_function)) { /* Must copy to another table */ @@ -2269,9 +2269,10 @@ mysql_select(THD *thd, Item ***rref_pointer_array, } else { - if (err= join->prepare(rref_pointer_array, tables, wild_num, - conds, og_num, order, group, having, proc_param, - select_lex, unit)) + err= join->prepare(rref_pointer_array, tables, wild_num, + conds, og_num, order, group, having, proc_param, + select_lex, unit); + if (err) { goto err; } @@ -2286,9 +2287,10 @@ mysql_select(THD *thd, Item ***rref_pointer_array, DBUG_RETURN(TRUE); thd_proc_info(thd, "init"); thd->used_tables=0; // Updated by setup_fields - if (err= join->prepare(rref_pointer_array, tables, wild_num, - conds, og_num, order, group, having, proc_param, - select_lex, unit)) + err= join->prepare(rref_pointer_array, tables, wild_num, + conds, og_num, order, group, having, proc_param, + select_lex, unit); + if (err) { goto err; } @@ -3744,7 +3746,7 @@ update_ref_and_keys(THD *thd, DYNAMIC_ARRAY *keyuse,JOIN_TAB *join_tab, if (use->key == prev->key && use->table == prev->table) { if (prev->keypart+1 < use->keypart || - prev->keypart == use->keypart && found_eq_constant) + (prev->keypart == use->keypart && found_eq_constant)) continue; /* remove */ } else if (use->keypart != 0) // First found must be 0 @@ -4984,8 +4986,8 @@ best_extension_by_limited_search(JOIN *join, { if (best_record_count > current_record_count || best_read_time > current_read_time || - idx == join->const_tables && // 's' is the first table in the QEP - s->table == join->sort_by_table) + (idx == join->const_tables && // 's' is the first table in the QEP + s->table == join->sort_by_table)) { if (best_record_count >= current_record_count && best_read_time >= current_read_time && @@ -5110,7 +5112,7 @@ find_best(JOIN *join,table_map rest_tables,uint idx,double record_count, double current_read_time=read_time+best; if (best_record_count > current_record_count || best_read_time > current_read_time || - idx == join->const_tables && s->table == join->sort_by_table) + (idx == join->const_tables && s->table == join->sort_by_table)) { if (best_record_count >= current_record_count && best_read_time >= current_read_time && @@ -5955,8 +5957,8 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond) the index if we are using limit and this is the first table */ - if (cond && - (!tab->keys.is_subset(tab->const_keys) && i > 0) || + if ((cond && + (!tab->keys.is_subset(tab->const_keys) && i > 0)) || (!tab->const_keys.is_clear_all() && i == join->const_tables && join->unit->select_limit_cnt < join->best_positions[i].records_read && @@ -7081,7 +7083,7 @@ static bool check_simple_equality(Item *left_item, Item *right_item, left_item_equal->merge(right_item_equal); /* Remove the merged multiple equality from the list */ List_iterator<Item_equal> li(cond_equal->current_level); - while ((li++) != right_item_equal); + while ((li++) != right_item_equal) ; li.remove(); } } @@ -9663,9 +9665,9 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields, reclength=1; // Dummy select /* Use packed rows if there is blobs or a lot of space to gain */ if (blob_count || - string_total_length >= STRING_TOTAL_LENGTH_TO_PACK_ROWS && + (string_total_length >= STRING_TOTAL_LENGTH_TO_PACK_ROWS && (reclength / string_total_length <= RATIO_TO_PACK_ROWS || - string_total_length / string_count >= AVG_STRING_LENGTH_TO_PACK_ROWS)) + string_total_length / string_count >= AVG_STRING_LENGTH_TO_PACK_ROWS))) use_packed_rows= 1; table->s->fields= field_count; @@ -10329,8 +10331,8 @@ bool create_myisam_from_heap(THD *thd, TABLE *table, TMP_TABLE_PARAM *param, /* copy row that filled HEAP table */ if ((write_err=new_table.file->write_row(table->record[0]))) { - if (write_err != HA_ERR_FOUND_DUPP_KEY && - write_err != HA_ERR_FOUND_DUPP_UNIQUE || !ignore_last_dupp_key_error) + if ((write_err != HA_ERR_FOUND_DUPP_KEY && + write_err != HA_ERR_FOUND_DUPP_UNIQUE) || !ignore_last_dupp_key_error) goto err; } @@ -12812,8 +12814,8 @@ create_sort_index(THD *thd, JOIN *join, ORDER *order, */ if ((order != join->group_list || !(join->select_options & SELECT_BIG_RESULT) || - select && select->quick && - select->quick->get_type() == QUICK_SELECT_I::QS_TYPE_GROUP_MIN_MAX) && + (select && select->quick && + select->quick->get_type() == QUICK_SELECT_I::QS_TYPE_GROUP_MIN_MAX)) && test_if_skip_sort_order(tab,order,select_limit,0)) DBUG_RETURN(0); for (ORDER *ord= join->order; ord; ord= ord->next) @@ -13641,8 +13643,8 @@ find_order_in_list(THD *thd, Item **ref_pointer_array, TABLE_LIST *tables, /* Lookup the current GROUP field in the FROM clause. */ order_item_type= order_item->type(); from_field= (Field*) not_found_field; - if (is_group_field && - order_item_type == Item::FIELD_ITEM || + if ((is_group_field && + order_item_type == Item::FIELD_ITEM) || order_item_type == Item::REF_ITEM) { from_field= find_field_in_tables(thd, (Item_ident*) order_item, tables, @@ -14068,7 +14070,7 @@ get_sort_by_table(ORDER *a,ORDER *b,TABLE_LIST *tables) if (!map || (map & (RAND_TABLE_BIT | OUTER_REF_TABLE_BIT))) DBUG_RETURN(0); - for (; !(map & tables->table->map); tables= tables->next_leaf); + for (; !(map & tables->table->map); tables= tables->next_leaf) ; if (map != tables->table->map) DBUG_RETURN(0); // More than one table DBUG_PRINT("exit",("sort by table: %d",tables->table->tablenr)); diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 59679c96120..8387c087836 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -2987,10 +2987,10 @@ bool store_schema_proc(THD *thd, TABLE *table, TABLE *proc_table, TYPE_ENUM_PROCEDURE)) return 0; - if (lex->orig_sql_command == SQLCOM_SHOW_STATUS_PROC && - proc_table->field[2]->val_int() == TYPE_ENUM_PROCEDURE || - lex->orig_sql_command == SQLCOM_SHOW_STATUS_FUNC && - proc_table->field[2]->val_int() == TYPE_ENUM_FUNCTION || + if ((lex->orig_sql_command == SQLCOM_SHOW_STATUS_PROC && + proc_table->field[2]->val_int() == TYPE_ENUM_PROCEDURE) || + (lex->orig_sql_command == SQLCOM_SHOW_STATUS_FUNC && + proc_table->field[2]->val_int() == TYPE_ENUM_FUNCTION) || lex->orig_sql_command == SQLCOM_END) { restore_record(table, s->default_values); diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 9952fca6bcb..c4360c8d52e 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -982,8 +982,8 @@ static int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info, } /* Don't pack rows in old tables if the user has requested this */ if ((sql_field->flags & BLOB_FLAG) || - sql_field->sql_type == MYSQL_TYPE_VARCHAR && - create_info->row_type != ROW_TYPE_FIXED) + (sql_field->sql_type == MYSQL_TYPE_VARCHAR && + create_info->row_type != ROW_TYPE_FIXED)) (*db_options)|= HA_OPTION_PACK_RECORD; it2.rewind(); } @@ -1422,7 +1422,7 @@ static int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info, sql_field->sql_type == MYSQL_TYPE_VARCHAR || sql_field->pack_flag & FIELDFLAG_BLOB))) { - if (column_nr == 0 && (sql_field->pack_flag & FIELDFLAG_BLOB) || + if ((column_nr == 0 && (sql_field->pack_flag & FIELDFLAG_BLOB)) || sql_field->sql_type == MYSQL_TYPE_VARCHAR) key_info->flags|= HA_BINARY_PACK_KEY | HA_VAR_LENGTH_KEY; else @@ -3954,9 +3954,9 @@ view_err: } else if (mysql_rename_table(new_db_type,new_db,tmp_name,new_db, new_alias) || - (new_name != table_name || new_db != db) && // we also do rename + ((new_name != table_name || new_db != db) && // we also do rename Table_triggers_list::change_table_name(thd, db, table_name, - new_db, new_alias)) + new_db, new_alias))) { // Try to get everything back error=1; diff --git a/sql/sql_trigger.cc b/sql/sql_trigger.cc index d2ae494d4eb..1fa8b83f300 100644 --- a/sql/sql_trigger.cc +++ b/sql/sql_trigger.cc @@ -179,7 +179,7 @@ bool mysql_create_or_drop_trigger(THD *thd, TABLE_LIST *tables, bool create) need second part of condition below, since check_access() function also checks that db is specified. */ - if (!thd->lex->spname->m_db.length || create && !tables->db_length) + if (!thd->lex->spname->m_db.length || (create && !tables->db_length)) { my_error(ER_NO_DB_ERROR, MYF(0)); DBUG_RETURN(TRUE); diff --git a/sql/sql_update.cc b/sql/sql_update.cc index 69f876ace39..481fe30c6e7 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -1532,7 +1532,7 @@ void multi_update::send_error(uint errcode,const char *err) /* the error was handled or nothing deleted and no side effects return */ if (error_handled || - !thd->transaction.stmt.modified_non_trans_table && !updated) + (!thd->transaction.stmt.modified_non_trans_table && !updated)) return; /* Something already updated so we have to invalidate cache */ diff --git a/sql/sql_view.cc b/sql/sql_view.cc index d1d84e76811..96077aeeb12 100644 --- a/sql/sql_view.cc +++ b/sql/sql_view.cc @@ -268,11 +268,11 @@ bool create_view_precheck(THD *thd, TABLE_LIST *tables, TABLE_LIST *view, */ if ((check_access(thd, CREATE_VIEW_ACL, view->db, &view->grant.privilege, 0, 0, is_schema_db(view->db)) || - grant_option && check_grant(thd, CREATE_VIEW_ACL, view, 0, 1, 0)) || + (grant_option && check_grant(thd, CREATE_VIEW_ACL, view, 0, 1, 0))) || (mode != VIEW_CREATE_NEW && (check_access(thd, DROP_ACL, view->db, &view->grant.privilege, 0, 0, is_schema_db(view->db)) || - grant_option && check_grant(thd, DROP_ACL, view, 0, 1, 0)))) + (grant_option && check_grant(thd, DROP_ACL, view, 0, 1, 0))))) goto err; for (sl= select_lex; sl; sl= sl->next_select()) @@ -322,7 +322,7 @@ bool create_view_precheck(THD *thd, TABLE_LIST *tables, TABLE_LIST *view, { if (check_access(thd, SELECT_ACL, tbl->db, &tbl->grant.privilege, 0, 0, test(tbl->schema_table)) || - grant_option && check_grant(thd, SELECT_ACL, tbl, 0, 1, 0)) + (grant_option && check_grant(thd, SELECT_ACL, tbl, 0, 1, 0))) goto err; } } diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index b6a215a2306..49b7fafcc0b 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -3943,7 +3943,7 @@ alter_list_item: MYSQL_YYABORT; } if (check_table_name($3->table.str,$3->table.length) || - $3->db.str && check_db_name($3->db.str)) + ($3->db.str && check_db_name($3->db.str))) { my_error(ER_WRONG_TABLE_NAME, MYF(0), $3->table.str); MYSQL_YYABORT; @@ -4094,8 +4094,8 @@ slave_until: | UNTIL_SYM slave_until_opts { LEX *lex=Lex; - if ((lex->mi.log_file_name || lex->mi.pos) && - (lex->mi.relay_log_name || lex->mi.relay_log_pos) || + if (((lex->mi.log_file_name || lex->mi.pos) && + (lex->mi.relay_log_name || lex->mi.relay_log_pos)) || !((lex->mi.log_file_name && lex->mi.pos) || (lex->mi.relay_log_name && lex->mi.relay_log_pos))) { diff --git a/sql/table.cc b/sql/table.cc index 55a9b50605d..84b1099d5a2 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -2112,8 +2112,8 @@ bool TABLE_LIST::prep_check_option(THD *thd, uint8 check_opt_type) { const char *save_where= thd->where; thd->where= "check option"; - if (!check_option->fixed && - check_option->fix_fields(thd, &check_option) || + if ((!check_option->fixed && + check_option->fix_fields(thd, &check_option)) || check_option->check_cols(1)) { DBUG_RETURN(TRUE); @@ -2827,7 +2827,7 @@ void Field_iterator_table_ref::set_field_iterator() /* Necesary, but insufficient conditions. */ DBUG_ASSERT(table_ref->is_natural_join || table_ref->nested_join || - table_ref->join_columns && + (table_ref->join_columns && /* This is a merge view. */ ((table_ref->field_translation && table_ref->join_columns->elements == @@ -2836,7 +2836,7 @@ void Field_iterator_table_ref::set_field_iterator() /* This is stored table or a tmptable view. */ (!table_ref->field_translation && table_ref->join_columns->elements == - table_ref->table->s->fields))); + table_ref->table->s->fields)))); field_it= &natural_join_it; DBUG_PRINT("info",("field_it for '%s' is Field_iterator_natural_join", table_ref->alias)); diff --git a/sql/table.h b/sql/table.h index ad578044371..db996d45320 100644 --- a/sql/table.h +++ b/sql/table.h @@ -729,7 +729,7 @@ struct TABLE_LIST void cleanup_items(); bool placeholder() { - return derived || view || schema_table || create && !table->db_stat || + return derived || view || schema_table || (create && !table->db_stat) || !table; } void print(THD *thd, String *str); diff --git a/sql/time.cc b/sql/time.cc index fb8a51fd0eb..b9cee5a986a 100644 --- a/sql/time.cc +++ b/sql/time.cc @@ -76,8 +76,8 @@ uint calc_week(MYSQL_TIME *l_time, uint week_behaviour, uint *year) if (l_time->month == 1 && l_time->day <= 7-weekday) { if (!week_year && - (first_weekday && weekday != 0 || - !first_weekday && weekday >= 4)) + ((first_weekday && weekday != 0) || + (!first_weekday && weekday >= 4))) return 0; week_year= 1; (*year)--; @@ -94,8 +94,8 @@ uint calc_week(MYSQL_TIME *l_time, uint week_behaviour, uint *year) if (week_year && days >= 52*7) { weekday= (weekday + calc_days_in_year(*year)) % 7; - if (!first_weekday && weekday < 4 || - first_weekday && weekday == 0) + if ((!first_weekday && weekday < 4) || + (first_weekday && weekday == 0)) { (*year)++; return 1; diff --git a/sql/tztime.cc b/sql/tztime.cc index d73a1ca0111..73e68ee2b29 100644 --- a/sql/tztime.cc +++ b/sql/tztime.cc @@ -447,8 +447,8 @@ prepare_tz_info(TIME_ZONE_INFO *sp, MEM_ROOT *storage) } if (end_t == MY_TIME_T_MAX || - (cur_off_and_corr > 0) && - (end_t >= MY_TIME_T_MAX - cur_off_and_corr)) + ((cur_off_and_corr > 0) && + (end_t >= MY_TIME_T_MAX - cur_off_and_corr))) /* end of t space */ break; diff --git a/sql/uniques.cc b/sql/uniques.cc index a0d1beaf0f9..86223151d72 100644 --- a/sql/uniques.cc +++ b/sql/uniques.cc @@ -604,9 +604,9 @@ bool Unique::get(TABLE *table) outfile=table->sort.io_cache=(IO_CACHE*) my_malloc(sizeof(IO_CACHE), MYF(MY_ZEROFILL)); - if (!outfile || ! my_b_inited(outfile) && + if (!outfile || (! my_b_inited(outfile) && open_cached_file(outfile,mysql_tmpdir,TEMP_PREFIX,READ_RECORD_BUFFER, - MYF(MY_WME))) + MYF(MY_WME)))) return 1; reinit_io_cache(outfile,WRITE_CACHE,0L,0,0); |