24#ifndef CMP_VARLEN_KEYS_INCLUDED
25#define CMP_VARLEN_KEYS_INCLUDED
53 uint kp1_len, kp2_len, kp_len;
54 if (sort_field.maybe_null) {
55 const int k1_nullbyte = *kp1++;
56 const int k2_nullbyte = *kp2++;
57 if (k1_nullbyte != k2_nullbyte)
return k1_nullbyte < k2_nullbyte;
58 if (k1_nullbyte == 0 || k1_nullbyte == 0xff) {
59 if (!sort_field.is_varlen) {
60 kp1 += sort_field.length;
61 kp2 += sort_field.length;
66 if (sort_field.is_varlen) {
76 kp_len = std::min(kp1_len, kp2_len);
78 kp_len = kp1_len = kp2_len = sort_field.length;
81 res = memcmp(kp1, kp2, kp_len);
83 if (res)
return res < 0;
84 if (kp1_len != kp2_len) {
85 if (sort_field.reverse)
86 return kp2_len < kp1_len;
88 return kp1_len < kp2_len;
97 return memcmp(kp1, kp2, 8) < 0;
A wrapper class which provides array bounds checking.
Definition: sql_array.h:47
There are several record formats for sorting:
Definition: sort_param.h:302
Bounds_checked_array< st_sort_field > local_sortorder
ORDER BY list with some precalculated info for filesort.
Definition: sort_param.h:323
static const uint size_of_varlength_field
Definition: sort_param.h:467
bool use_hash
Definition: sort_param.h:311
bool cmp_varlen_keys(Bounds_checked_array< st_sort_field > sort_field_array, bool use_hash, const uchar *s1, const uchar *s2)
A compare function for variable-length keys used by filesort().
Definition: cmp_varlen_keys.h:46
Fido Client Authentication nullptr
Definition: fido_client_plugin.cc:222
static uint16 key1[1001]
Definition: hp_test2.cc:47
uint32 uint4korr(const char *pT)
Definition: my_byteorder.h:145
unsigned char uchar
Definition: my_inttypes.h:52
This struct is used for merging chunks for filesort() For filesort() with fixed-size keys we use memc...
Definition: cmp_varlen_keys.h:108
Merge_chunk_greater(Sort_param *param)
Definition: cmp_varlen_keys.h:116
bool key_is_greater_than(uchar *key1, uchar *key2) const
Definition: cmp_varlen_keys.h:122
Sort_param * m_param
Definition: cmp_varlen_keys.h:110
bool operator()(Merge_chunk *a, Merge_chunk *b) const
Definition: cmp_varlen_keys.h:118
size_t m_len
Definition: cmp_varlen_keys.h:109
Merge_chunk_greater(size_t len)
Definition: cmp_varlen_keys.h:113
Descriptor for a merge chunk to be sort-merged.
Definition: sql_sort.h:57
uchar * current_key() const
Definition: sql_sort.h:82
Struct that holds information about a sort field.
Definition: sort_param.h:86
unsigned int uint
Definition: uca9-dump.cc:75