Automerge.

This commit is contained in:
Alexey Kopytov 2009-06-17 21:00:39 +04:00
commit 7433b19aa5
27 changed files with 154 additions and 156 deletions

View File

@ -29,7 +29,7 @@ typedef struct st_tina_share {
THR_LOCK lock; THR_LOCK lock;
} TINA_SHARE; } TINA_SHARE;
typedef struct tina_set { struct tina_set {
off_t begin; off_t begin;
off_t end; off_t end;
}; };

View File

@ -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->s->db_low_byte_first == from->table->s->db_low_byte_first &&
(!(to->table->in_use->variables.sql_mode & (!(to->table->in_use->variables.sql_mode &
(MODE_NO_ZERO_IN_DATE | MODE_NO_ZERO_DATE | MODE_INVALID_DATES)) || (MODE_NO_ZERO_IN_DATE | MODE_NO_ZERO_DATE | MODE_INVALID_DATES)) ||
to->type() != FIELD_TYPE_DATE && (to->type() != FIELD_TYPE_DATE &&
to->type() != FIELD_TYPE_DATETIME) && to->type() != FIELD_TYPE_DATETIME)) &&
(from->real_type() != MYSQL_TYPE_VARCHAR || (from->real_type() != MYSQL_TYPE_VARCHAR ||
((Field_varstring*)from)->length_bytes == ((Field_varstring*)from)->length_bytes ==
((Field_varstring*)to)->length_bytes)) ((Field_varstring*)to)->length_bytes))

View File

@ -2596,8 +2596,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
*/ */
@ -2619,7 +2617,6 @@ int ha_federated::info(uint flag)
update_time= (time_t) my_strtoll10(row[12], (char**) 0, &error); update_time= (time_t) my_strtoll10(row[12], (char**) 0, &error);
if (row[13] != NULL) if (row[13] != NULL)
check_time= (time_t) my_strtoll10(row[13], (char**) 0, &error); 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 size of IO operations (This is based on a good guess, no high science

View File

@ -1477,8 +1477,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

@ -1046,12 +1046,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)
@ -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++) 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;
@ -1345,8 +1345,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,(byte*) host,(uint) strlen(host)) || if ((host && hash_search(&acl_check_hosts,(byte*) host,(uint) strlen(host))) ||
ip && hash_search(&acl_check_hosts,(byte*) ip,(uint) strlen(ip))) (ip && hash_search(&acl_check_hosts,(byte*) ip,(uint) strlen(ip))))
{ {
VOID(pthread_mutex_unlock(&acl_cache->lock)); VOID(pthread_mutex_unlock(&acl_cache->lock));
return 0; // Found host return 0; // Found host
@ -1564,8 +1564,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 ?

View File

@ -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. it can not be cloned. Emit an error for an unsupported behaviour.
*/ */
if (table->query_id == thd->query_id || 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); my_error(ER_CANT_REOPEN_TABLE, MYF(0), table->alias);
DBUG_RETURN(0); 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 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;
@ -2298,8 +2298,8 @@ bool table_is_used(TABLE *table, bool wait_for_name_lock)
search= (TABLE*) hash_next(&open_cache, (byte*) key, search= (TABLE*) hash_next(&open_cache, (byte*) key,
key_length, &state)) key_length, &state))
{ {
if (search->locked_by_name && wait_for_name_lock || if ((search->locked_by_name && wait_for_name_lock) ||
search->is_name_opened() && search->needs_reopen_or_name_lock()) (search->is_name_opened() && search->needs_reopen_or_name_lock()))
return 1; // Table is used return 1; // Table is used
} }
} while ((table=table->next)); } 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; 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;
@ -5476,15 +5476,15 @@ 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;
#ifndef NO_EMBEDDED_ACCESS_CHECKS #ifndef NO_EMBEDDED_ACCESS_CHECKS
/* Ensure that we have access rights to all fields to be inserted. */ /* Ensure that we have access rights to all fields to be inserted. */
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);
@ -5539,7 +5539,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;
@ -5684,7 +5684,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;
} }
@ -5704,8 +5704,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++;
@ -5860,8 +5860,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)));
} }
@ -5955,8 +5955,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

