summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <timour@askmonty.org>2012-10-27 00:56:14 +0300
committerunknown <timour@askmonty.org>2012-10-27 00:56:14 +0300
commit974abc7ad832131e59d310730722bb4ecdb460e8 (patch)
tree984cadb2c966b3475831bab87d7f00c4eaad69eb /sql
parent97a1c53c8141d473b87dc8048c19868e8531db9e (diff)
downloadmariadb-git-974abc7ad832131e59d310730722bb4ecdb460e8.tar.gz
MDEV-3812
This patch undoes the removal of enum store_key_result by the previous patch for mdev-3812.
Diffstat (limited to 'sql')
-rw-r--r--sql/item_subselect.cc4
-rw-r--r--sql/sql_select.h28
2 files changed, 17 insertions, 15 deletions
diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc
index 04151ebbdb2..265db0055ad 100644
--- a/sql/item_subselect.cc
+++ b/sql/item_subselect.cc
@@ -3321,13 +3321,13 @@ bool subselect_uniquesubquery_engine::copy_ref_key(bool skip_constants)
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())
continue;
store_res= (*copy)->copy();
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
diff --git a/sql/sql_select.h b/sql/sql_select.h
index f465b08e910..118a684ab62 100644
--- a/sql/sql_select.h
+++ b/sql/sql_select.h
@@ -1459,6 +1459,7 @@ class store_key :public Sql_alloc
{
public:
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 };
store_key(THD *thd, Field *field_arg, uchar *ptr, uchar *null, uint length)
:null_key(0), null_ptr(null), err(0)
@@ -1495,9 +1496,9 @@ public:
@details this function makes sure truncation warnings when preparing the
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;
enum_check_fields saved_count_cuted_fields= thd->count_cuted_fields;
ulonglong sql_mode= thd->variables.sql_mode;
@@ -1519,7 +1520,7 @@ public:
uchar *null_ptr;
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:
- bool copy_inner()
+ enum store_key_result copy_inner()
{
TABLE *table= copy_field.to_field->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(&copy_field);
dbug_tmp_restore_column_map(table->write_set, old_map);
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"; }
protected:
- bool copy_inner()
+ enum store_key_result copy_inner()
{
TABLE *table= to_field->table;
my_bitmap_map *old_map= dbug_tmp_use_all_columns(table,
table->write_set);
- int res= 0;
+ int res= FALSE;
/*
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
*/
if (!res && table->in_use->is_error())
- res= 1;
+ res= 1; /* STORE_KEY_FATAL */
dbug_tmp_restore_column_map(table->write_set, old_map);
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; }
protected:
- bool copy_inner()
+ enum store_key_result copy_inner()
{
int res;
if (!inited)
@@ -1663,18 +1665,18 @@ protected:
if ((res= item->save_in_field(to_field, 1)))
{
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
we need to check for errors executing it and react accordingly
*/
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);
}
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);
}
};