summaryrefslogtreecommitdiff
path: root/sql/sql_base.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/sql_base.cc')
-rw-r--r--sql/sql_base.cc27
1 files changed, 14 insertions, 13 deletions
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index fc95f5deb40..eeaf560693e 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -423,8 +423,9 @@ bool close_thread_table(THD *thd, TABLE **table_ptr)
{
DBUG_ENTER("close_thread_table");
- bool found_old_table=0;
- TABLE *table=*table_ptr;
+ bool found_old_table= 0;
+ TABLE *table= *table_ptr;
+ DBUG_ASSERT(table->key_read == 0);
*table_ptr=table->next;
if (table->version != refresh_version ||
@@ -1693,7 +1694,7 @@ Field *find_field_in_table(THD *thd,TABLE *table,const char *name,uint length,
else
thd->dupp_field=field;
}
- if (check_grants && check_grant_column(thd,table,name,length))
+ if (check_grants && check_grant_column(thd,table,name,length))
return WRONG_GRANT;
return field;
}
@@ -1743,8 +1744,8 @@ find_field_in_tables(THD *thd, Item_ident *item, TABLE_LIST *tables,
{
found_table=1;
Field *find=find_field_in_table(thd,tables->table,name,length,
- grant_option &&
- tables->table->grant.want_privilege,
+ test(tables->table->grant.
+ want_privilege),
1);
if (find)
{
@@ -1801,8 +1802,7 @@ find_field_in_tables(THD *thd, Item_ident *item, TABLE_LIST *tables,
}
Field *field=find_field_in_table(thd,tables->table,name,length,
- grant_option &&
- tables->table->grant.want_privilege,
+ test(tables->table->grant.want_privilege),
allow_rowid);
if (field)
{
@@ -2098,9 +2098,10 @@ insert_fields(THD *thd,TABLE_LIST *tables, const char *db_name,
(!db_name || !strcmp(tables->db,db_name))))
{
/* Ensure that we have access right to all columns */
- if (grant_option && !thd->master_access &&
- check_grant_all_columns(thd,SELECT_ACL,table) )
+ if (!(table->grant.privilege & SELECT_ACL) &&
+ check_grant_all_columns(thd,SELECT_ACL,table))
DBUG_RETURN(-1);
+
Field **ptr=table->field,*field;
thd->used_tables|=table->map;
while ((field = *ptr++))
@@ -2227,7 +2228,7 @@ int setup_conds(THD *thd,TABLE_LIST *tables,COND **conds)
******************************************************************************/
int
-fill_record(List<Item> &fields,List<Item> &values)
+fill_record(List<Item> &fields,List<Item> &values, bool ignore_errors)
{
List_iterator_fast<Item> f(fields),v(values);
Item *value;
@@ -2237,7 +2238,7 @@ fill_record(List<Item> &fields,List<Item> &values)
while ((field=(Item_field*) f++))
{
value=v++;
- if (value->save_in_field(field->field, 0) > 0)
+ if (value->save_in_field(field->field, 0) > 0 && !ignore_errors)
DBUG_RETURN(1);
}
DBUG_RETURN(0);
@@ -2245,7 +2246,7 @@ fill_record(List<Item> &fields,List<Item> &values)
int
-fill_record(Field **ptr,List<Item> &values)
+fill_record(Field **ptr,List<Item> &values, bool ignore_errors)
{
List_iterator_fast<Item> v(values);
Item *value;
@@ -2255,7 +2256,7 @@ fill_record(Field **ptr,List<Item> &values)
while ((field = *ptr++))
{
value=v++;
- if (value->save_in_field(field, 0) == 1)
+ if (value->save_in_field(field, 0) == 1 && !ignore_errors)
DBUG_RETURN(1);
}
DBUG_RETURN(0);