summaryrefslogtreecommitdiff
path: root/sql/item.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/item.cc')
-rw-r--r--sql/item.cc19
1 files changed, 16 insertions, 3 deletions
diff --git a/sql/item.cc b/sql/item.cc
index 7d4eca07232..e38142fdb0d 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -587,6 +587,7 @@ void Item::set_name(const char *str, uint length, CHARSET_INFO *cs)
}
if (cs->ctype)
{
+ uint orig_len= length;
/*
This will probably need a better implementation in the future:
a function in CHARSET_INFO structure.
@@ -596,6 +597,11 @@ void Item::set_name(const char *str, uint length, CHARSET_INFO *cs)
length--;
str++;
}
+ if (orig_len != length && !is_autogenerated_name)
+ push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
+ ER_REMOVED_SPACES, ER(ER_REMOVED_SPACES),
+ str + length - orig_len);
+
}
if (!my_charset_same(cs, system_charset_info))
{
@@ -3949,7 +3955,9 @@ Field *Item::make_string_field(TABLE *table)
if (max_length/collation.collation->mbmaxlen > CONVERT_IF_BIGGER_TO_BLOB)
field= new Field_blob(max_length, maybe_null, name,
collation.collation);
- else if (max_length > 0)
+ /* Item_type_holder holds the exact type, do not change it */
+ else if (max_length > 0 &&
+ (type() != Item::TYPE_HOLDER || field_type() != MYSQL_TYPE_STRING))
field= new Field_varstring(max_length, maybe_null, name, table->s,
collation.collation);
else
@@ -4029,6 +4037,7 @@ Field *Item::tmp_table_field_from_field_type(TABLE *table, bool fixed_length)
field= new Field_time(maybe_null, name, &my_charset_bin);
break;
case MYSQL_TYPE_TIMESTAMP:
+ return new Field_timestamp(maybe_null, name, table, &my_charset_bin);
case MYSQL_TYPE_DATETIME:
field= new Field_datetime(maybe_null, name, &my_charset_bin);
break;
@@ -4062,7 +4071,11 @@ Field *Item::tmp_table_field_from_field_type(TABLE *table, bool fixed_length)
case MYSQL_TYPE_LONG_BLOB:
case MYSQL_TYPE_BLOB:
case MYSQL_TYPE_GEOMETRY:
- field= new Field_blob(max_length, maybe_null, name, collation.collation);
+ if (this->type() == Item::TYPE_HOLDER)
+ field= new Field_blob(max_length, maybe_null, name, table,
+ collation.collation, 1);
+ else
+ field= new Field_blob(max_length, maybe_null, name, table, collation.collation);
break; // Blob handled outside of case
}
if (field)
@@ -6232,7 +6245,7 @@ uint32 Item_type_holder::display_length(Item *item)
case MYSQL_TYPE_DOUBLE:
return 53;
case MYSQL_TYPE_NULL:
- return 4;
+ return 0;
case MYSQL_TYPE_LONGLONG:
return 20;
case MYSQL_TYPE_INT24: