mirror of
https://github.com/MariaDB/server.git
synced 2025-07-07 06:01:31 +03:00
Remove String::lex_string() and String::lex_cstring()
- Better to use 'String *' directly. - Added String::get_value(LEX_STRING*) for the few cases where we want to convert a String to LEX_CSTRING. Other things: - Use StringBuffer for some functions to avoid mallocs
This commit is contained in:
@ -1078,17 +1078,16 @@ Field_longstr::make_packed_sort_key_part(uchar *buff,
|
|||||||
*buff++=1;
|
*buff++=1;
|
||||||
}
|
}
|
||||||
uchar *end= pack_sort_string(buff, sort_field);
|
uchar *end= pack_sort_string(buff, sort_field);
|
||||||
return static_cast<int>(end-buff);
|
return (uint) (end-buff);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
uchar*
|
uchar*
|
||||||
Field_longstr::pack_sort_string(uchar *to, const SORT_FIELD_ATTR *sort_field)
|
Field_longstr::pack_sort_string(uchar *to, const SORT_FIELD_ATTR *sort_field)
|
||||||
{
|
{
|
||||||
String buf;
|
StringBuffer<LONGLONG_BUFFER_SIZE> buf;
|
||||||
val_str(&buf, &buf);
|
val_str(&buf, &buf);
|
||||||
return to + sort_field->pack_sort_string(to, buf.lex_cstring(),
|
return to + sort_field->pack_sort_string(to, &buf);
|
||||||
field_charset());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2106,7 +2105,7 @@ void Field::make_send_field(Send_field *field)
|
|||||||
field->org_table_name= field->db_name= empty_clex_str;
|
field->org_table_name= field->db_name= empty_clex_str;
|
||||||
if (orig_table && orig_table->alias.ptr())
|
if (orig_table && orig_table->alias.ptr())
|
||||||
{
|
{
|
||||||
field->table_name= orig_table->alias.lex_cstring();
|
orig_table->alias.get_value(&field->table_name);
|
||||||
field->org_col_name= field_name;
|
field->org_col_name= field_name;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -2546,7 +2546,6 @@ Type_handler_string_result::make_packed_sort_key_part(uchar *to, Item *item,
|
|||||||
const SORT_FIELD_ATTR *sort_field,
|
const SORT_FIELD_ATTR *sort_field,
|
||||||
Sort_param *param) const
|
Sort_param *param) const
|
||||||
{
|
{
|
||||||
CHARSET_INFO *cs= item->collation.collation;
|
|
||||||
bool maybe_null= item->maybe_null;
|
bool maybe_null= item->maybe_null;
|
||||||
|
|
||||||
if (maybe_null)
|
if (maybe_null)
|
||||||
@ -2576,7 +2575,7 @@ Type_handler_string_result::make_packed_sort_key_part(uchar *to, Item *item,
|
|||||||
return sort_field->original_length;
|
return sort_field->original_length;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return sort_field->pack_sort_string(to, res->lex_cstring(), cs);
|
return sort_field->pack_sort_string(to, res);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2932,13 +2931,12 @@ int compare_packed_sort_keys(void *sort_param,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
uint
|
uint
|
||||||
SORT_FIELD_ATTR::pack_sort_string(uchar *to, const LEX_CSTRING &str,
|
SORT_FIELD_ATTR::pack_sort_string(uchar *to, String *str) const
|
||||||
CHARSET_INFO *cs) const
|
|
||||||
{
|
{
|
||||||
uchar *orig_to= to;
|
uchar *orig_to= to;
|
||||||
uint32 length, data_length;
|
uint32 length, data_length;
|
||||||
DBUG_ASSERT(str.length <= UINT32_MAX);
|
DBUG_ASSERT(str->length() <= UINT32_MAX);
|
||||||
length= (uint32)str.length;
|
length= (uint32) str->length();
|
||||||
|
|
||||||
if (length + suffix_length <= original_length)
|
if (length + suffix_length <= original_length)
|
||||||
data_length= length;
|
data_length= length;
|
||||||
@ -2949,13 +2947,13 @@ SORT_FIELD_ATTR::pack_sort_string(uchar *to, const LEX_CSTRING &str,
|
|||||||
store_key_part_length(data_length + suffix_length, to, length_bytes);
|
store_key_part_length(data_length + suffix_length, to, length_bytes);
|
||||||
to+= length_bytes;
|
to+= length_bytes;
|
||||||
// copying data length bytes to the buffer
|
// copying data length bytes to the buffer
|
||||||
memcpy(to, (uchar*)str.str, data_length);
|
memcpy(to, (uchar*)str->ptr(), data_length);
|
||||||
to+= data_length;
|
to+= data_length;
|
||||||
|
|
||||||
if (cs == &my_charset_bin && suffix_length)
|
if (str->charset() == &my_charset_bin && suffix_length)
|
||||||
{
|
{
|
||||||
// suffix length stored in bigendian form
|
// suffix length stored in bigendian form
|
||||||
store_bigendian(str.length, to, suffix_length);
|
store_bigendian(length, to, suffix_length);
|
||||||
to+= suffix_length;
|
to+= suffix_length;
|
||||||
}
|
}
|
||||||
return static_cast<uint>(to - orig_to);
|
return static_cast<uint>(to - orig_to);
|
||||||
|
@ -1394,7 +1394,7 @@ bool Item::get_date_from_real(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate
|
|||||||
|
|
||||||
bool Item::get_date_from_string(THD *thd, MYSQL_TIME *to, date_mode_t mode)
|
bool Item::get_date_from_string(THD *thd, MYSQL_TIME *to, date_mode_t mode)
|
||||||
{
|
{
|
||||||
StringBuffer<40> tmp;
|
StringBuffer<MAX_DATETIME_FULL_WIDTH+1> tmp;
|
||||||
Temporal::Warn_push warn(thd, field_table_or_null(), field_name_or_null(),
|
Temporal::Warn_push warn(thd, field_table_or_null(), field_name_or_null(),
|
||||||
to, mode);
|
to, mode);
|
||||||
Temporal_hybrid *t= new(to) Temporal_hybrid(thd, &warn, val_str(&tmp), mode);
|
Temporal_hybrid *t= new(to) Temporal_hybrid(thd, &warn, val_str(&tmp), mode);
|
||||||
@ -2076,7 +2076,7 @@ Item_name_const::Item_name_const(THD *thd, Item *name_arg, Item *val):
|
|||||||
Item::maybe_null= TRUE;
|
Item::maybe_null= TRUE;
|
||||||
if (name_item->basic_const_item() &&
|
if (name_item->basic_const_item() &&
|
||||||
(name_str= name_item->val_str(&name_buffer))) // Can't have a NULL name
|
(name_str= name_item->val_str(&name_buffer))) // Can't have a NULL name
|
||||||
set_name(thd, name_str->lex_cstring(), name_str->charset());
|
set_name(thd, name_str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -6674,8 +6674,9 @@ int Item_string::save_in_field(Field *field, bool no_conversions)
|
|||||||
|
|
||||||
Item *Item_string::clone_item(THD *thd)
|
Item *Item_string::clone_item(THD *thd)
|
||||||
{
|
{
|
||||||
return new (thd->mem_root)
|
LEX_CSTRING val;
|
||||||
Item_string(thd, name, str_value.lex_cstring(), collation.collation);
|
str_value.get_value(&val);
|
||||||
|
return new (thd->mem_root) Item_string(thd, name, val, collation.collation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -962,6 +962,10 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
} /*lint -e1509 */
|
} /*lint -e1509 */
|
||||||
void set_name(THD *thd, const char *str, size_t length, CHARSET_INFO *cs);
|
void set_name(THD *thd, const char *str, size_t length, CHARSET_INFO *cs);
|
||||||
|
void set_name(THD *thd, String *str)
|
||||||
|
{
|
||||||
|
set_name(thd, str->ptr(), str->length(), str->charset());
|
||||||
|
}
|
||||||
void set_name(THD *thd, const LEX_CSTRING &str,
|
void set_name(THD *thd, const LEX_CSTRING &str,
|
||||||
CHARSET_INFO *cs= system_charset_info)
|
CHARSET_INFO *cs= system_charset_info)
|
||||||
{
|
{
|
||||||
@ -4377,7 +4381,7 @@ protected:
|
|||||||
const Metadata metadata)
|
const Metadata metadata)
|
||||||
{
|
{
|
||||||
fix_from_value(dv, metadata);
|
fix_from_value(dv, metadata);
|
||||||
set_name(thd, str_value.lex_cstring(), str_value.charset());
|
set_name(thd, &str_value);
|
||||||
}
|
}
|
||||||
protected:
|
protected:
|
||||||
/* Just create an item and do not fill string representation */
|
/* Just create an item and do not fill string representation */
|
||||||
|
@ -1391,8 +1391,8 @@ String *Item_func_regexp_replace::val_str(String *str)
|
|||||||
!(replace= re.convert_if_needed(replace, &re.replace_converter)))
|
!(replace= re.convert_if_needed(replace, &re.replace_converter)))
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
src= source->lex_cstring();
|
source->get_value(&src);
|
||||||
rpl= replace->lex_cstring();
|
replace->get_value(&rpl);
|
||||||
|
|
||||||
str->length(0);
|
str->length(0);
|
||||||
str->set_charset(collation.collation);
|
str->set_charset(collation.collation);
|
||||||
|
@ -473,7 +473,7 @@ err:
|
|||||||
Create a formated date/time value in a string.
|
Create a formated date/time value in a string.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static bool make_date_time(const LEX_CSTRING &format, MYSQL_TIME *l_time,
|
static bool make_date_time(String *format, MYSQL_TIME *l_time,
|
||||||
timestamp_type type, const MY_LOCALE *locale,
|
timestamp_type type, const MY_LOCALE *locale,
|
||||||
String *str)
|
String *str)
|
||||||
{
|
{
|
||||||
@ -488,7 +488,7 @@ static bool make_date_time(const LEX_CSTRING &format, MYSQL_TIME *l_time,
|
|||||||
if (l_time->neg)
|
if (l_time->neg)
|
||||||
str->append('-');
|
str->append('-');
|
||||||
|
|
||||||
end= (ptr= format.str) + format.length;
|
end= (ptr= format->ptr()) + format->length();
|
||||||
for (; ptr != end ; ptr++)
|
for (; ptr != end ; ptr++)
|
||||||
{
|
{
|
||||||
if (*ptr != '%' || ptr+1 == end)
|
if (*ptr != '%' || ptr+1 == end)
|
||||||
@ -1877,6 +1877,7 @@ String *Item_func_date_format::val_str(String *str)
|
|||||||
DBUG_ASSERT(fixed == 1);
|
DBUG_ASSERT(fixed == 1);
|
||||||
date_conv_mode_t mode= is_time_format ? TIME_TIME_ONLY : TIME_CONV_NONE;
|
date_conv_mode_t mode= is_time_format ? TIME_TIME_ONLY : TIME_CONV_NONE;
|
||||||
THD *thd= current_thd;
|
THD *thd= current_thd;
|
||||||
|
|
||||||
if ((null_value= args[0]->get_date(thd, &l_time,
|
if ((null_value= args[0]->get_date(thd, &l_time,
|
||||||
Temporal::Options(mode, thd))))
|
Temporal::Options(mode, thd))))
|
||||||
return 0;
|
return 0;
|
||||||
@ -1901,7 +1902,7 @@ String *Item_func_date_format::val_str(String *str)
|
|||||||
|
|
||||||
/* Create the result string */
|
/* Create the result string */
|
||||||
str->set_charset(collation.collation);
|
str->set_charset(collation.collation);
|
||||||
if (!make_date_time(format->lex_cstring(), &l_time,
|
if (!make_date_time(format, &l_time,
|
||||||
is_time_format ? MYSQL_TIMESTAMP_TIME :
|
is_time_format ? MYSQL_TIMESTAMP_TIME :
|
||||||
MYSQL_TIMESTAMP_DATE,
|
MYSQL_TIMESTAMP_DATE,
|
||||||
lc, str))
|
lc, str))
|
||||||
|
@ -864,12 +864,13 @@ bool Protocol_text::store_field_metadata(const THD * thd,
|
|||||||
{
|
{
|
||||||
Send_field_packed_extended_metadata metadata;
|
Send_field_packed_extended_metadata metadata;
|
||||||
metadata.pack(field);
|
metadata.pack(field);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Don't apply character set conversion:
|
Don't apply character set conversion:
|
||||||
extended metadata is a binary encoded data.
|
extended metadata is a binary encoded data.
|
||||||
*/
|
*/
|
||||||
if (store_lex_cstring(metadata.lex_cstring(), cs,
|
if (store_binary_string(&metadata, cs,
|
||||||
MY_REPERTOIRE_UNICODE30, &my_charset_bin))
|
MY_REPERTOIRE_UNICODE30))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (packet->realloc(packet->length() + 12))
|
if (packet->realloc(packet->length() + 12))
|
||||||
|
@ -149,18 +149,25 @@ public:
|
|||||||
|
|
||||||
// Various useful wrappers for the virtual store*() methods.
|
// Various useful wrappers for the virtual store*() methods.
|
||||||
// Backward wrapper for store_str()
|
// Backward wrapper for store_str()
|
||||||
bool store(const char *from, size_t length, CHARSET_INFO *cs,
|
inline bool store(const char *from, size_t length, CHARSET_INFO *cs,
|
||||||
my_repertoire_t repertoire= MY_REPERTOIRE_UNICODE30)
|
my_repertoire_t repertoire= MY_REPERTOIRE_UNICODE30)
|
||||||
{
|
{
|
||||||
return store_str(from, length, cs, repertoire, character_set_results());
|
return store_str(from, length, cs, repertoire, character_set_results());
|
||||||
}
|
}
|
||||||
bool store_lex_cstring(const LEX_CSTRING &s,
|
inline bool store_lex_cstring(const LEX_CSTRING &s,
|
||||||
CHARSET_INFO *fromcs,
|
CHARSET_INFO *fromcs,
|
||||||
my_repertoire_t from_repertoire,
|
my_repertoire_t from_repertoire,
|
||||||
CHARSET_INFO *tocs)
|
CHARSET_INFO *tocs)
|
||||||
{
|
{
|
||||||
return store_str(s.str, (uint) s.length, fromcs, from_repertoire, tocs);
|
return store_str(s.str, (uint) s.length, fromcs, from_repertoire, tocs);
|
||||||
}
|
}
|
||||||
|
inline bool store_binary_string(Binary_string *str,
|
||||||
|
CHARSET_INFO *fromcs,
|
||||||
|
my_repertoire_t from_repertoire)
|
||||||
|
{
|
||||||
|
return store_str(str->ptr(), (uint) str->length(), fromcs, from_repertoire,
|
||||||
|
&my_charset_bin);
|
||||||
|
}
|
||||||
bool store_ident(const LEX_CSTRING &s,
|
bool store_ident(const LEX_CSTRING &s,
|
||||||
my_repertoire_t repertoire= MY_REPERTOIRE_UNICODE30)
|
my_repertoire_t repertoire= MY_REPERTOIRE_UNICODE30)
|
||||||
{
|
{
|
||||||
|
@ -1286,7 +1286,7 @@ Sp_handler::sp_create_routine(THD *thd, const sp_head *sp) const
|
|||||||
if (type() == SP_TYPE_FUNCTION)
|
if (type() == SP_TYPE_FUNCTION)
|
||||||
{
|
{
|
||||||
sp_returns_type(thd, retstr, sp);
|
sp_returns_type(thd, retstr, sp);
|
||||||
returns= retstr.lex_cstring();
|
retstr.get_value(&returns);
|
||||||
}
|
}
|
||||||
goto log;
|
goto log;
|
||||||
}
|
}
|
||||||
@ -1369,7 +1369,7 @@ Sp_handler::sp_create_routine(THD *thd, const sp_head *sp) const
|
|||||||
if (type() == SP_TYPE_FUNCTION)
|
if (type() == SP_TYPE_FUNCTION)
|
||||||
{
|
{
|
||||||
sp_returns_type(thd, retstr, sp);
|
sp_returns_type(thd, retstr, sp);
|
||||||
returns= retstr.lex_cstring();
|
retstr.get_value(&returns);
|
||||||
|
|
||||||
store_failed= store_failed ||
|
store_failed= store_failed ||
|
||||||
table->field[MYSQL_PROC_FIELD_RETURNS]->
|
table->field[MYSQL_PROC_FIELD_RETURNS]->
|
||||||
@ -2061,7 +2061,7 @@ Sp_handler::sp_clone_and_link_routine(THD *thd,
|
|||||||
if (type() == SP_TYPE_FUNCTION)
|
if (type() == SP_TYPE_FUNCTION)
|
||||||
{
|
{
|
||||||
sp_returns_type(thd, retstr, sp);
|
sp_returns_type(thd, retstr, sp);
|
||||||
returns= retstr.lex_cstring();
|
retstr.get_value(&returns);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sp->m_parent)
|
if (sp->m_parent)
|
||||||
|
@ -6447,8 +6447,7 @@ struct SORT_FIELD_ATTR
|
|||||||
*/
|
*/
|
||||||
bool maybe_null;
|
bool maybe_null;
|
||||||
CHARSET_INFO *cs;
|
CHARSET_INFO *cs;
|
||||||
uint pack_sort_string(uchar *to, const LEX_CSTRING &str,
|
uint pack_sort_string(uchar *to, String *str) const;
|
||||||
CHARSET_INFO *cs) const;
|
|
||||||
int compare_packed_fixed_size_vals(uchar *a, size_t *a_len,
|
int compare_packed_fixed_size_vals(uchar *a, size_t *a_len,
|
||||||
uchar *b, size_t *b_len);
|
uchar *b, size_t *b_len);
|
||||||
int compare_packed_varstrings(uchar *a, size_t *a_len,
|
int compare_packed_varstrings(uchar *a, size_t *a_len,
|
||||||
|
@ -8215,7 +8215,7 @@ int make_schemata_old_format(THD *thd, ST_SCHEMA_TABLE *schema_table)
|
|||||||
buffer.append(lex->wild->ptr());
|
buffer.append(lex->wild->ptr());
|
||||||
buffer.append(')');
|
buffer.append(')');
|
||||||
}
|
}
|
||||||
field->set_name(thd, buffer.lex_cstring());
|
field->set_name(thd, &buffer);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -8224,7 +8224,7 @@ int make_schemata_old_format(THD *thd, ST_SCHEMA_TABLE *schema_table)
|
|||||||
int make_table_names_old_format(THD *thd, ST_SCHEMA_TABLE *schema_table)
|
int make_table_names_old_format(THD *thd, ST_SCHEMA_TABLE *schema_table)
|
||||||
{
|
{
|
||||||
char tmp[128];
|
char tmp[128];
|
||||||
String buffer(tmp,sizeof(tmp), thd->charset());
|
String buffer(tmp, sizeof(tmp), system_charset_info);
|
||||||
LEX *lex= thd->lex;
|
LEX *lex= thd->lex;
|
||||||
Name_resolution_context *context= &lex->first_select_lex()->context;
|
Name_resolution_context *context= &lex->first_select_lex()->context;
|
||||||
ST_FIELD_INFO *field_info= &schema_table->fields_info[2];
|
ST_FIELD_INFO *field_info= &schema_table->fields_info[2];
|
||||||
@ -8242,7 +8242,7 @@ int make_table_names_old_format(THD *thd, ST_SCHEMA_TABLE *schema_table)
|
|||||||
Item_field *field= new (thd->mem_root) Item_field(thd, context, field_name);
|
Item_field *field= new (thd->mem_root) Item_field(thd, context, field_name);
|
||||||
if (add_item_to_list(thd, field))
|
if (add_item_to_list(thd, field))
|
||||||
return 1;
|
return 1;
|
||||||
field->set_name(thd, buffer.lex_cstring());
|
field->set_name(thd, &buffer);
|
||||||
if (thd->lex->verbose)
|
if (thd->lex->verbose)
|
||||||
{
|
{
|
||||||
field_info= &schema_table->fields_info[3];
|
field_info= &schema_table->fields_info[3];
|
||||||
|
@ -222,18 +222,6 @@ public:
|
|||||||
inline bool is_empty() const { return (str_length == 0); }
|
inline bool is_empty() const { return (str_length == 0); }
|
||||||
inline const char *ptr() const { return Ptr; }
|
inline const char *ptr() const { return Ptr; }
|
||||||
inline const char *end() const { return Ptr + str_length; }
|
inline const char *end() const { return Ptr + str_length; }
|
||||||
|
|
||||||
LEX_STRING lex_string() const
|
|
||||||
{
|
|
||||||
LEX_STRING str = { (char*) ptr(), length() };
|
|
||||||
return str;
|
|
||||||
}
|
|
||||||
LEX_CSTRING lex_cstring() const
|
|
||||||
{
|
|
||||||
LEX_CSTRING skr = { ptr(), length() };
|
|
||||||
return skr;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool has_8bit_bytes() const
|
bool has_8bit_bytes() const
|
||||||
{
|
{
|
||||||
for (const char *c= ptr(), *c_end= end(); c < c_end; c++)
|
for (const char *c= ptr(), *c_end= end(); c < c_end; c++)
|
||||||
@ -488,6 +476,12 @@ public:
|
|||||||
if (str.Alloced_length)
|
if (str.Alloced_length)
|
||||||
Alloced_length= (uint32) (str.Alloced_length - offset);
|
Alloced_length= (uint32) (str.Alloced_length - offset);
|
||||||
}
|
}
|
||||||
|
inline LEX_CSTRING *get_value(LEX_CSTRING *res)
|
||||||
|
{
|
||||||
|
res->str= Ptr;
|
||||||
|
res->length= str_length;
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
/* Take over handling of buffer from some other object */
|
/* Take over handling of buffer from some other object */
|
||||||
void reset(char *ptr_arg, size_t length_arg, size_t alloced_length_arg)
|
void reset(char *ptr_arg, size_t length_arg, size_t alloced_length_arg)
|
||||||
@ -888,13 +882,13 @@ public:
|
|||||||
{
|
{
|
||||||
return Binary_string::append_hex((const char*)src, srclen);
|
return Binary_string::append_hex((const char*)src, srclen);
|
||||||
}
|
}
|
||||||
bool append_introducer_and_hex(CHARSET_INFO *cs, const LEX_CSTRING &str)
|
bool append_introducer_and_hex(String *str)
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
append(STRING_WITH_LEN("_")) ||
|
append(STRING_WITH_LEN("_")) ||
|
||||||
append(cs->csname) ||
|
append(str->charset()->csname) ||
|
||||||
append(STRING_WITH_LEN(" 0x")) ||
|
append(STRING_WITH_LEN(" 0x")) ||
|
||||||
append_hex(str.str, (uint32) str.length);
|
append_hex(str->ptr(), (uint32) str->length());
|
||||||
}
|
}
|
||||||
bool append(IO_CACHE* file, uint32 arg_length)
|
bool append(IO_CACHE* file, uint32 arg_length)
|
||||||
{
|
{
|
||||||
|
@ -8981,8 +8981,8 @@ bool Type_handler::partition_field_append_value(
|
|||||||
uint cnverr2= 0;
|
uint cnverr2= 0;
|
||||||
buf2.copy(res->ptr(), res->length(), res->charset(), field_cs, &cnverr2);
|
buf2.copy(res->ptr(), res->length(), res->charset(), field_cs, &cnverr2);
|
||||||
if (!cnverr2)
|
if (!cnverr2)
|
||||||
return str->append_introducer_and_hex(buf2.charset(), buf2.lex_cstring());
|
return str->append_introducer_and_hex(&buf2);
|
||||||
return str->append_introducer_and_hex(res->charset(), res->lex_cstring());
|
return str->append_introducer_and_hex(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
StringBuffer<64> val(system_charset_info);
|
StringBuffer<64> val(system_charset_info);
|
||||||
|
@ -14698,13 +14698,15 @@ literal:
|
|||||||
| UNDERSCORE_CHARSET hex_or_bin_String
|
| UNDERSCORE_CHARSET hex_or_bin_String
|
||||||
{
|
{
|
||||||
Item_string_with_introducer *item_str;
|
Item_string_with_introducer *item_str;
|
||||||
|
LEX_CSTRING tmp;
|
||||||
|
$2->get_value(&tmp);
|
||||||
/*
|
/*
|
||||||
Pass NULL as name. Name will be set in the "select_item" rule and
|
Pass NULL as name. Name will be set in the "select_item" rule and
|
||||||
will include the introducer and the original hex/bin notation.
|
will include the introducer and the original hex/bin notation.
|
||||||
*/
|
*/
|
||||||
item_str= new (thd->mem_root)
|
item_str= new (thd->mem_root)
|
||||||
Item_string_with_introducer(thd, null_clex_str,
|
Item_string_with_introducer(thd, null_clex_str,
|
||||||
$2->lex_cstring(), $1);
|
tmp, $1);
|
||||||
if (unlikely(!item_str ||
|
if (unlikely(!item_str ||
|
||||||
!item_str->check_well_formed_result(true)))
|
!item_str->check_well_formed_result(true)))
|
||||||
MYSQL_YYABORT;
|
MYSQL_YYABORT;
|
||||||
|
@ -86,6 +86,13 @@ static uchar* extra2_write_str(uchar *pos, const LEX_CSTRING &str)
|
|||||||
return pos + str.length;
|
return pos + str.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static uchar* extra2_write_str(uchar *pos, Binary_string *str)
|
||||||
|
{
|
||||||
|
pos= extra2_write_len(pos, str->length());
|
||||||
|
memcpy(pos, str->ptr(), str->length());
|
||||||
|
return pos + str->length();
|
||||||
|
}
|
||||||
|
|
||||||
static uchar *extra2_write(uchar *pos, enum extra2_frm_value_type type,
|
static uchar *extra2_write(uchar *pos, enum extra2_frm_value_type type,
|
||||||
const LEX_CSTRING &str)
|
const LEX_CSTRING &str)
|
||||||
{
|
{
|
||||||
@ -178,11 +185,11 @@ class Field_data_type_info_image: public BinaryStringBuffer<512>
|
|||||||
{
|
{
|
||||||
return net_store_length(pos, length);
|
return net_store_length(pos, length);
|
||||||
}
|
}
|
||||||
static uchar *store_string(uchar *pos, const LEX_CSTRING &str)
|
static uchar *store_string(uchar *pos, Binary_string *str)
|
||||||
{
|
{
|
||||||
pos= store_length(pos, str.length);
|
pos= store_length(pos, str->length());
|
||||||
memcpy(pos, str.str, str.length);
|
memcpy(pos, str->ptr(), str->length());
|
||||||
return pos + str.length;
|
return pos + str->length();
|
||||||
}
|
}
|
||||||
static uint store_length_required_length(ulonglong length)
|
static uint store_length_required_length(ulonglong length)
|
||||||
{
|
{
|
||||||
@ -206,7 +213,7 @@ public:
|
|||||||
return true; // Error
|
return true; // Error
|
||||||
uchar *pos= (uchar *) end();
|
uchar *pos= (uchar *) end();
|
||||||
pos= store_length(pos, fieldnr);
|
pos= store_length(pos, fieldnr);
|
||||||
pos= store_string(pos, type_info.lex_cstring());
|
pos= store_string(pos, &type_info);
|
||||||
size_t new_length= (const char *) pos - ptr();
|
size_t new_length= (const char *) pos - ptr();
|
||||||
DBUG_ASSERT(new_length < alloced_length());
|
DBUG_ASSERT(new_length < alloced_length());
|
||||||
length((uint32) new_length);
|
length((uint32) new_length);
|
||||||
@ -471,7 +478,7 @@ LEX_CUSTRING build_frm_image(THD *thd, const LEX_CSTRING &table,
|
|||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
*pos= EXTRA2_FIELD_DATA_TYPE_INFO;
|
*pos= EXTRA2_FIELD_DATA_TYPE_INFO;
|
||||||
pos= extra2_write_str(pos + 1, field_data_type_info_image.lex_cstring());
|
pos= extra2_write_str(pos + 1, &field_data_type_info_image);
|
||||||
}
|
}
|
||||||
|
|
||||||
// PERIOD
|
// PERIOD
|
||||||
|
@ -1968,7 +1968,7 @@ static int wsrep_create_sp(THD *thd, uchar** buf, size_t* buf_len)
|
|||||||
if (sp->m_handler->type() == SP_TYPE_FUNCTION)
|
if (sp->m_handler->type() == SP_TYPE_FUNCTION)
|
||||||
{
|
{
|
||||||
sp_returns_type(thd, retstr, sp);
|
sp_returns_type(thd, retstr, sp);
|
||||||
returns= retstr.lex_cstring();
|
retstr.get_value(&returns);
|
||||||
}
|
}
|
||||||
if (sp->m_handler->
|
if (sp->m_handler->
|
||||||
show_create_sp(thd, &log_query,
|
show_create_sp(thd, &log_query,
|
||||||
|
@ -492,12 +492,11 @@ static int scan(TABLE* table, uint field, INTTYPE& val)
|
|||||||
|
|
||||||
static int scan(TABLE* table, uint field, char* strbuf, uint strbuf_len)
|
static int scan(TABLE* table, uint field, char* strbuf, uint strbuf_len)
|
||||||
{
|
{
|
||||||
String str;
|
uint len;
|
||||||
(void)table->field[field]->val_str(&str);
|
StringBuffer<STRING_BUFFER_USUAL_SIZE> str;
|
||||||
LEX_CSTRING tmp= str.lex_cstring();
|
(void) table->field[field]->val_str(&str);
|
||||||
uint len = tmp.length;
|
len= str.length();
|
||||||
strncpy(strbuf, tmp.str, std::min(len, strbuf_len));
|
strmake(strbuf, str.ptr(), MY_MIN(len, strbuf_len-1));
|
||||||
strbuf[strbuf_len - 1]= '\0';
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -476,9 +476,10 @@ char *spider_string::c_ptr_safe()
|
|||||||
|
|
||||||
LEX_STRING spider_string::lex_string() const
|
LEX_STRING spider_string::lex_string() const
|
||||||
{
|
{
|
||||||
|
LEX_STRING res= { (char*) str.ptr(), str.length() };
|
||||||
DBUG_ENTER("spider_string::lex_string");
|
DBUG_ENTER("spider_string::lex_string");
|
||||||
DBUG_PRINT("info",("spider this=%p", this));
|
DBUG_PRINT("info",("spider this=%p", this));
|
||||||
DBUG_RETURN(str.lex_string());
|
DBUG_RETURN(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
void spider_string::set(
|
void spider_string::set(
|
||||||
|
Reference in New Issue
Block a user