diff options
author | Sergey Vojtovich <svoj@mariadb.org> | 2015-08-11 11:18:38 +0400 |
---|---|---|
committer | Sergey Vojtovich <svoj@mariadb.org> | 2015-08-21 10:40:39 +0400 |
commit | 31e365efae28ba3208e80511c4d18fe11a79541a (patch) | |
tree | f249682cc42490fc86382f5244a051001dc13c9e /sql/field.cc | |
parent | 4374da63f03abc472f68f42e4e93261a18bfe417 (diff) | |
download | mariadb-git-31e365efae28ba3208e80511c4d18fe11a79541a.tar.gz |
MDEV-8010 - Avoid sql_alloc() in Items (Patch #1)
Added mandatory thd parameter to Item (and all derivative classes) constructor.
Added thd parameter to all routines that may create items.
Also removed "current_thd" from Item::Item. This reduced number of
pthread_getspecific() calls from 290 to 177 per OLTP RO transaction.
Diffstat (limited to 'sql/field.cc')
-rw-r--r-- | sql/field.cc | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/sql/field.cc b/sql/field.cc index 5d45a8d39d1..a65f09acafa 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -9987,7 +9987,7 @@ Field *make_field(TABLE_SHARE *share, uchar *ptr, uint32 field_length, /** Create a field suitable for create of table. */ -Create_field::Create_field(Field *old_field,Field *orig_field) +Create_field::Create_field(THD *thd, Field *old_field, Field *orig_field) { field= old_field; field_name=change=old_field->field_name; @@ -10039,7 +10039,6 @@ Create_field::Create_field(Field *old_field,Field *orig_field) case MYSQL_TYPE_YEAR: if (length != 4) { - THD *thd= current_thd; char buff[sizeof("YEAR()") + MY_INT64_NUM_DECIMAL_DIGITS + 1]; my_snprintf(buff, sizeof(buff), "YEAR(%lu)", length); push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE, @@ -10098,7 +10097,7 @@ Create_field::Create_field(Field *old_field,Field *orig_field) StringBuffer<MAX_FIELD_WIDTH> tmp(charset); String *res= orig_field->val_str(&tmp); char *pos= (char*) sql_strmake(res->ptr(), res->length()); - def= new Item_string(pos, res->length(), charset); + def= new Item_string(thd, pos, res->length(), charset); } orig_field->move_field_offset(-diff); // Back to record[0] } |