mirror of
https://github.com/MariaDB/server.git
synced 2025-08-07 00:04:31 +03:00
MDEV-3812
This patch undoes the removal of enum store_key_result by the previous patch for mdev-3812.
This commit is contained in:
@@ -3321,13 +3321,13 @@ bool subselect_uniquesubquery_engine::copy_ref_key(bool skip_constants)
|
|||||||
|
|
||||||
for (store_key **copy= tab->ref.key_copy ; *copy ; copy++)
|
for (store_key **copy= tab->ref.key_copy ; *copy ; copy++)
|
||||||
{
|
{
|
||||||
bool store_res;
|
enum store_key::store_key_result store_res;
|
||||||
if (skip_constants && (*copy)->store_key_is_const())
|
if (skip_constants && (*copy)->store_key_is_const())
|
||||||
continue;
|
continue;
|
||||||
store_res= (*copy)->copy();
|
store_res= (*copy)->copy();
|
||||||
tab->ref.key_err= store_res;
|
tab->ref.key_err= store_res;
|
||||||
|
|
||||||
if (store_res)
|
if (store_res == store_key::STORE_KEY_FATAL)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
Error converting the left IN operand to the column type of the right
|
Error converting the left IN operand to the column type of the right
|
||||||
|
@@ -1459,6 +1459,7 @@ class store_key :public Sql_alloc
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
bool null_key; /* TRUE <=> the value of the key has a null part */
|
bool null_key; /* TRUE <=> the value of the key has a null part */
|
||||||
|
enum store_key_result { STORE_KEY_OK, STORE_KEY_FATAL, STORE_KEY_CONV };
|
||||||
enum Type { FIELD_STORE_KEY, ITEM_STORE_KEY, CONST_ITEM_STORE_KEY };
|
enum Type { FIELD_STORE_KEY, ITEM_STORE_KEY, CONST_ITEM_STORE_KEY };
|
||||||
store_key(THD *thd, Field *field_arg, uchar *ptr, uchar *null, uint length)
|
store_key(THD *thd, Field *field_arg, uchar *ptr, uchar *null, uint length)
|
||||||
:null_key(0), null_ptr(null), err(0)
|
:null_key(0), null_ptr(null), err(0)
|
||||||
@@ -1495,9 +1496,9 @@ public:
|
|||||||
@details this function makes sure truncation warnings when preparing the
|
@details this function makes sure truncation warnings when preparing the
|
||||||
key buffers don't end up as errors (because of an enclosing INSERT/UPDATE).
|
key buffers don't end up as errors (because of an enclosing INSERT/UPDATE).
|
||||||
*/
|
*/
|
||||||
bool copy()
|
enum store_key_result copy()
|
||||||
{
|
{
|
||||||
bool result;
|
enum store_key_result result;
|
||||||
THD *thd= to_field->table->in_use;
|
THD *thd= to_field->table->in_use;
|
||||||
enum_check_fields saved_count_cuted_fields= thd->count_cuted_fields;
|
enum_check_fields saved_count_cuted_fields= thd->count_cuted_fields;
|
||||||
ulonglong sql_mode= thd->variables.sql_mode;
|
ulonglong sql_mode= thd->variables.sql_mode;
|
||||||
@@ -1519,7 +1520,7 @@ public:
|
|||||||
uchar *null_ptr;
|
uchar *null_ptr;
|
||||||
uchar err;
|
uchar err;
|
||||||
|
|
||||||
virtual bool copy_inner()=0;
|
virtual enum store_key_result copy_inner()=0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -1551,7 +1552,7 @@ class store_key_field: public store_key
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool copy_inner()
|
enum store_key_result copy_inner()
|
||||||
{
|
{
|
||||||
TABLE *table= copy_field.to_field->table;
|
TABLE *table= copy_field.to_field->table;
|
||||||
my_bitmap_map *old_map= dbug_tmp_use_all_columns(table,
|
my_bitmap_map *old_map= dbug_tmp_use_all_columns(table,
|
||||||
@@ -1568,7 +1569,7 @@ class store_key_field: public store_key
|
|||||||
copy_field.do_copy(©_field);
|
copy_field.do_copy(©_field);
|
||||||
dbug_tmp_restore_column_map(table->write_set, old_map);
|
dbug_tmp_restore_column_map(table->write_set, old_map);
|
||||||
null_key= to_field->is_null();
|
null_key= to_field->is_null();
|
||||||
return test(err);
|
return err != 0 ? STORE_KEY_FATAL : STORE_KEY_OK;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1598,12 +1599,12 @@ public:
|
|||||||
const char *name() const { return "func"; }
|
const char *name() const { return "func"; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool copy_inner()
|
enum store_key_result copy_inner()
|
||||||
{
|
{
|
||||||
TABLE *table= to_field->table;
|
TABLE *table= to_field->table;
|
||||||
my_bitmap_map *old_map= dbug_tmp_use_all_columns(table,
|
my_bitmap_map *old_map= dbug_tmp_use_all_columns(table,
|
||||||
table->write_set);
|
table->write_set);
|
||||||
int res= 0;
|
int res= FALSE;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
It looks like the next statement is needed only for a simplified
|
It looks like the next statement is needed only for a simplified
|
||||||
@@ -1622,10 +1623,11 @@ public:
|
|||||||
we need to check for errors executing it and react accordingly
|
we need to check for errors executing it and react accordingly
|
||||||
*/
|
*/
|
||||||
if (!res && table->in_use->is_error())
|
if (!res && table->in_use->is_error())
|
||||||
res= 1;
|
res= 1; /* STORE_KEY_FATAL */
|
||||||
dbug_tmp_restore_column_map(table->write_set, old_map);
|
dbug_tmp_restore_column_map(table->write_set, old_map);
|
||||||
null_key= to_field->is_null() || item->null_value;
|
null_key= to_field->is_null() || item->null_value;
|
||||||
return ((err != 0 || res < 0 || res > 2) ? true : test(res));
|
return ((err != 0 || res < 0 || res > 2) ? STORE_KEY_FATAL :
|
||||||
|
(store_key_result) res);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1651,7 +1653,7 @@ public:
|
|||||||
bool store_key_is_const() { return true; }
|
bool store_key_is_const() { return true; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool copy_inner()
|
enum store_key_result copy_inner()
|
||||||
{
|
{
|
||||||
int res;
|
int res;
|
||||||
if (!inited)
|
if (!inited)
|
||||||
@@ -1663,18 +1665,18 @@ protected:
|
|||||||
if ((res= item->save_in_field(to_field, 1)))
|
if ((res= item->save_in_field(to_field, 1)))
|
||||||
{
|
{
|
||||||
if (!err)
|
if (!err)
|
||||||
err= res < 0 ? 1 : res;
|
err= res < 0 ? 1 : res; /* 1=STORE_KEY_FATAL */
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
Item::save_in_field() may call Item::val_xxx(). And if this is a subquery
|
Item::save_in_field() may call Item::val_xxx(). And if this is a subquery
|
||||||
we need to check for errors executing it and react accordingly
|
we need to check for errors executing it and react accordingly
|
||||||
*/
|
*/
|
||||||
if (!err && to_field->table->in_use->is_error())
|
if (!err && to_field->table->in_use->is_error())
|
||||||
err= 1;
|
err= 1; /* STORE_KEY_FATAL */
|
||||||
dbug_tmp_restore_column_map(table->write_set, old_map);
|
dbug_tmp_restore_column_map(table->write_set, old_map);
|
||||||
}
|
}
|
||||||
null_key= to_field->is_null() || item->null_value;
|
null_key= to_field->is_null() || item->null_value;
|
||||||
return (err > 2 ? true : test(err));
|
return (err > 2 ? STORE_KEY_FATAL : (store_key_result) err);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user