Commit 1827a979 authored by Alexey Kopytov's avatar Alexey Kopytov

Automerge.

parents e0f0ad4c 347b483b
......@@ -1507,10 +1507,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))
......
......@@ -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)
......
......@@ -1192,12 +1192,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)
......@@ -1275,16 +1275,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;
......@@ -1493,8 +1493,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,(uchar*) host,strlen(host)) ||
ip && hash_search(&acl_check_hosts,(uchar*) ip, strlen(ip)))
if ((host && hash_search(&acl_check_hosts,(uchar*) host,strlen(host))) ||
(ip && hash_search(&acl_check_hosts,(uchar*) ip, strlen(ip))))
{
VOID(pthread_mutex_unlock(&acl_cache->lock));
return 0; // Found host
......@@ -1711,8 +1711,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 ?
......@@ -5319,16 +5319,13 @@ static int handle_grant_struct(uint struct_no, bool drop,
uint elements;
const char *user;
const char *host;
ACL_USER *acl_user;
ACL_DB *acl_db;
GRANT_NAME *grant_name;
ACL_USER *acl_user= NULL;
ACL_DB *acl_db= NULL;
GRANT_NAME *grant_name= NULL;
DBUG_ENTER("handle_grant_struct");
DBUG_PRINT("info",("scan struct: %u search: '%s'@'%s'",
struct_no, user_from->user.str, user_from->host.str));
LINT_INIT(acl_user);
LINT_INIT(acl_db);
LINT_INIT(grant_name);
LINT_INIT(user);
LINT_INIT(host);
......
......@@ -246,7 +246,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;
......
......@@ -473,13 +473,14 @@ static TABLE_SHARE
@todo Rework alternative ways to deal with ER_NO_SUCH TABLE.
*/
if (share || thd->is_error() && thd->main_da.sql_errno() != ER_NO_SUCH_TABLE)
if (share || (thd->is_error() && thd->main_da.sql_errno() != ER_NO_SUCH_TABLE))
DBUG_RETURN(share);
/* Table didn't exist. Check if some engine can provide it */
if ((tmp= ha_create_table_from_engine(thd, table_list->db,
table_list->table_name)) < 0)
tmp= ha_create_table_from_engine(thd, table_list->db,
table_list->table_name);
if (tmp < 0)
{
/*
No such table in any engine.
......@@ -1431,11 +1432,10 @@ static inline uint tmpkeyval(THD *thd, TABLE *table)
void close_temporary_tables(THD *thd)
{
TABLE *table;
TABLE *next;
TABLE *next= NULL;
TABLE *prev_table;
/* Assume thd->options has OPTION_QUOTE_SHOW_CREATE */
bool was_quote_show= TRUE;
LINT_INIT(next);
if (!thd->temporary_tables)
return;
......@@ -2617,8 +2617,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;
......@@ -6413,8 +6413,7 @@ find_item_in_list(Item *find, List<Item> &items, uint *counter,
(and not an item that happens to have a name).
*/
bool is_ref_by_name= 0;
uint unaliased_counter;
LINT_INIT(unaliased_counter); // Dependent on found_unaliased
uint unaliased_counter= 0;
*resolution= NOT_RESOLVED;
......@@ -7439,7 +7438,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;
......@@ -7753,8 +7752,8 @@ 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;
......@@ -7785,8 +7784,8 @@ insert_fields(THD *thd, Name_resolution_context *context, const char *db_name,
information_schema table, or a nested table reference. See the comment
for TABLE_LIST.
*/
if (!(table && !tables->view && (table->grant.privilege & SELECT_ACL) ||
tables->view && (tables->grant.privilege & SELECT_ACL)) &&
if (!((table && !tables->view && (table->grant.privilege & SELECT_ACL)) ||
(tables->view && (tables->grant.privilege & SELECT_ACL))) &&
!any_privileges)
{
field_iterator.set(tables);
......@@ -7840,7 +7839,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;
......@@ -7979,7 +7978,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;
}
......@@ -7999,8 +7998,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++;
......@@ -8155,8 +8154,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)));
}
......@@ -8250,8 +8249,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)));
}
......
......@@ -806,7 +806,7 @@ void multi_delete::abort()
/* 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 */
......
......@@ -526,7 +526,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);
......
......@@ -301,9 +301,7 @@ static int check_update_fields(THD *thd, TABLE_LIST *insert_table_list,
List<Item> &update_fields, table_map *map)
{
TABLE *table= insert_table_list->table;
my_bool timestamp_mark;
LINT_INIT(timestamp_mark);
my_bool timestamp_mark= 0;
if (table->timestamp_field)
{
......@@ -393,7 +391,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;
......@@ -858,8 +856,9 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list,
*/
query_cache_invalidate3(thd, table_list, 1);
}
if (changed && error <= 0 || thd->transaction.stmt.modified_non_trans_table
|| was_insert_delayed)
if ((changed && error <= 0) ||
thd->transaction.stmt.modified_non_trans_table ||
was_insert_delayed)
{
if (mysql_bin_log.is_open())
{
......@@ -3186,7 +3185,8 @@ bool select_insert::send_eof()
table->file->extra(HA_EXTRA_NO_IGNORE_DUP_KEY);
table->file->extra(HA_EXTRA_WRITE_CANNOT_REPLACE);
if (changed= (info.copied || info.deleted || info.updated))
changed= (info.copied || info.deleted || info.updated);
if (changed)
{
/*
We must invalidate the table in the query cache before binlog writing
......
......@@ -780,7 +780,7 @@ bool consume_comment(Lex_input_stream *lip, int remaining_recursions_permitted)
int MYSQLlex(void *arg, void *yythd)
{
reg1 uchar c;
reg1 uchar c= 0;
bool comment_closed;
int tokval, result_state;
uint length;
......@@ -798,7 +798,6 @@ int MYSQLlex(void *arg, void *yythd)
lip->start_token();
state=lip->next_state;
lip->next_state=MY_LEX_OPERATOR_OR_IDENT;
LINT_INIT(c);
for (;;)
{
switch (state) {
......@@ -927,7 +926,7 @@ int MYSQLlex(void *arg, void *yythd)
else
#endif
{
for (result_state= c; ident_map[c= lip->yyGet()]; result_state|= c);
for (result_state= c; ident_map[c= lip->yyGet()]; result_state|= c) ;
/* If there were non-ASCII characters, mark that we must convert */
result_state= result_state & 0x80 ? IDENT_QUOTED : IDENT;
}
......@@ -939,7 +938,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= lip->yyGet());
for (; state_map[c] == MY_LEX_SKIP ; c= lip->yyGet()) ;
}
if (start == lip->get_ptr() && c == '.' && ident_map[lip->yyPeek()])
lip->next_state=MY_LEX_IDENT_SEP;
......@@ -1012,7 +1011,7 @@ int MYSQLlex(void *arg, void *yythd)
}
else if (c == 'b')
{
while ((c= lip->yyGet()) == '0' || c == '1');
while ((c= lip->yyGet()) == '0' || c == '1') ;
if ((lip->yyLength() >= 3) && !ident_map[c])
{
/* Skip '0b' */
......@@ -1071,7 +1070,7 @@ int MYSQLlex(void *arg, void *yythd)
else
#endif
{
for (result_state=0; ident_map[c= lip->yyGet()]; result_state|= c);
for (result_state=0; ident_map[c= lip->yyGet()]; result_state|= c) ;
/* If there were non-ASCII characters, mark that we must convert */
result_state= result_state & 0x80 ? IDENT_QUOTED : IDENT;
}
......@@ -1171,7 +1170,7 @@ int MYSQLlex(void *arg, void *yythd)
case MY_LEX_BIN_NUMBER: // Found b'bin-string'
lip->yySkip(); // Accept opening '
while ((c= lip->yyGet()) == '0' || c == '1');
while ((c= lip->yyGet()) == '0' || c == '1') ;
if (c != '\'')
return(ABORT_SYM); // Illegal hex constant
lip->yySkip(); // Accept closing '
......@@ -1446,7 +1445,7 @@ int MYSQLlex(void *arg, void *yythd)
[(global | local | session) .]variable_name
*/
for (result_state= 0; ident_map[c= lip->yyGet()]; result_state|= c);
for (result_state= 0; ident_map[c= lip->yyGet()]; result_state|= c) ;
/* If there were non-ASCII characters, mark that we must convert */
result_state= result_state & 0x80 ? IDENT_QUOTED : IDENT;
......
......@@ -750,9 +750,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))
{
......@@ -1151,8 +1151,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;
......
......@@ -5171,7 +5171,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)
......@@ -5205,7 +5205,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)
......@@ -5483,7 +5483,7 @@ bool check_some_access(THD *thd, ulong want_access, TABLE_LIST *table)
if (!check_access(thd, access, table->db,
&table->grant.privilege, 0, 1,
test(table->schema_table)) &&
!check_grant(thd, access, table, 0, 1, 1))
!check_grant(thd, access, table, 0, 1, 1))
DBUG_RETURN(0);
}
}
......@@ -7803,7 +7803,7 @@ bool parse_sql(THD *thd,
/* Check that if MYSQLparse() failed, thd->is_error() is set. */
DBUG_ASSERT(!mysql_parse_status ||
mysql_parse_status && thd->is_error());
(mysql_parse_status && thd->is_error()));
/* Reset parser state. */
......
......@@ -1434,8 +1434,8 @@ 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, UINT_MAX, FALSE) ||
open_normal_and_derived_tables(thd, tables, 0))
if ((tables && check_table_access(thd, SELECT_ACL, tables, UINT_MAX, FALSE))
|| open_normal_and_derived_tables(thd, tables, 0))
goto error;
while ((var= it++))
......@@ -1470,13 +1470,13 @@ static bool mysql_test_call_fields(Prepared_statement *stmt,
THD *thd= stmt->thd;
Item *item;
if (tables && check_table_access(thd, SELECT_ACL, tables, UINT_MAX, FALSE) ||
if ((tables && check_table_access(thd, SELECT_ACL, tables, UINT_MAX, FALSE)) ||
open_normal_and_derived_tables(thd, tables, 0))
goto err;
while ((item= it++))
{
if (!item->fixed && item->fix_fields(thd, it.ref()) ||
if ((!item->fixed && item->fix_fields(thd, it.ref())) ||
item->check_cols(1))
goto err;
}
......@@ -2227,9 +2227,8 @@ void mysql_sql_stmt_prepare(THD *thd)
LEX_STRING *name= &lex->prepared_stmt_name;
Prepared_statement *stmt;
const char *query;
uint query_len;
uint query_len= 0;
DBUG_ENTER("mysql_sql_stmt_prepare");
LINT_INIT(query_len);
DBUG_ASSERT(thd->protocol == &thd->protocol_text);
if ((stmt= (Prepared_statement*) thd->stmt_map.find_by_name(name)))
......@@ -2846,7 +2845,7 @@ void Prepared_statement::setup_set_params()
Decide if we have to expand the query (because we must write it to logs or
because we want to look it up in the query cache) or not.
*/
if (mysql_bin_log.is_open() && is_update_query(lex->sql_command) ||
if ((mysql_bin_log.is_open() && is_update_query(lex->sql_command)) ||
opt_log || opt_slow_log ||
query_cache_is_cacheable_query(lex))
{
......@@ -3297,7 +3296,7 @@ Prepared_statement::reprepare()
&cur_db_changed))
return TRUE;
error= (name.str && copy.set_name(&name) ||
error= ((name.str && copy.set_name(&name)) ||
copy.prepare(query, query_length) ||
validate_metadata(&copy));
......
......@@ -1350,7 +1350,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);
......@@ -1868,9 +1868,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 */
......@@ -2344,9 +2344,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;
}
......@@ -2361,9 +2362,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;
}
......@@ -3841,7 +3843,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
......@@ -5146,8 +5148,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 &&
......@@ -5273,7 +5275,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 &&
......@@ -6220,8 +6222,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 &&
......@@ -7354,7 +7356,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();
}
}
......@@ -10032,9 +10034,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;
share->reclength= reclength;
......@@ -10835,9 +10837,8 @@ do_select(JOIN *join,List<Item> *fields,TABLE *table,Procedure *procedure)
{
int rc= 0;
enum_nested_loop_state error= NESTED_LOOP_OK;
JOIN_TAB *join_tab;
JOIN_TAB *join_tab= NULL;
DBUG_ENTER("do_select");
LINT_INIT(join_tab);
join->procedure=procedure;
join->tmp_table= table; /* Save for easy recursion */
......@@ -13076,9 +13077,9 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit,
*/
uint nr;
key_map keys;
uint best_key_parts;
int best_key_direction;
ha_rows best_records;
uint best_key_parts= 0;
int best_key_direction= 0;
ha_rows best_records= 0;
double read_time;
int best_key= -1;
bool is_best_covering= FALSE;
......@@ -13088,9 +13089,6 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit,
ha_rows table_records= table->file->stats.records;
bool group= join->group && order == join->group_list;
ha_rows ref_key_quick_rows= HA_POS_ERROR;
LINT_INIT(best_key_parts);
LINT_INIT(best_key_direction);
LINT_INIT(best_records);
/*
If not used with LIMIT, only use keys if the whole query can be
......@@ -13135,8 +13133,8 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit,
(direction= test_if_order_by_key(order, table, nr, &used_key_parts)))
{
bool is_covering= table->covering_keys.is_set(nr) ||
nr == table->s->primary_key &&
table->file->primary_key_is_clustered();
(nr == table->s->primary_key &&
table->file->primary_key_is_clustered());
/*
Don't use an index scan with ORDER BY without limit.
......@@ -13149,7 +13147,7 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit,
*/
if (is_covering ||
select_limit != HA_POS_ERROR ||
ref_key < 0 && (group || table->force_index))
(ref_key < 0 && (group || table->force_index)))
{
double rec_per_key;
double index_scan_time;
......@@ -13215,12 +13213,12 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit,
index_scan_time= select_limit/rec_per_key *
min(rec_per_key, table->file->scan_time());
if (is_covering ||
ref_key < 0 && (group || table->force_index) ||
(ref_key < 0 && (group || table->force_index)) ||
index_scan_time < read_time)
{
ha_rows quick_records= table_records;
if (is_best_covering && !is_covering ||
is_covering && ref_key_quick_rows < select_limit)
if ((is_best_covering && !is_covering) ||
(is_covering && ref_key_quick_rows < select_limit))
continue;
if (table->quick_keys.is_set(nr))
quick_records= table->quick_rows[nr];
......@@ -13428,8 +13426,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,
is_order_by ? &table->keys_in_use_for_order_by :
&table->keys_in_use_for_group_by))
......@@ -14270,8 +14268,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,
......@@ -14706,7 +14704,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));
......
......@@ -601,7 +601,7 @@ mysqld_show_create(THD *thd, TABLE_LIST *table_list)
if (open_normal_and_derived_tables(thd, table_list, 0))
{
if (!table_list->view ||
thd->is_error() && thd->main_da.sql_errno() != ER_VIEW_INVALID)
(thd->is_error() && thd->main_da.sql_errno() != ER_VIEW_INVALID))
DBUG_RETURN(TRUE);
/*
......@@ -3238,10 +3238,10 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
if lookup value is empty string then
it's impossible table name or db name
*/
if (lookup_field_vals.db_value.str &&
!lookup_field_vals.db_value.str[0] ||
lookup_field_vals.table_value.str &&
!lookup_field_vals.table_value.str[0])
if ((lookup_field_vals.db_value.str &&
!lookup_field_vals.db_value.str[0]) ||
(lookup_field_vals.table_value.str &&
!lookup_field_vals.table_value.str[0]))
{
error= 0;
goto err;
......@@ -4116,10 +4116,10 @@ bool store_schema_proc(THD *thd, TABLE *table, TABLE *proc_table,
TYPE_ENUM_PROCEDURE))
return 0;
if (lex->sql_command == SQLCOM_SHOW_STATUS_PROC &&
proc_table->field[2]->val_int() == TYPE_ENUM_PROCEDURE ||
lex->sql_command == SQLCOM_SHOW_STATUS_FUNC &&
proc_table->field[2]->val_int() == TYPE_ENUM_FUNCTION ||
if ((lex->sql_command == SQLCOM_SHOW_STATUS_PROC &&
proc_table->field[2]->val_int() == TYPE_ENUM_PROCEDURE) ||
(lex->sql_command == SQLCOM_SHOW_STATUS_FUNC &&
proc_table->field[2]->val_int() == TYPE_ENUM_FUNCTION) ||
(sql_command_flags[lex->sql_command] & CF_STATUS_COMMAND) == 0)
{
restore_record(table, s->default_values);
......
......@@ -1927,8 +1927,8 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
FN_IS_TMP : 0);
}
if (drop_temporary ||
(table_type == NULL &&
(access(path, F_OK) &&
((table_type == NULL &&
access(path, F_OK) &&
ha_create_table_from_engine(thd, db, alias)) ||
(!drop_view &&
mysql_frm_type(thd, path, &frm_db_type) != FRMTYPE_TABLE)))
......@@ -2010,7 +2010,7 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
if (!dont_log_query)
{
if (!thd->current_stmt_binlog_row_based ||
non_temp_tables_count > 0 && !tmp_table_deleted)
(non_temp_tables_count > 0 && !tmp_table_deleted))
{
/*
In this case, we are either using statement-based
......@@ -2719,8 +2719,8 @@ mysql_prepare_create_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();
}
......@@ -3189,7 +3189,7 @@ mysql_prepare_create_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
......@@ -5589,8 +5589,8 @@ compare_tables(TABLE *table,
/* Don't pack rows in old tables if the user has requested this. */
if (create_info->row_type == ROW_TYPE_DYNAMIC ||
(tmp_new_field->flags & BLOB_FLAG) ||
tmp_new_field->sql_type == MYSQL_TYPE_VARCHAR &&
create_info->row_type != ROW_TYPE_FIXED)
(tmp_new_field->sql_type == MYSQL_TYPE_VARCHAR &&
create_info->row_type != ROW_TYPE_FIXED))
create_info->table_options|= HA_OPTION_PACK_RECORD;
/* Check if field was renamed */
......@@ -6271,21 +6271,15 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
#endif
bool need_lock_for_indexes= TRUE;
KEY *key_info_buffer;
uint index_drop_count;
uint *index_drop_buffer;
uint index_add_count;
uint *index_add_buffer;
uint candidate_key_count;
uint index_drop_count= 0;
uint *index_drop_buffer= NULL;
uint index_add_count= 0;
uint *index_add_buffer= NULL;
uint candidate_key_count= 0;
bool committed= 0;
bool no_pk;
DBUG_ENTER("mysql_alter_table");
LINT_INIT(index_add_count);
LINT_INIT(index_drop_count);
LINT_INIT(index_add_buffer);
LINT_INIT(index_drop_buffer);
LINT_INIT(candidate_key_count);
/*
Check if we attempt to alter mysql.slow_log or
mysql.general_log table and return an error if
......@@ -7220,12 +7214,12 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
}
else if (mysql_rename_table(new_db_type, new_db, tmp_name, new_db,
new_alias, FN_FROM_IS_TMP) ||
(new_name != table_name || new_db != db) && // we also do rename
((new_name != table_name || new_db != db) && // we also do rename
(need_copy_table != ALTER_TABLE_METADATA_ONLY ||
mysql_rename_table(save_old_db_type, db, table_name, new_db,
new_alias, NO_FRM_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;
......
......@@ -344,7 +344,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);
......
......@@ -1814,7 +1814,7 @@ void multi_update::abort()
{
/* 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 */
......
......@@ -5925,7 +5925,7 @@ alter_list_item:
MYSQL_YYABORT;
}
if (check_table_name($3->table.str,$3->table.length) ||
$3->db.str && check_db_name(&$3->db))
($3->db.str && check_db_name(&$3->db)))
{
my_error(ER_WRONG_TABLE_NAME, MYF(0), $3->table.str);
MYSQL_YYABORT;
......@@ -6079,8 +6079,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)))
{
......
......@@ -464,34 +464,35 @@ inline bool is_system_table_name(const char *name, uint length)
CHARSET_INFO *ci= system_charset_info;
return (
/* mysql.proc table */
length == 4 &&
my_tolower(ci, name[0]) == 'p' &&
my_tolower(ci, name[1]) == 'r' &&
my_tolower(ci, name[2]) == 'o' &&
my_tolower(ci, name[3]) == 'c' ||
length > 4 &&
(
/* one of mysql.help* tables */
my_tolower(ci, name[0]) == 'h' &&
my_tolower(ci, name[1]) == 'e' &&
my_tolower(ci, name[2]) == 'l' &&
my_tolower(ci, name[3]) == 'p' ||
/* one of mysql.time_zone* tables */
my_tolower(ci, name[0]) == 't' &&
my_tolower(ci, name[1]) == 'i' &&
my_tolower(ci, name[2]) == 'm' &&
my_tolower(ci, name[3]) == 'e' ||
/* mysql.event table */
my_tolower(ci, name[0]) == 'e' &&
my_tolower(ci, name[1]) == 'v' &&
my_tolower(ci, name[2]) == 'e' &&
my_tolower(ci, name[3]) == 'n' &&
my_tolower(ci, name[4]) == 't'
)
/* mysql.proc table */
(length == 4 &&
my_tolower(ci, name[0]) == 'p' &&
my_tolower(ci, name[1]) == 'r' &&
my_tolower(ci, name[2]) == 'o' &&
my_tolower(ci, name[3]) == 'c') ||
(length > 4 &&
(
/* one of mysql.help* tables */
(my_tolower(ci, name[0]) == 'h' &&
my_tolower(ci, name[1]) == 'e' &&
my_tolower(ci, name[2]) == 'l' &&
my_tolower(ci, name[3]) == 'p') ||
/* one of mysql.time_zone* tables */
(my_tolower(ci, name[0]) == 't' &&
my_tolower(ci, name[1]) == 'i' &&
my_tolower(ci, name[2]) == 'm' &&
my_tolower(ci, name[3]) == 'e') ||
/* mysql.event table */
(my_tolower(ci, name[0]) == 'e' &&
my_tolower(ci, name[1]) == 'v' &&
my_tolower(ci, name[2]) == 'e' &&
my_tolower(ci, name[3]) == 'n' &&
my_tolower(ci, name[4]) == 't')
)
)
);
}
......@@ -3314,8 +3315,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);
......@@ -4031,7 +4032,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 ==
......@@ -4040,7 +4041,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));
......
......@@ -111,8 +111,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)--;
......@@ -129,8 +129,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;
......
......@@ -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;
......
......@@ -603,9 +603,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);
......
......@@ -2828,34 +2828,32 @@ 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)
stats.records= (ha_rows) my_strtoll10(row[4], (char**) 0,
data_file_length = ?
index_file_length = ?
delete_length = ?
*/
if (row[4] != NULL)
stats.records= (ha_rows) my_strtoll10(row[4], (char**) 0,
&error);
if (row[5] != NULL)
stats.mean_rec_length= (ulong) my_strtoll10(row[5], (char**) 0, &error);
if (row[5] != NULL)
stats.mean_rec_length= (ulong) my_strtoll10(row[5], (char**) 0, &error);
stats.data_file_length= stats.records * stats.mean_rec_length;
stats.data_file_length= stats.records * stats.mean_rec_length;
if (row[12] != NULL)
stats.update_time= (ulong) my_strtoll10(row[12], (char**) 0,
if (row[12] != NULL)
stats.update_time= (ulong) my_strtoll10(row[12], (char**) 0,
&error);
if (row[13] != NULL)
stats.check_time= (ulong) my_strtoll10(row[13], (char**) 0,
if (row[13] != NULL)
stats.check_time= (ulong) my_strtoll10(row[13], (char**) 0,
&error);
}
/*
size of IO operations (This is based on a good guess, no high science
involved)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment