Merge from 5.0-bugteam

This commit is contained in:
Staale Smedseng 2009-06-17 16:56:44 +02:00
commit c429fac63c
23 changed files with 201 additions and 220 deletions

View File

@ -1507,10 +1507,6 @@ bool DTCollation::aggregate(DTCollation &dt, uint flags)
{ {
set(dt); set(dt);
} }
else
{
// Do nothing
}
} }
else if ((flags & MY_COLL_ALLOW_SUPERSET_CONV) && else if ((flags & MY_COLL_ALLOW_SUPERSET_CONV) &&
left_is_superset(this, &dt)) left_is_superset(this, &dt))

View File

@ -116,12 +116,12 @@ struct MBR
int touches(const MBR *mbr) int touches(const MBR *mbr)
{ {
/* The following should be safe, even if we compare doubles */ /* The following should be safe, even if we compare doubles */
return ((((mbr->xmin == xmax) || (mbr->xmax == xmin)) && return ((mbr->xmin == xmax || mbr->xmax == xmin) &&
(((mbr->ymin >= ymin) && (mbr->ymin <= ymax)) || ((mbr->ymin >= ymin && mbr->ymin <= ymax) ||
((mbr->ymax >= ymin) && (mbr->ymax <= ymax)))) || (mbr->ymax >= ymin && mbr->ymax <= ymax))) ||
(((mbr->ymin == ymax) || (mbr->ymax == ymin)) && ((mbr->ymin == ymax || mbr->ymax == ymin) &&
(((mbr->xmin >= xmin) && (mbr->xmin <= xmax)) || ((mbr->xmin >= xmin && mbr->xmin <= xmax) ||
((mbr->xmax >= xmin) && (mbr->xmax <= xmax))))); (mbr->xmax >= xmin && mbr->xmax <= xmax)));
} }
int within(const MBR *mbr) int within(const MBR *mbr)

View File