@ -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 */ /* 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

@ -413,7 +413,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;
@ -887,7 +887,8 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list,
if (changed) if (changed)
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)
|| thd->transaction.stmt.modified_non_trans_table
|| was_insert_delayed) || was_insert_delayed)
{ {
if (mysql_bin_log.is_open()) 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 We must invalidate the table in the query cache before binlog writing
and ha_autocommit_or_rollback and ha_autocommit_or_rollback
*/ */
changed= (info.copied || info.deleted || info.updated);
if (changed= (info.copied || info.deleted || info.updated)) if (changed)
{ {
query_cache_invalidate3(thd, table, 1); query_cache_invalidate3(thd, table, 1);
if (thd->transaction.stmt.modified_non_trans_table) if (thd->transaction.stmt.modified_non_trans_table)

View File

@ -1670,7 +1670,7 @@ void st_select_lex::print_limit(THD *thd, String *str)
item->substype() == Item_subselect::ALL_SUBS)) item->substype() == Item_subselect::ALL_SUBS))
{ {
DBUG_ASSERT(!item->fixed || DBUG_ASSERT(!item->fixed ||
select_limit->val_int() == LL(1) && offset_limit == 0); (select_limit->val_int() == LL(1) && offset_limit == 0));
return; return;
} }

View File

