MCPcopy Create free account
hub / github.com/Meituan-Dianping/SQLAdvisor / Item_string

Method Item_string

sql/item.h:2089–2108  ·  view source on GitHub ↗

Create from a string, set name from the string itself. */

Source from the content-addressed store, hash-verified

2087public:
2088 /* Create from a string, set name from the string itself. */
2089 Item_string(const char *str,uint length,
2090 const CHARSET_INFO *cs, Derivation dv= DERIVATION_COERCIBLE,
2091 uint repertoire= MY_REPERTOIRE_UNICODE30)
2092 : m_cs_specified(FALSE)
2093 {
2094 str_value.set_or_copy_aligned(str, length, cs);
2095 collation.set(cs, dv, repertoire);
2096 /*
2097 We have to have a different max_length than 'length' here to
2098 ensure that we get the right length if we do use the item
2099 to create a new table. In this case max_length must be the maximum
2100 number of chars for a string of this type because we in Create_field::
2101 divide the max_length with mbmaxlen).
2102 */
2103 max_length= str_value.numchars()*cs->mbmaxlen;
2104 item_name.copy(str, length, cs);
2105 decimals=NOT_FIXED_DEC;
2106 // it is constant => can be used without fix_fields (and frequently used)
2107 fixed= 1;
2108 }
2109 /* Just create an item and do not fill string representation */
2110 Item_string(const CHARSET_INFO *cs, Derivation dv= DERIVATION_COERCIBLE)
2111 : m_cs_specified(FALSE)

Callers

nothing calls this directly

Calls 4

set_or_copy_alignedMethod · 0.80
numcharsMethod · 0.80
setMethod · 0.45
copyMethod · 0.45

Tested by

no test coverage detected