@ -1192,12 +1192,12 @@ static void acl_update_user(const char *user, const char *host,
for (uint i=0 ; i < acl_users.elements ; i++) for (uint i=0 ; i < acl_users.elements ; i++)
{ {
ACL_USER *acl_user=dynamic_element(&acl_users,i,ACL_USER*); ACL_USER *acl_user=dynamic_element(&acl_users,i,ACL_USER*);
if (!acl_user->user && !user[0] || if ((!acl_user->user && !user[0]) ||
acl_user->user && !strcmp(user,acl_user->user)) (acl_user->user && !strcmp(user,acl_user->user)))
{ {
if (!acl_user->host.hostname && !host[0] || if ((!acl_user->host.hostname && !host[0]) ||
acl_user->host.hostname && (acl_user->host.hostname &&
!my_strcasecmp(system_charset_info, host, acl_user->host.hostname)) !my_strcasecmp(system_charset_info, host, acl_user->host.hostname)))
{ {
acl_user->access=privileges; acl_user->access=privileges;
if (mqh->specified_limits & USER_RESOURCES::QUERIES_PER_HOUR) 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++) for (uint i=0 ; i < acl_dbs.elements ; i++)
{ {
ACL_DB *acl_db=dynamic_element(&acl_dbs,i,ACL_DB*); ACL_DB *acl_db=dynamic_element(&acl_dbs,i,ACL_DB*);
if (!acl_db->user && !user[0] || if ((!acl_db->user && !user[0]) ||
acl_db->user && (acl_db->user &&
!strcmp(user,acl_db->user)) !strcmp(user,acl_db->user)))
{ {
if (!acl_db->host.hostname && !host[0] || if ((!acl_db->host.hostname && !host[0]) ||
acl_db->host.hostname && (acl_db->host.hostname &&
!strcmp(host, acl_db->host.hostname)) !strcmp(host, acl_db->host.hostname)))
{ {
if (!acl_db->db && !db[0] || if ((!acl_db->db && !db[0]) ||
acl_db->db && !strcmp(db,acl_db->db)) (acl_db->db && !strcmp(db,acl_db->db)))
{ {
if (privileges) if (privileges)
acl_db->access=privileges; acl_db->access=privileges;
@ -1493,8 +1493,8 @@ bool acl_check_host(const char *host, const char *ip)
return 0; return 0;
VOID(pthread_mutex_lock(&acl_cache->lock)); VOID(pthread_mutex_lock(&acl_cache->lock));
if (host && hash_search(&acl_check_hosts,(uchar*) host,strlen(host)) || if ((host && hash_search(&acl_check_hosts,(uchar*) host,strlen(host))) ||
ip && hash_search(&acl_check_hosts,(uchar*) ip, strlen(ip))) (ip && hash_search(&acl_check_hosts,(uchar*) ip, strlen(ip))))
{ {
VOID(pthread_mutex_unlock(&acl_cache->lock)); VOID(pthread_mutex_unlock(&acl_cache->lock));
return 0; // Found host return 0; // Found host
@ -1711,8 +1711,8 @@ find_acl_user(const char *host, const char *user, my_bool exact)
host, host,
acl_user->host.hostname ? acl_user->host.hostname : acl_user->host.hostname ? acl_user->host.hostname :
"")); ""));
if (!acl_user->user && !user[0] || if ((!acl_user->user && !user[0]) ||
acl_user->user && !strcmp(user,acl_user->user)) (acl_user->user && !strcmp(user,acl_user->user)))
{ {
if (exact ? !my_strcasecmp(system_charset_info, host, if (exact ? !my_strcasecmp(system_charset_info, host,
acl_user->host.hostname ? acl_user->host.hostname ?
@ -5319,16 +5319,13 @@ static int handle_grant_struct(uint struct_no, bool drop,
uint elements; uint elements;
const char *user; const char *user;
const char *host; const char *host;
ACL_USER *acl_user; ACL_USER *acl_user= NULL;
ACL_DB *acl_db; ACL_DB *acl_db= NULL;
GRANT_NAME *grant_name; GRANT_NAME *grant_name= NULL;
DBUG_ENTER("handle_grant_struct"); DBUG_ENTER("handle_grant_struct");
DBUG_PRINT("info",("scan struct: %u search: '%s'@'%s'", DBUG_PRINT("info",("scan struct: %u search: '%s'@'%s'",
struct_no, user_from->user.str, user_from->host.str)); 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(user);
LINT_INIT(host); LINT_INIT(host);

View File

@ -473,13 +473,14 @@ static TABLE_SHARE
@todo Rework alternative ways to deal with ER_NO_SUCH TABLE. @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); DBUG_RETURN(share);
/* Table didn't exist. Check if some engine can provide it */ /* Table didn't exist. Check if some engine can provide it */
if ((tmp= ha_create_table_from_engine(thd, table_list->db, tmp= ha_create_table_from_engine(thd, table_list->db,
table_list->table_name)) < 0) table_list->table_name);
if (tmp < 0)
{ {
/* /*
No such table in any engine. No such table in any engine.
@ -1431,11 +1432,10 @@ static inline uint tmpkeyval(THD *thd, TABLE *table)
void close_temporary_tables(THD *thd) void close_temporary_tables(THD *thd)
{ {
TABLE *table; TABLE *table;
TABLE *next; TABLE *next= NULL;
TABLE *prev_table; TABLE *prev_table;
/* Assume thd->options has OPTION_QUOTE_SHOW_CREATE */ /* Assume thd->options has OPTION_QUOTE_SHOW_CREATE */
bool was_quote_show= TRUE; bool was_quote_show= TRUE;
LINT_INIT(next);
if (!thd->temporary_tables) if (!thd->temporary_tables)
return; 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 higher then we require
distance == 0 - we have lock mode exactly which we need distance == 0 - we have lock mode exactly which we need
*/ */
if (best_distance < 0 && distance > best_distance || if ((best_distance < 0 && distance > best_distance) ||
distance >= 0 && distance < best_distance) (distance >= 0 && distance < best_distance))
{ {
best_distance= distance; best_distance= distance;
best_table= table; 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). (and not an item that happens to have a name).
*/ */
bool is_ref_by_name= 0; bool is_ref_by_name= 0;
uint unaliased_counter; uint unaliased_counter= 0;
LINT_INIT(unaliased_counter); // Dependent on found_unaliased
*resolution= NOT_RESOLVED; *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; thd->lex->current_select->cur_pos_in_select_list= 0;
while ((item= it++)) 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)) (item= *(it.ref()))->check_cols(1))
{ {
thd->lex->current_select->is_item_list_lookup= save_is_item_list_lookup; 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()); DBUG_ASSERT(tables->is_leaf_for_name_resolution());
if (table_name && my_strcasecmp(table_alias_charset, table_name, if ((table_name && my_strcasecmp(table_alias_charset, table_name,
tables->alias) || tables->alias)) ||
(db_name && strcmp(tables->db,db_name))) (db_name && strcmp(tables->db,db_name)))
continue; 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 information_schema table, or a nested table reference. See the comment
for TABLE_LIST. for TABLE_LIST.
*/ */
if (!(table && !tables->view && (table->grant.privilege & SELECT_ACL) || if (!((table && !tables->view && (table->grant.privilege & SELECT_ACL)) ||
tables->view && (tables->grant.privilege & SELECT_ACL)) && (tables->view && (tables->grant.privilege & SELECT_ACL))) &&
!any_privileges) !any_privileges)
{ {
field_iterator.set(tables); field_iterator.set(tables);
@ -7840,7 +7839,7 @@ insert_fields(THD *thd, Name_resolution_context *context, const char *db_name,
*/ */
if (any_privileges) if (any_privileges)
{ {
DBUG_ASSERT(tables->field_translation == NULL && table || DBUG_ASSERT((tables->field_translation == NULL && table) ||
tables->is_natural_join); tables->is_natural_join);
DBUG_ASSERT(item->type() == Item::FIELD_ITEM); DBUG_ASSERT(item->type() == Item::FIELD_ITEM);
Item_field *fld= (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) if (*conds)
{ {
thd->where="where clause"; thd->where="where clause";
if (!(*conds)->fixed && (*conds)->fix_fields(thd, conds) || if ((!(*conds)->fixed && (*conds)->fix_fields(thd, conds)) ||
(*conds)->check_cols(1)) (*conds)->check_cols(1))
goto err_no_arena; 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 */ /* Make a join an a expression */
thd->where="on clause"; thd->where="on clause";
if (!embedded->on_expr->fixed && if ((!embedded->on_expr->fixed &&
embedded->on_expr->fix_fields(thd, &embedded->on_expr) || embedded->on_expr->fix_fields(thd, &embedded->on_expr)) ||
embedded->on_expr->check_cols(1)) embedded->on_expr->check_cols(1))
goto err_no_arena; goto err_no_arena;
select_lex->cond_count++; select_lex->cond_count++;
@ -8155,8 +8154,8 @@ fill_record_n_invoke_before_triggers(THD *thd, List<Item> &fields,
enum trg_event_type event) enum trg_event_type event)
{ {
return (fill_record(thd, fields, values, ignore_errors) || return (fill_record(thd, fields, values, ignore_errors) ||
triggers && triggers->process_triggers(thd, event, (triggers && triggers->process_triggers(thd, event,
TRG_ACTION_BEFORE, TRUE)); TRG_ACTION_BEFORE, TRUE)));
} }
@ -8250,8 +8249,8 @@ fill_record_n_invoke_before_triggers(THD *thd, Field **ptr,
enum trg_event_type event) enum trg_event_type event)
{ {
return (fill_record(thd, ptr, values, ignore_errors) || return (fill_record(thd, ptr, values, ignore_errors) ||
triggers && triggers->process_triggers(thd, event, (triggers && triggers->process_triggers(thd, event,
TRG_ACTION_BEFORE, TRUE)); TRG_ACTION_BEFORE, TRUE)));
} }

View File

@ -806,7 +806,7 @@ void multi_delete::abort()
/* the error was handled or nothing deleted and no side effects return */ /* the error was handled or nothing deleted and no side effects return */
if (error_handled || if (error_handled ||
!thd->transaction.stmt.modified_non_trans_table && !deleted) (!thd->transaction.stmt.modified_non_trans_table && !deleted))
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
/* Something already deleted so we have to invalidate cache */ /* Something already deleted so we have to invalidate cache */

View File

@ -301,9 +301,7 @@ static int check_update_fields(THD *thd, TABLE_LIST *insert_table_list,
List<Item> &update_fields, table_map *map) List<Item> &update_fields, table_map *map)
{ {
TABLE *table= insert_table_list->table; TABLE *table= insert_table_list->table;
my_bool timestamp_mark; my_bool timestamp_mark= 0;
LINT_INIT(timestamp_mark);
if (table->timestamp_field) if (table->timestamp_field)
{ {
@ -393,7 +391,7 @@ void upgrade_lock_type(THD *thd, thr_lock_type *lock_type,
bool is_multi_insert) bool is_multi_insert)
{ {
if (duplic == DUP_UPDATE || 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; *lock_type= TL_WRITE_DEFAULT;
return; return;
@ -858,8 +856,9 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list,
*/ */
query_cache_invalidate3(thd, table_list, 1); query_cache_invalidate3(thd, table_list, 1);
} }
if (changed && error <= 0 || thd->transaction.stmt.modified_non_trans_table if ((changed && error <= 0) ||
|| was_insert_delayed) thd->transaction.stmt.modified_non_trans_table ||
was_insert_delayed)
{ {
if (mysql_bin_log.is_open()) 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_NO_IGNORE_DUP_KEY);
table->file->extra(HA_EXTRA_WRITE_CANNOT_REPLACE); 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 We must invalidate the table in the query cache before binlog writing

View File

@ -780,7 +780,7 @@ bool consume_comment(Lex_input_stream *lip, int remaining_recursions_permitted)
int MYSQLlex(void *arg, void *yythd) int MYSQLlex(void *arg, void *yythd)
{ {
reg1 uchar c; reg1 uchar c= 0;
bool comment_closed; bool comment_closed;
int tokval, result_state; int tokval, result_state;
uint length; uint length;
@ -798,7 +798,6 @@ int MYSQLlex(void *arg, void *yythd)
lip->start_token(); lip->start_token();
state=lip->next_state; state=lip->next_state;
lip->next_state=MY_LEX_OPERATOR_OR_IDENT; lip->next_state=MY_LEX_OPERATOR_OR_IDENT;
LINT_INIT(c);
for (;;) for (;;)
{ {
switch (state) { switch (state) {

View File

@ -750,9 +750,9 @@ read_sep_field(THD *thd, COPY_INFO &info, TABLE_LIST *table_list,
real_item= item->real_item(); real_item= item->real_item();
if (!read_info.enclosed && if ((!read_info.enclosed &&
(enclosed_length && length == 4 && (enclosed_length && length == 4 &&
!memcmp(pos, STRING_WITH_LEN("NULL"))) || !memcmp(pos, STRING_WITH_LEN("NULL")))) ||
(length == 1 && read_info.found_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 // End of enclosed field if followed by field_term or line_term
if (chr == my_b_EOF || if (chr == my_b_EOF ||
chr == line_term_char && terminator(line_term_ptr, (chr == line_term_char && terminator(line_term_ptr,
line_term_length)) line_term_length)))
{ // Maybe unexpected linefeed { // Maybe unexpected linefeed
enclosed=1; enclosed=1;
found_end_of_line=1; found_end_of_line=1;

View File

@ -5171,7 +5171,7 @@ check_access(THD *thd, ulong want_access, const char *db, ulong *save_priv,
if (schema_db) 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))) (want_access & ~(SELECT_ACL | EXTRA_ACL | FILE_ACL)))
{ {
if (!no_errors) if (!no_errors)
@ -5205,7 +5205,7 @@ check_access(THD *thd, ulong want_access, const char *db, ulong *save_priv,
DBUG_RETURN(FALSE); DBUG_RETURN(FALSE);
} }
if (((want_access & ~sctx->master_access) & ~(DB_ACLS | EXTRA_ACL)) || 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 { // We can never grant this
DBUG_PRINT("error",("No possible access")); DBUG_PRINT("error",("No possible access"));
if (!no_errors) if (!no_errors)
@ -7803,7 +7803,7 @@ bool parse_sql(THD *thd,
/* Check that if MYSQLparse() failed, thd->is_error() is set. */ /* Check that if MYSQLparse() failed, thd->is_error() is set. */
DBUG_ASSERT(!mysql_parse_status || DBUG_ASSERT(!mysql_parse_status ||
mysql_parse_status && thd->is_error()); (mysql_parse_status && thd->is_error()));
/* Reset parser state. */ /* Reset parser state. */

View File

@ -1434,8 +1434,8 @@ static bool mysql_test_set_fields(Prepared_statement *stmt,
THD *thd= stmt->thd; THD *thd= stmt->thd;
set_var_base *var; set_var_base *var;
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)) || open_normal_and_derived_tables(thd, tables, 0))
goto error; goto error;
while ((var= it++)) while ((var= it++))
@ -1470,13 +1470,13 @@ static bool mysql_test_call_fields(Prepared_statement *stmt,
THD *thd= stmt->thd; THD *thd= stmt->thd;
Item *item; 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)) open_normal_and_derived_tables(thd, tables, 0))
goto err; goto err;
while ((item= it++)) 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)) item->check_cols(1))
goto err; goto err;
} }
@ -2227,9 +2227,8 @@ void mysql_sql_stmt_prepare(THD *thd)
LEX_STRING *name= &lex->prepared_stmt_name; LEX_STRING *name= &lex->prepared_stmt_name;
Prepared_statement *stmt; Prepared_statement *stmt;
const char *query; const char *query;
uint query_len; uint query_len= 0;
DBUG_ENTER("mysql_sql_stmt_prepare"); DBUG_ENTER("mysql_sql_stmt_prepare");
LINT_INIT(query_len);
DBUG_ASSERT(thd->protocol == &thd->protocol_text); DBUG_ASSERT(thd->protocol == &thd->protocol_text);
if ((stmt= (Prepared_statement*) thd->stmt_map.find_by_name(name))) 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 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. 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 || opt_log || opt_slow_log ||
query_cache_is_cacheable_query(lex)) query_cache_is_cacheable_query(lex))
{ {
@ -3297,7 +3296,7 @@ Prepared_statement::reprepare()
&cur_db_changed)) &cur_db_changed))
return TRUE; return TRUE;
error= (name.str && copy.set_name(&name) || error= ((name.str && copy.set_name(&name)) ||
copy.prepare(query, query_length) || copy.prepare(query, query_length) ||
validate_metadata(&copy)); validate_metadata(&copy));

View File

@ -1350,7 +1350,7 @@ JOIN::optimize()
join_tab[const_tables].type != JT_ALL && join_tab[const_tables].type != JT_ALL &&
join_tab[const_tables].type != JT_FT && join_tab[const_tables].type != JT_FT &&
join_tab[const_tables].type != JT_REF_OR_NULL && 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])) { if (add_ref_to_table_cond(thd,&join_tab[const_tables])) {
DBUG_RETURN(1); DBUG_RETURN(1);
@ -1868,9 +1868,9 @@ JOIN::exec()
like SEC_TO_TIME(SUM(...)). 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->order) ||
curr_join->select_distinct) || curr_join->select_distinct)) ||
(curr_join->select_distinct && (curr_join->select_distinct &&
curr_join->tmp_table_param.using_indirect_summary_function)) curr_join->tmp_table_param.using_indirect_summary_function))
{ /* Must copy to another table */ { /* Must copy to another table */
@ -2344,9 +2344,10 @@ mysql_select(THD *thd, Item ***rref_pointer_array,
} }
else else
{ {
if (err= join->prepare(rref_pointer_array, tables, wild_num, err= join->prepare(rref_pointer_array, tables, wild_num,
conds, og_num, order, group, having, proc_param, conds, og_num, order, group, having, proc_param,
select_lex, unit)) select_lex, unit);
if (err)
{ {
goto err; goto err;
} }
@ -2361,9 +2362,10 @@ mysql_select(THD *thd, Item ***rref_pointer_array,
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
thd_proc_info(thd, "init"); thd_proc_info(thd, "init");
thd->used_tables=0; // Updated by setup_fields thd->used_tables=0; // Updated by setup_fields
if (err= join->prepare(rref_pointer_array, tables, wild_num, err= join->prepare(rref_pointer_array, tables, wild_num,
conds, og_num, order, group, having, proc_param, conds, og_num, order, group, having, proc_param,
select_lex, unit)) select_lex, unit);
if (err)
{ {
goto 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 (use->key == prev->key && use->table == prev->table)
{ {
if (prev->keypart+1 < use->keypart || if (prev->keypart+1 < use->keypart ||
prev->keypart == use->keypart && found_eq_constant) (prev->keypart == use->keypart && found_eq_constant))
continue; /* remove */ continue; /* remove */
} }
else if (use->keypart != 0) // First found must be 0 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 || if (best_record_count > current_record_count ||
best_read_time > current_read_time || best_read_time > current_read_time ||
idx == join->const_tables && // 's' is the first table in the QEP (idx == join->const_tables && // 's' is the first table in the QEP
s->table == join->sort_by_table) s->table == join->sort_by_table))
{ {
if (best_record_count >= current_record_count && if (best_record_count >= current_record_count &&
best_read_time >= current_read_time && 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; double current_read_time=read_time+best;
if (best_record_count > current_record_count || if (best_record_count > current_record_count ||
best_read_time > current_read_time || 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 && if (best_record_count >= current_record_count &&
best_read_time >= current_read_time && 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 the index if we are using limit and this is the first table
*/ */
if (cond && if ((cond &&
(!tab->keys.is_subset(tab->const_keys) && i > 0) || !tab->keys.is_subset(tab->const_keys) && i > 0) ||
(!tab->const_keys.is_clear_all() && i == join->const_tables && (!tab->const_keys.is_clear_all() && i == join->const_tables &&
join->unit->select_limit_cnt < join->unit->select_limit_cnt <
join->best_positions[i].records_read && join->best_positions[i].records_read &&
@ -10032,9 +10034,9 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
reclength=1; // Dummy select reclength=1; // Dummy select
/* Use packed rows if there is blobs or a lot of space to gain */ /* Use packed rows if there is blobs or a lot of space to gain */
if (blob_count || 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 || (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; use_packed_rows= 1;
share->reclength= reclength; share->reclength= reclength;
@ -10835,9 +10837,8 @@ do_select(JOIN *join,List<Item> *fields,TABLE *table,Procedure *procedure)
{ {
int rc= 0; int rc= 0;
enum_nested_loop_state error= NESTED_LOOP_OK; enum_nested_loop_state error= NESTED_LOOP_OK;
JOIN_TAB *join_tab; JOIN_TAB *join_tab= NULL;
DBUG_ENTER("do_select"); DBUG_ENTER("do_select");
LINT_INIT(join_tab);
join->procedure=procedure; join->procedure=procedure;
join->tmp_table= table; /* Save for easy recursion */ 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; uint nr;
key_map keys; key_map keys;
uint best_key_parts; uint best_key_parts= 0;
int best_key_direction; int best_key_direction= 0;
ha_rows best_records; ha_rows best_records= 0;
double read_time; double read_time;
int best_key= -1; int best_key= -1;
bool is_best_covering= FALSE; 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; ha_rows table_records= table->file->stats.records;
bool group= join->group && order == join->group_list; bool group= join->group && order == join->group_list;
ha_rows ref_key_quick_rows= HA_POS_ERROR; 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 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))) (direction= test_if_order_by_key(order, table, nr, &used_key_parts)))
{ {
bool is_covering= table->covering_keys.is_set(nr) || bool is_covering= table->covering_keys.is_set(nr) ||
nr == table->s->primary_key && (nr == table->s->primary_key &&
table->file->primary_key_is_clustered(); table->file->primary_key_is_clustered());
/* /*
Don't use an index scan with ORDER BY without limit. 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 || if (is_covering ||
select_limit != HA_POS_ERROR || select_limit != HA_POS_ERROR ||
ref_key < 0 && (group || table->force_index)) (ref_key < 0 && (group || table->force_index)))
{ {
double rec_per_key; double rec_per_key;
double index_scan_time; 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 * index_scan_time= select_limit/rec_per_key *
min(rec_per_key, table->file->scan_time()); min(rec_per_key, table->file->scan_time());
if (is_covering || if (is_covering ||
ref_key < 0 && (group || table->force_index) || (ref_key < 0 && (group || table->force_index)) ||
index_scan_time < read_time) index_scan_time < read_time)
{ {
ha_rows quick_records= table_records; ha_rows quick_records= table_records;
if (is_best_covering && !is_covering || if ((is_best_covering && !is_covering) ||
is_covering && ref_key_quick_rows < select_limit) (is_covering && ref_key_quick_rows < select_limit))
continue; continue;
if (table->quick_keys.is_set(nr)) if (table->quick_keys.is_set(nr))
quick_records= table->quick_rows[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 || if ((order != join->group_list ||
!(join->select_options & SELECT_BIG_RESULT) || !(join->select_options & SELECT_BIG_RESULT) ||
select && select->quick && (select && select->quick &&
select->quick->get_type() == QUICK_SELECT_I::QS_TYPE_GROUP_MIN_MAX) && select->quick->get_type() == QUICK_SELECT_I::QS_TYPE_GROUP_MIN_MAX)) &&
test_if_skip_sort_order(tab,order,select_limit,0, test_if_skip_sort_order(tab,order,select_limit,0,
is_order_by ? &table->keys_in_use_for_order_by : is_order_by ? &table->keys_in_use_for_order_by :
&table->keys_in_use_for_group_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. */ /* Lookup the current GROUP field in the FROM clause. */
order_item_type= order_item->type(); order_item_type= order_item->type();
from_field= (Field*) not_found_field; from_field= (Field*) not_found_field;
if (is_group_field && if ((is_group_field &&
order_item_type == Item::FIELD_ITEM || order_item_type == Item::FIELD_ITEM) ||
order_item_type == Item::REF_ITEM) order_item_type == Item::REF_ITEM)
{ {
from_field= find_field_in_tables(thd, (Item_ident*) order_item, tables, from_field= find_field_in_tables(thd, (Item_ident*) order_item, tables,

View File

@ -601,7 +601,7 @@ mysqld_show_create(THD *thd, TABLE_LIST *table_list)
if (open_normal_and_derived_tables(thd, table_list, 0)) if (open_normal_and_derived_tables(thd, table_list, 0))
{ {
if (!table_list->view || 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); 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 if lookup value is empty string then
it's impossible table name or db name it's impossible table name or db name
*/ */
if (lookup_field_vals.db_value.str && if ((lookup_field_vals.db_value.str &&
!lookup_field_vals.db_value.str[0] || !lookup_field_vals.db_value.str[0]) ||
lookup_field_vals.table_value.str && (lookup_field_vals.table_value.str &&
!lookup_field_vals.table_value.str[0]) !lookup_field_vals.table_value.str[0]))
{ {
error= 0; error= 0;
goto err; goto err;
@ -4116,10 +4116,10 @@ bool store_schema_proc(THD *thd, TABLE *table, TABLE *proc_table,
TYPE_ENUM_PROCEDURE)) TYPE_ENUM_PROCEDURE))
return 0; return 0;
if (lex->sql_command == SQLCOM_SHOW_STATUS_PROC && if ((lex->sql_command == SQLCOM_SHOW_STATUS_PROC &&
proc_table->field[2]->val_int() == TYPE_ENUM_PROCEDURE || proc_table->field[2]->val_int() == TYPE_ENUM_PROCEDURE) ||
lex->sql_command == SQLCOM_SHOW_STATUS_FUNC && (lex->sql_command == SQLCOM_SHOW_STATUS_FUNC &&
proc_table->field[2]->val_int() == TYPE_ENUM_FUNCTION || proc_table->field[2]->val_int() == TYPE_ENUM_FUNCTION) ||
(sql_command_flags[lex->sql_command] & CF_STATUS_COMMAND) == 0) (sql_command_flags[lex->sql_command] & CF_STATUS_COMMAND) == 0)
{ {
restore_record(table, s->default_values); restore_record(table, s->default_values);

View File

@ -1927,8 +1927,8 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
FN_IS_TMP : 0); FN_IS_TMP : 0);
} }
if (drop_temporary || if (drop_temporary ||
(table_type == NULL && ((table_type == NULL &&
(access(path, F_OK) && access(path, F_OK) &&
ha_create_table_from_engine(thd, db, alias)) || ha_create_table_from_engine(thd, db, alias)) ||
(!drop_view && (!drop_view &&
mysql_frm_type(thd, path, &frm_db_type) != FRMTYPE_TABLE))) 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 (!dont_log_query)
{ {
if (!thd->current_stmt_binlog_row_based || 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 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 */ /* Don't pack rows in old tables if the user has requested this */
if ((sql_field->flags & BLOB_FLAG) || if ((sql_field->flags & BLOB_FLAG) ||
sql_field->sql_type == MYSQL_TYPE_VARCHAR && (sql_field->sql_type == MYSQL_TYPE_VARCHAR &&
create_info->row_type != ROW_TYPE_FIXED) create_info->row_type != ROW_TYPE_FIXED))
(*db_options)|= HA_OPTION_PACK_RECORD; (*db_options)|= HA_OPTION_PACK_RECORD;
it2.rewind(); 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->sql_type == MYSQL_TYPE_VARCHAR ||
sql_field->pack_flag & FIELDFLAG_BLOB))) 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) sql_field->sql_type == MYSQL_TYPE_VARCHAR)
key_info->flags|= HA_BINARY_PACK_KEY | HA_VAR_LENGTH_KEY; key_info->flags|= HA_BINARY_PACK_KEY | HA_VAR_LENGTH_KEY;
else else
@ -5589,8 +5589,8 @@ compare_tables(TABLE *table,
/* Don't pack rows in old tables if the user has requested this. */ /* Don't pack rows in old tables if the user has requested this. */
if (create_info->row_type == ROW_TYPE_DYNAMIC || if (create_info->row_type == ROW_TYPE_DYNAMIC ||
(tmp_new_field->flags & BLOB_FLAG) || (tmp_new_field->flags & BLOB_FLAG) ||
tmp_new_field->sql_type == MYSQL_TYPE_VARCHAR && (tmp_new_field->sql_type == MYSQL_TYPE_VARCHAR &&
create_info->row_type != ROW_TYPE_FIXED) create_info->row_type != ROW_TYPE_FIXED))
create_info->table_options|= HA_OPTION_PACK_RECORD; create_info->table_options|= HA_OPTION_PACK_RECORD;
/* Check if field was renamed */ /* Check if field was renamed */
@ -6271,21 +6271,15 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
#endif #endif
bool need_lock_for_indexes= TRUE; bool need_lock_for_indexes= TRUE;
KEY *key_info_buffer; KEY *key_info_buffer;
uint index_drop_count; uint index_drop_count= 0;
uint *index_drop_buffer; uint *index_drop_buffer= NULL;
uint index_add_count; uint index_add_count= 0;
uint *index_add_buffer; uint *index_add_buffer= NULL;
uint candidate_key_count; uint candidate_key_count= 0;
bool committed= 0; bool committed= 0;
bool no_pk; bool no_pk;
DBUG_ENTER("mysql_alter_table"); 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 Check if we attempt to alter mysql.slow_log or
mysql.general_log table and return an error if mysql.general_log table and return an error if
@ -7220,12 +7214,12 @@ view_err:
} }
else if (mysql_rename_table(new_db_type, new_db, tmp_name, new_db, else if (mysql_rename_table(new_db_type, new_db, tmp_name, new_db,
new_alias, FN_FROM_IS_TMP) || 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 || (need_copy_table != ALTER_TABLE_METADATA_ONLY ||
mysql_rename_table(save_old_db_type, db, table_name, new_db, mysql_rename_table(save_old_db_type, db, table_name, new_db,
new_alias, NO_FRM_RENAME)) && new_alias, NO_FRM_RENAME)) &&
Table_triggers_list::change_table_name(thd, db, table_name, Table_triggers_list::change_table_name(thd, db, table_name,
new_db, new_alias)) new_db, new_alias)))
{ {
/* Try to get everything back. */ /* Try to get everything back. */
error=1; error=1;

View File

@ -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 need second part of condition below, since check_access() function also
checks that db is specified. 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)); my_error(ER_NO_DB_ERROR, MYF(0));
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);

View File

@ -1814,7 +1814,7 @@ void multi_update::abort()
{ {
/* the error was handled or nothing deleted and no side effects return */ /* the error was handled or nothing deleted and no side effects return */
if (error_handled || if (error_handled ||
!thd->transaction.stmt.modified_non_trans_table && !updated) (!thd->transaction.stmt.modified_non_trans_table && !updated))
return; return;
/* Something already updated so we have to invalidate cache */ /* Something already updated so we have to invalidate cache */

View File

@ -5925,7 +5925,7 @@ alter_list_item:
MYSQL_YYABORT; MYSQL_YYABORT;
} }
if (check_table_name($3->table.str,$3->table.length) || 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); my_error(ER_WRONG_TABLE_NAME, MYF(0), $3->table.str);
MYSQL_YYABORT; MYSQL_YYABORT;
@ -6079,8 +6079,8 @@ slave_until:
| UNTIL_SYM slave_until_opts | UNTIL_SYM slave_until_opts
{ {
LEX *lex=Lex; LEX *lex=Lex;
if ((lex->mi.log_file_name || lex->mi.pos) && if (((lex->mi.log_file_name || lex->mi.pos) &&
(lex->mi.relay_log_name || lex->mi.relay_log_pos) || (lex->mi.relay_log_name || lex->mi.relay_log_pos)) ||
!((lex->mi.log_file_name && lex->mi.pos) || !((lex->mi.log_file_name && lex->mi.pos) ||
(lex->mi.relay_log_name && lex->mi.relay_log_pos))) (lex->mi.relay_log_name && lex->mi.relay_log_pos)))
{ {

View File

@ -465,32 +465,33 @@ inline bool is_system_table_name(const char *name, uint length)
return ( return (
/* mysql.proc table */ /* mysql.proc table */
length == 4 && (length == 4 &&
my_tolower(ci, name[0]) == 'p' && my_tolower(ci, name[0]) == 'p' &&
my_tolower(ci, name[1]) == 'r' && my_tolower(ci, name[1]) == 'r' &&
my_tolower(ci, name[2]) == 'o' && my_tolower(ci, name[2]) == 'o' &&
my_tolower(ci, name[3]) == 'c' || my_tolower(ci, name[3]) == 'c') ||
length > 4 && (length > 4 &&
( (
/* one of mysql.help* tables */ /* one of mysql.help* tables */
my_tolower(ci, name[0]) == 'h' && (my_tolower(ci, name[0]) == 'h' &&
my_tolower(ci, name[1]) == 'e' && my_tolower(ci, name[1]) == 'e' &&
my_tolower(ci, name[2]) == 'l' && my_tolower(ci, name[2]) == 'l' &&
my_tolower(ci, name[3]) == 'p' || my_tolower(ci, name[3]) == 'p') ||
/* one of mysql.time_zone* tables */ /* one of mysql.time_zone* tables */
my_tolower(ci, name[0]) == 't' && (my_tolower(ci, name[0]) == 't' &&
my_tolower(ci, name[1]) == 'i' && my_tolower(ci, name[1]) == 'i' &&
my_tolower(ci, name[2]) == 'm' && my_tolower(ci, name[2]) == 'm' &&
my_tolower(ci, name[3]) == 'e' || my_tolower(ci, name[3]) == 'e') ||
/* mysql.event table */ /* mysql.event table */
my_tolower(ci, name[0]) == 'e' && (my_tolower(ci, name[0]) == 'e' &&
my_tolower(ci, name[1]) == 'v' && my_tolower(ci, name[1]) == 'v' &&
my_tolower(ci, name[2]) == 'e' && my_tolower(ci, name[2]) == 'e' &&
my_tolower(ci, name[3]) == 'n' && my_tolower(ci, name[3]) == 'n' &&
my_tolower(ci, name[4]) == 't' 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; const char *save_where= thd->where;
thd->where= "check option"; thd->where= "check option";
if (!check_option->fixed && if ((!check_option->fixed &&
check_option->fix_fields(thd, &check_option) || check_option->fix_fields(thd, &check_option)) ||
check_option->check_cols(1)) check_option->check_cols(1))
{ {
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
@ -4031,7 +4032,7 @@ void Field_iterator_table_ref::set_field_iterator()
/* Necesary, but insufficient conditions. */ /* Necesary, but insufficient conditions. */
DBUG_ASSERT(table_ref->is_natural_join || DBUG_ASSERT(table_ref->is_natural_join ||
table_ref->nested_join || table_ref->nested_join ||
table_ref->join_columns && (table_ref->join_columns &&
/* This is a merge view. */ /* This is a merge view. */
((table_ref->field_translation && ((table_ref->field_translation &&
table_ref->join_columns->elements == 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. */ /* This is stored table or a tmptable view. */
(!table_ref->field_translation && (!table_ref->field_translation &&
table_ref->join_columns->elements == table_ref->join_columns->elements ==
table_ref->table->s->fields))); table_ref->table->s->fields))));
field_it= &natural_join_it; field_it= &natural_join_it;
DBUG_PRINT("info",("field_it for '%s' is Field_iterator_natural_join", DBUG_PRINT("info",("field_it for '%s' is Field_iterator_natural_join",
table_ref->alias)); table_ref->alias));

View File

@ -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 (l_time->month == 1 && l_time->day <= 7-weekday)
{ {
if (!week_year && if (!week_year &&
(first_weekday && weekday != 0 || ((first_weekday && weekday != 0) ||
!first_weekday && weekday >= 4)) (!first_weekday && weekday >= 4)))
return 0; return 0;
week_year= 1; week_year= 1;
(*year)--; (*year)--;
@ -129,8 +129,8 @@ uint calc_week(MYSQL_TIME *l_time, uint week_behaviour, uint *year)
if (week_year && days >= 52*7) if (week_year && days >= 52*7)
{ {
weekday= (weekday + calc_days_in_year(*year)) % 7; weekday= (weekday + calc_days_in_year(*year)) % 7;
if (!first_weekday && weekday < 4 || if ((!first_weekday && weekday < 4) ||
first_weekday && weekday == 0) (first_weekday && weekday == 0))
{ {
(*year)++; (*year)++;
return 1; return 1;

View File

@ -447,8 +447,8 @@ prepare_tz_info(TIME_ZONE_INFO *sp, MEM_ROOT *storage)
} }
if (end_t == MY_TIME_T_MAX || if (end_t == MY_TIME_T_MAX ||
(cur_off_and_corr > 0) && ((cur_off_and_corr > 0) &&
(end_t >= MY_TIME_T_MAX - cur_off_and_corr)) (end_t >= MY_TIME_T_MAX - cur_off_and_corr)))
/* end of t space */ /* end of t space */
break; break;

View File

@ -603,9 +603,9 @@ bool Unique::get(TABLE *table)
outfile=table->sort.io_cache=(IO_CACHE*) my_malloc(sizeof(IO_CACHE), outfile=table->sort.io_cache=(IO_CACHE*) my_malloc(sizeof(IO_CACHE),
MYF(MY_ZEROFILL)); 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, open_cached_file(outfile,mysql_tmpdir,TEMP_PREFIX,READ_RECORD_BUFFER,
MYF(MY_WME))) MYF(MY_WME))))
return 1; return 1;
reinit_io_cache(outfile,WRITE_CACHE,0L,0,0); reinit_io_cache(outfile,WRITE_CACHE,0L,0,0);

View File

@ -2828,8 +2828,6 @@ int ha_federated::info(uint flag)
if (!(row= mysql_fetch_row(result))) if (!(row= mysql_fetch_row(result)))
goto error; goto error;
if (flag & (HA_STATUS_VARIABLE | HA_STATUS_CONST))
{
/* /*
deleted is set in ha_federated::info deleted is set in ha_federated::info
*/ */
@ -2855,7 +2853,7 @@ int ha_federated::info(uint flag)
if (row[13] != NULL) if (row[13] != NULL)
stats.check_time= (ulong) my_strtoll10(row[13], (char**) 0, stats.check_time= (ulong) my_strtoll10(row[13], (char**) 0,
&error); &error);
}
/* /*
size of IO operations (This is based on a good guess, no high science size of IO operations (This is based on a good guess, no high science
involved) involved)