@ -723,9 +723,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))
{ {
@ -1132,8 +1132,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

@ -1238,7 +1238,7 @@ pthread_handler_t handle_one_connection(void *arg)
decrease_user_connections(thd->user_connect); decrease_user_connections(thd->user_connect);
if (thd->killed || if (thd->killed ||
net->vio && net->error && net->report_error) (net->vio && net->error && net->report_error))
{ {
statistic_increment(aborted_threads, &LOCK_status); statistic_increment(aborted_threads, &LOCK_status);
} }
@ -2366,11 +2366,11 @@ void log_slow_statement(THD *thd)
if ((thd->start_time > thd->time_after_lock && if ((thd->start_time > thd->time_after_lock &&
(ulong) (thd->start_time - thd->time_after_lock) > (ulong) (thd->start_time - thd->time_after_lock) >
thd->variables.long_query_time) || thd->variables.long_query_time) ||
(thd->server_status & ((thd->server_status &
(SERVER_QUERY_NO_INDEX_USED | SERVER_QUERY_NO_GOOD_INDEX_USED)) && (SERVER_QUERY_NO_INDEX_USED | SERVER_QUERY_NO_GOOD_INDEX_USED)) &&
opt_log_queries_not_using_indexes && opt_log_queries_not_using_indexes &&
/* == SQLCOM_END unless this is a SHOW command */ /* == 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_proc_info(thd, "logging slow query");
thd->status_var.long_query_count++; thd->status_var.long_query_count++;
@ -2676,8 +2676,8 @@ mysql_execute_command(THD *thd)
variables, but for now this is probably good enough. variables, but for now this is probably good enough.
Don't reset warnings when executing a stored routine. Don't reset warnings when executing a stored routine.
*/ */
if ((all_tables || &lex->select_lex != lex->all_selects_list || if (((all_tables || &lex->select_lex != lex->all_selects_list ||
lex->sroutines.records) && !thd->spcont || lex->sroutines.records) && !thd->spcont) ||
lex->time_zone_tables_used) lex->time_zone_tables_used)
mysql_reset_errors(thd, 0); 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 (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)
@ -5678,7 +5678,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)
@ -6029,10 +6029,10 @@ bool check_some_access(THD *thd, ulong want_access, TABLE_LIST *table)
{ {
if (access & want_access) if (access & want_access)
{ {
if (!check_access(thd, access, table->db, if ((!check_access(thd, access, table->db,
&table->grant.privilege, 0, 1, &table->grant.privilege, 0, 1,
test(table->schema_table)) && 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); 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, else if ((check_access(thd, UPDATE_ACL, table->db,
&table->grant.privilege, 0, 1, &table->grant.privilege, 0, 1,
test(table->schema_table)) || test(table->schema_table)) ||
grant_option && (grant_option &&
check_grant(thd, UPDATE_ACL, table, 0, 1, 1)) && check_grant(thd, UPDATE_ACL, table, 0, 1, 1))) &&
(check_access(thd, SELECT_ACL, table->db, (check_access(thd, SELECT_ACL, table->db,
&table->grant.privilege, 0, 0, &table->grant.privilege, 0, 0,
test(table->schema_table)) || 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); DBUG_RETURN(TRUE);
table->table_in_first_from_clause= 1; 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, if (check_access(thd, SELECT_ACL, table->db,
&table->grant.privilege, 0, 0, &table->grant.privilege, 0, 0,
test(table->schema_table)) || 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); 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, return check_access(thd, SELECT_ACL | EXTRA_ACL, table->db,
&table->grant.privilege, 0, 0, &table->grant.privilege, 0, 0,
test(table->schema_table)) || 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));
} }

View File

@ -1367,7 +1367,7 @@ 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, 0) || if ((tables && check_table_access(thd, SELECT_ACL, tables, 0)) ||
open_and_lock_tables(thd, tables)) open_and_lock_tables(thd, tables))
goto error; goto error;
@ -2714,7 +2714,7 @@ Prepared_statement::Prepared_statement(THD *thd_arg, Protocol *protocol_arg)
void Prepared_statement::setup_set_params() void Prepared_statement::setup_set_params()
{ {
/* Setup binary logging */ /* 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()) mysql_log.is_open() || mysql_slow_log.is_open())
{ {
set_params_from_vars= insert_params_from_vars_with_log; set_params_from_vars= insert_params_from_vars_with_log;

View File

@ -1305,7 +1305,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);
@ -1809,9 +1809,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 */
@ -2269,9 +2269,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;
} }
@ -2286,9 +2287,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;
} }
@ -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 (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
@ -4984,8 +4986,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 &&
@ -5110,7 +5112,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 &&
@ -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 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 &&
@ -9663,9 +9665,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;
table->s->fields= field_count; 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 */ /* copy row that filled HEAP table */
if ((write_err=new_table.file->write_row(table->record[0]))) if ((write_err=new_table.file->write_row(table->record[0])))
{ {
if (write_err != HA_ERR_FOUND_DUPP_KEY && if ((write_err != HA_ERR_FOUND_DUPP_KEY &&
write_err != HA_ERR_FOUND_DUPP_UNIQUE || !ignore_last_dupp_key_error) write_err != HA_ERR_FOUND_DUPP_UNIQUE) || !ignore_last_dupp_key_error)
goto err; goto err;
} }
@ -12812,8 +12814,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))
DBUG_RETURN(0); DBUG_RETURN(0);
for (ORDER *ord= join->order; ord; ord= ord->next) 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. */ /* 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

@ -2987,10 +2987,10 @@ bool store_schema_proc(THD *thd, TABLE *table, TABLE *proc_table,
TYPE_ENUM_PROCEDURE)) TYPE_ENUM_PROCEDURE))
return 0; return 0;
if (lex->orig_sql_command == SQLCOM_SHOW_STATUS_PROC && if ((lex->orig_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->orig_sql_command == SQLCOM_SHOW_STATUS_FUNC && (lex->orig_sql_command == SQLCOM_SHOW_STATUS_FUNC &&
proc_table->field[2]->val_int() == TYPE_ENUM_FUNCTION || proc_table->field[2]->val_int() == TYPE_ENUM_FUNCTION) ||
lex->orig_sql_command == SQLCOM_END) lex->orig_sql_command == SQLCOM_END)
{ {
restore_record(table, s->default_values); restore_record(table, s->default_values);

View File

@ -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 */ /* 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();
} }
@ -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->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
@ -3954,9 +3954,9 @@ 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) || 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, 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

@ -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 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

@ -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 */ /* 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

@ -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, if ((check_access(thd, CREATE_VIEW_ACL, view->db, &view->grant.privilege,
0, 0, is_schema_db(view->db)) || 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 && (mode != VIEW_CREATE_NEW &&
(check_access(thd, DROP_ACL, view->db, &view->grant.privilege, (check_access(thd, DROP_ACL, view->db, &view->grant.privilege,
0, 0, is_schema_db(view->db)) || 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; goto err;
for (sl= select_lex; sl; sl= sl->next_select()) 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, if (check_access(thd, SELECT_ACL, tbl->db,
&tbl->grant.privilege, 0, 0, test(tbl->schema_table)) || &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; goto err;
} }
} }

View File

@ -3943,7 +3943,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.str)) ($3->db.str && check_db_name($3->db.str)))
{ {
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;
@ -4094,8 +4094,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

@ -2112,8 +2112,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);
@ -2827,7 +2827,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 ==
@ -2836,7 +2836,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

@ -729,7 +729,7 @@ struct TABLE_LIST
void cleanup_items(); void cleanup_items();
bool placeholder() bool placeholder()
{ {
return derived || view || schema_table || create && !table->db_stat || return derived || view || schema_table || (create && !table->db_stat) ||
!table; !table;
} }
void print(THD *thd, String *str); void print(THD *thd, String *str);

View File

@ -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 (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)--;
@ -94,8 +94,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

@ -604,9 +604,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);