diff options
author | unknown <holyfoot/hf@hfmain.(none)> | 2007-03-22 23:59:20 +0400 |
---|---|---|
committer | unknown <holyfoot/hf@hfmain.(none)> | 2007-03-22 23:59:20 +0400 |
commit | 2c5395eedb85105f8ad7d58c0ce1902807dc0948 (patch) | |
tree | b10a0e80530fde746ab966228b412ab454f075eb /sql/sql_select.h | |
parent | 3a222d57ad93f76a1a75ab459d0fe2a12be98d6c (diff) | |
parent | b8c101df1a6d1c4f9f5a2ed1cbcf996610782844 (diff) | |
download | mariadb-git-2c5395eedb85105f8ad7d58c0ce1902807dc0948.tar.gz |
Merge mysql.com:/home/hf/work/mrg/mysql-5.0-opt
into mysql.com:/home/hf/work/mrg/mysql-5.1-opt
mysql-test/r/insert_select.result:
Auto merged
mysql-test/t/insert_select.test:
Auto merged
sql/field.h:
Auto merged
sql/item.cc:
Auto merged
sql/item_sum.cc:
Auto merged
sql/sql_select.h:
Auto merged
mysql-test/r/create.result:
merging
mysql-test/r/temp_table.result:
SCCS merged
mysql-test/r/type_float.result:
merging
mysql-test/r/union.result:
merging
mysql-test/t/temp_table.test:
merging
Diffstat (limited to 'sql/sql_select.h')
-rw-r--r-- | sql/sql_select.h | 53 |
1 files changed, 41 insertions, 12 deletions
diff --git a/sql/sql_select.h b/sql/sql_select.h index ca93179f9d9..ca37c7bd274 100644 --- a/sql/sql_select.h +++ b/sql/sql_select.h @@ -527,15 +527,11 @@ extern "C" int refpos_order_cmp(void* arg, const void *a,const void *b); class store_key :public Sql_alloc { - protected: - Field *to_field; // Store data here - char *null_ptr; - char err; 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 }; store_key(THD *thd, Field *field_arg, char *ptr, char *null, uint length) - :null_ptr(null), err(0), null_key(0) + :null_key(0), null_ptr(null), err(0) { if (field_arg->type() == MYSQL_TYPE_BLOB) { @@ -550,8 +546,35 @@ public: ptr, (uchar*) null, 1); } virtual ~store_key() {} /* Not actually needed */ - virtual enum store_key_result copy()=0; virtual const char *name() const=0; + + /** + @brief sets ignore truncation warnings mode and calls the real copy method + + @details this function makes sure truncation warnings when preparing the + key buffers don't end up as errors (because of an enclosing INSERT/UPDATE). + */ + enum store_key_result copy() + { + enum store_key_result result; + enum_check_fields saved_count_cuted_fields= + to_field->table->in_use->count_cuted_fields; + + to_field->table->in_use->count_cuted_fields= CHECK_FIELD_IGNORE; + + result= copy_inner(); + + to_field->table->in_use->count_cuted_fields= saved_count_cuted_fields; + + return result; + } + + protected: + Field *to_field; // Store data here + char *null_ptr; + char err; + + virtual enum store_key_result copy_inner()=0; }; @@ -571,7 +594,10 @@ class store_key_field: public store_key copy_field.set(to_field,from_field,0); } } - enum store_key_result copy() + const char *name() const { return field_name; } + + protected: + enum store_key_result copy_inner() { TABLE *table= copy_field.to_field->table; my_bitmap_map *old_map= dbug_tmp_use_all_columns(table, @@ -581,7 +607,6 @@ class store_key_field: public store_key null_key= to_field->is_null(); return err != 0 ? STORE_KEY_FATAL : STORE_KEY_OK; } - const char *name() const { return field_name; } }; @@ -596,7 +621,10 @@ public: null_ptr_arg ? null_ptr_arg : item_arg->maybe_null ? &err : NullS, length), item(item_arg) {} - enum store_key_result copy() + const char *name() const { return "func"; } + + protected: + enum store_key_result copy_inner() { TABLE *table= to_field->table; my_bitmap_map *old_map= dbug_tmp_use_all_columns(table, @@ -606,7 +634,6 @@ public: null_key= to_field->is_null() || item->null_value; return (err != 0 || res > 2 ? STORE_KEY_FATAL : (store_key_result) res); } - const char *name() const { return "func"; } }; @@ -622,7 +649,10 @@ public: &err : NullS, length, item_arg), inited(0) { } - enum store_key_result copy() + const char *name() const { return "const"; } + +protected: + enum store_key_result copy_inner() { int res; if (!inited) @@ -637,7 +667,6 @@ public: null_key= to_field->is_null() || item->null_value; return (err > 2 ? STORE_KEY_FATAL : (store_key_result) err); } - const char *name() const { return "const"; } }; bool cp_buffer_from_ref(THD *thd, TABLE *table, TABLE_REF *ref); |