mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
Merge branch '10.7' into 10.8
This commit is contained in:
97
sql/field.cc
97
sql/field.cc
@@ -7307,6 +7307,19 @@ bool Field_longstr::send(Protocol *protocol)
|
||||
}
|
||||
|
||||
|
||||
const Type_handler *Field_string::type_handler() const
|
||||
{
|
||||
if (is_var_string())
|
||||
return &type_handler_var_string;
|
||||
/*
|
||||
This is a temporary solution and will be fixed soon (in 10.9?).
|
||||
Type_handler_string_json will provide its own Field_string_json.
|
||||
*/
|
||||
if (Type_handler_json_common::has_json_valid_constraint(this))
|
||||
return &type_handler_string_json;
|
||||
return &type_handler_string;
|
||||
}
|
||||
|
||||
/* Copy a string and fill with space */
|
||||
|
||||
int Field_string::store(const char *from, size_t length,CHARSET_INFO *cs)
|
||||
@@ -7572,22 +7585,10 @@ Field_string::compatible_field_size(uint field_metadata,
|
||||
|
||||
int Field_string::cmp(const uchar *a_ptr, const uchar *b_ptr) const
|
||||
{
|
||||
size_t a_len, b_len;
|
||||
|
||||
if (mbmaxlen() != 1)
|
||||
{
|
||||
size_t char_len= Field_string::char_length();
|
||||
a_len= field_charset()->charpos(a_ptr, a_ptr + field_length, char_len);
|
||||
b_len= field_charset()->charpos(b_ptr, b_ptr + field_length, char_len);
|
||||
}
|
||||
else
|
||||
a_len= b_len= field_length;
|
||||
/*
|
||||
We have to remove end space to be able to compare multi-byte-characters
|
||||
like in latin_de 'ae' and 0xe4
|
||||
*/
|
||||
return field_charset()->strnncollsp(a_ptr, a_len,
|
||||
b_ptr, b_len);
|
||||
return field_charset()->coll->strnncollsp_nchars(field_charset(),
|
||||
a_ptr, field_length,
|
||||
b_ptr, field_length,
|
||||
Field_string::char_length());
|
||||
}
|
||||
|
||||
|
||||
@@ -7806,6 +7807,20 @@ en_fieldtype Field_string::tmp_engine_column_type(bool use_packed_rows) const
|
||||
|
||||
const uint Field_varstring::MAX_SIZE= UINT_MAX16;
|
||||
|
||||
|
||||
const Type_handler *Field_varstring::type_handler() const
|
||||
{
|
||||
/*
|
||||
This is a temporary solution and will be fixed soon (in 10.9?).
|
||||
Type_handler_varchar_json will provide its own Field_varstring_json
|
||||
and Field_varstring_compressed_json
|
||||
*/
|
||||
if (Type_handler_json_common::has_json_valid_constraint(this))
|
||||
return &type_handler_varchar_json;
|
||||
return &type_handler_varchar;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Save the field metadata for varstring fields.
|
||||
|
||||
@@ -7952,19 +7967,6 @@ int Field_varstring::cmp(const uchar *a_ptr, const uchar *b_ptr) const
|
||||
}
|
||||
|
||||
|
||||
static int cmp_str_prefix(const uchar *ua, size_t alen, const uchar *ub,
|
||||
size_t blen, size_t prefix, CHARSET_INFO *cs)
|
||||
{
|
||||
const char *a= (char*)ua, *b= (char*)ub;
|
||||
MY_STRCOPY_STATUS status;
|
||||
prefix/= cs->mbmaxlen;
|
||||
alen= cs->cset->well_formed_char_length(cs, a, a + alen, prefix, &status);
|
||||
blen= cs->cset->well_formed_char_length(cs, b, b + blen, prefix, &status);
|
||||
return cs->coll->strnncollsp(cs, ua, alen, ub, blen);
|
||||
}
|
||||
|
||||
|
||||
|
||||
int Field_varstring::cmp_prefix(const uchar *a_ptr, const uchar *b_ptr,
|
||||
size_t prefix_len) const
|
||||
{
|
||||
@@ -7984,8 +7986,13 @@ int Field_varstring::cmp_prefix(const uchar *a_ptr, const uchar *b_ptr,
|
||||
a_length= uint2korr(a_ptr);
|
||||
b_length= uint2korr(b_ptr);
|
||||
}
|
||||
return cmp_str_prefix(a_ptr+length_bytes, a_length, b_ptr+length_bytes,
|
||||
b_length, prefix_len, field_charset());
|
||||
return field_charset()->coll->strnncollsp_nchars(field_charset(),
|
||||
a_ptr + length_bytes,
|
||||
a_length,
|
||||
b_ptr + length_bytes,
|
||||
b_length,
|
||||
prefix_len /
|
||||
field_charset()->mbmaxlen);
|
||||
}
|
||||
|
||||
|
||||
@@ -8772,8 +8779,11 @@ int Field_blob::cmp_prefix(const uchar *a_ptr, const uchar *b_ptr,
|
||||
memcpy(&blob1, a_ptr+packlength, sizeof(char*));
|
||||
memcpy(&blob2, b_ptr+packlength, sizeof(char*));
|
||||
size_t a_len= get_length(a_ptr), b_len= get_length(b_ptr);
|
||||
return cmp_str_prefix(blob1, a_len, blob2, b_len, prefix_len,
|
||||
field_charset());
|
||||
return field_charset()->coll->strnncollsp_nchars(field_charset(),
|
||||
blob1, a_len,
|
||||
blob2, b_len,
|
||||
prefix_len /
|
||||
field_charset()->mbmaxlen);
|
||||
}
|
||||
|
||||
|
||||
@@ -8940,6 +8950,15 @@ void Field_blob::sort_string(uchar *to,uint length)
|
||||
*/
|
||||
const Type_handler *Field_blob::type_handler() const
|
||||
{
|
||||
/*
|
||||
This is a temporary solution and will be fixed soon (in 10.9?).
|
||||
Type_handler_*blob_json will provide its own Field_blob_json
|
||||
and Field_blob_compressed_json.
|
||||
*/
|
||||
if (Type_handler_json_common::has_json_valid_constraint(this))
|
||||
return Type_handler_json_common::
|
||||
json_blob_type_handler_by_length_bytes(packlength);
|
||||
|
||||
switch (packlength) {
|
||||
case 1: return &type_handler_tiny_blob;
|
||||
case 2: return &type_handler_blob;
|
||||
@@ -9652,16 +9671,8 @@ bool Field_num::is_equal(const Column_definition &new_field) const
|
||||
}
|
||||
|
||||
|
||||
bool Field_enum::can_optimize_range(const Item_bool_func *cond,
|
||||
const Item *item,
|
||||
bool is_eq_func) const
|
||||
{
|
||||
return item->cmp_type() != TIME_RESULT;
|
||||
}
|
||||
|
||||
|
||||
bool Field_enum::can_optimize_keypart_ref(const Item_bool_func *cond,
|
||||
const Item *item) const
|
||||
bool Field_enum::can_optimize_range_or_keypart_ref(const Item_bool_func *cond,
|
||||
const Item *item) const
|
||||
{
|
||||
switch (item->cmp_type())
|
||||
{
|
||||
|
Reference in New Issue
Block a user