Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
e81db2ba
Commit
e81db2ba
authored
Jul 09, 2019
by
Nikita Malyavin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add const qualifiers to Field::cmp, Field::cmp_max and Field::cmp_binary
parent
46553c25
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
88 additions
and
87 deletions
+88
-87
sql/field.cc
sql/field.cc
+39
-39
sql/field.h
sql/field.h
+49
-48
No files found.
sql/field.cc
View file @
e81db2ba
...
...
@@ -3037,7 +3037,7 @@ String *Field_decimal::val_str(String *val_buffer __attribute__((unused)),
5.00 , -1.0, 05, -05, +5 with optional pre/end space
*/
int
Field_decimal
::
cmp
(
const
uchar
*
a_ptr
,
const
uchar
*
b_ptr
)
int
Field_decimal
::
cmp
(
const
uchar
*
a_ptr
,
const
uchar
*
b_ptr
)
const
{
const
uchar
*
end
;
int
swap
=
0
;
...
...
@@ -3416,7 +3416,7 @@ my_decimal* Field_new_decimal::val_decimal(my_decimal *decimal_value)
}
int
Field_new_decimal
::
cmp
(
const
uchar
*
a
,
const
uchar
*
b
)
int
Field_new_decimal
::
cmp
(
const
uchar
*
a
,
const
uchar
*
b
)
const
{
return
memcmp
(
a
,
b
,
bin_size
);
}
...
...
@@ -3738,7 +3738,7 @@ bool Field_tiny::send_binary(Protocol *protocol)
return
protocol
->
store_tiny
((
longlong
)
(
int8
)
ptr
[
0
]);
}
int
Field_tiny
::
cmp
(
const
uchar
*
a_ptr
,
const
uchar
*
b_ptr
)
int
Field_tiny
::
cmp
(
const
uchar
*
a_ptr
,
const
uchar
*
b_ptr
)
const
{
signed
char
a
,
b
;
a
=
(
signed
char
)
a_ptr
[
0
];
b
=
(
signed
char
)
b_ptr
[
0
];
...
...
@@ -3907,7 +3907,7 @@ bool Field_short::send_binary(Protocol *protocol)
}
int
Field_short
::
cmp
(
const
uchar
*
a_ptr
,
const
uchar
*
b_ptr
)
int
Field_short
::
cmp
(
const
uchar
*
a_ptr
,
const
uchar
*
b_ptr
)
const
{
short
a
,
b
;
a
=
sint2korr
(
a_ptr
);
...
...
@@ -4100,7 +4100,7 @@ bool Field_medium::send_binary(Protocol *protocol)
}
int
Field_medium
::
cmp
(
const
uchar
*
a_ptr
,
const
uchar
*
b_ptr
)
int
Field_medium
::
cmp
(
const
uchar
*
a_ptr
,
const
uchar
*
b_ptr
)
const
{
long
a
,
b
;
if
(
unsigned_flag
)
...
...
@@ -4278,7 +4278,7 @@ bool Field_long::send_binary(Protocol *protocol)
return
protocol
->
store_long
(
Field_long
::
val_int
());
}
int
Field_long
::
cmp
(
const
uchar
*
a_ptr
,
const
uchar
*
b_ptr
)
int
Field_long
::
cmp
(
const
uchar
*
a_ptr
,
const
uchar
*
b_ptr
)
const
{
int32
a
,
b
;
a
=
sint4korr
(
a_ptr
);
...
...
@@ -4424,7 +4424,7 @@ bool Field_longlong::send_binary(Protocol *protocol)
}
int
Field_longlong
::
cmp
(
const
uchar
*
a_ptr
,
const
uchar
*
b_ptr
)
int
Field_longlong
::
cmp
(
const
uchar
*
a_ptr
,
const
uchar
*
b_ptr
)
const
{
longlong
a
,
b
;
a
=
sint8korr
(
a_ptr
);
...
...
@@ -4559,7 +4559,7 @@ String *Field_float::val_str(String *val_buffer,
}
int
Field_float
::
cmp
(
const
uchar
*
a_ptr
,
const
uchar
*
b_ptr
)
int
Field_float
::
cmp
(
const
uchar
*
a_ptr
,
const
uchar
*
b_ptr
)
const
{
float
a
,
b
;
float4get
(
a
,
a_ptr
);
...
...
@@ -4901,7 +4901,7 @@ bool Field_double::send_binary(Protocol *protocol)
}
int
Field_double
::
cmp
(
const
uchar
*
a_ptr
,
const
uchar
*
b_ptr
)
int
Field_double
::
cmp
(
const
uchar
*
a_ptr
,
const
uchar
*
b_ptr
)
const
{
double
a
,
b
;
float8get
(
a
,
a_ptr
);
...
...
@@ -5314,7 +5314,7 @@ bool Field_timestamp::send_binary(Protocol *protocol)
}
int
Field_timestamp
::
cmp
(
const
uchar
*
a_ptr
,
const
uchar
*
b_ptr
)
int
Field_timestamp
::
cmp
(
const
uchar
*
a_ptr
,
const
uchar
*
b_ptr
)
const
{
int32
a
,
b
;
a
=
sint4korr
(
a_ptr
);
...
...
@@ -5510,7 +5510,7 @@ bool Field_timestamp_with_dec::send_binary(Protocol *protocol)
}
int
Field_timestamp_hires
::
cmp
(
const
uchar
*
a_ptr
,
const
uchar
*
b_ptr
)
int
Field_timestamp_hires
::
cmp
(
const
uchar
*
a_ptr
,
const
uchar
*
b_ptr
)
const
{
int32
a
,
b
;
ulong
a_sec_part
,
b_sec_part
;
...
...
@@ -5960,7 +5960,7 @@ bool Field_time::send_binary(Protocol *protocol)
}
int
Field_time
::
cmp
(
const
uchar
*
a_ptr
,
const
uchar
*
b_ptr
)
int
Field_time
::
cmp
(
const
uchar
*
a_ptr
,
const
uchar
*
b_ptr
)
const
{
int32
a
,
b
;
a
=
(
int32
)
sint3korr
(
a_ptr
);
...
...
@@ -6148,7 +6148,7 @@ bool Field_time_hires::get_date(MYSQL_TIME *ltime, date_mode_t fuzzydate)
}
int
Field_time_hires
::
cmp
(
const
uchar
*
a_ptr
,
const
uchar
*
b_ptr
)
int
Field_time_hires
::
cmp
(
const
uchar
*
a_ptr
,
const
uchar
*
b_ptr
)
const
{
ulonglong
a
=
read_bigendian
(
a_ptr
,
Field_time_hires
::
pack_length
());
ulonglong
b
=
read_bigendian
(
b_ptr
,
Field_time_hires
::
pack_length
());
...
...
@@ -6476,7 +6476,7 @@ String *Field_date::val_str(String *val_buffer,
}
int
Field_date
::
cmp
(
const
uchar
*
a_ptr
,
const
uchar
*
b_ptr
)
int
Field_date
::
cmp
(
const
uchar
*
a_ptr
,
const
uchar
*
b_ptr
)
const
{
int32
a
,
b
;
a
=
sint4korr
(
a_ptr
);
...
...
@@ -6580,7 +6580,7 @@ bool Field_newdate::get_TIME(MYSQL_TIME *ltime, const uchar *pos,
}
int
Field_newdate
::
cmp
(
const
uchar
*
a_ptr
,
const
uchar
*
b_ptr
)
int
Field_newdate
::
cmp
(
const
uchar
*
a_ptr
,
const
uchar
*
b_ptr
)
const
{
uint32
a
,
b
;
a
=
(
uint32
)
uint3korr
(
a_ptr
);
...
...
@@ -6765,7 +6765,7 @@ bool Field_datetime::get_TIME(MYSQL_TIME *ltime, const uchar *pos,
}
int
Field_datetime
::
cmp
(
const
uchar
*
a_ptr
,
const
uchar
*
b_ptr
)
int
Field_datetime
::
cmp
(
const
uchar
*
a_ptr
,
const
uchar
*
b_ptr
)
const
{
longlong
a
,
b
;
a
=
sint8korr
(
a_ptr
);
...
...
@@ -6867,7 +6867,7 @@ bool Field_datetime_hires::get_TIME(MYSQL_TIME *ltime, const uchar *pos,
}
int
Field_datetime_hires
::
cmp
(
const
uchar
*
a_ptr
,
const
uchar
*
b_ptr
)
int
Field_datetime_hires
::
cmp
(
const
uchar
*
a_ptr
,
const
uchar
*
b_ptr
)
const
{
ulonglong
a
=
read_bigendian
(
a_ptr
,
Field_datetime_hires
::
pack_length
());
ulonglong
b
=
read_bigendian
(
b_ptr
,
Field_datetime_hires
::
pack_length
());
...
...
@@ -7258,7 +7258,7 @@ Field_string::compatible_field_size(uint field_metadata,
}
int
Field_string
::
cmp
(
const
uchar
*
a_ptr
,
const
uchar
*
b_ptr
)
int
Field_string
::
cmp
(
const
uchar
*
a_ptr
,
const
uchar
*
b_ptr
)
const
{
size_t
a_len
,
b_len
;
...
...
@@ -7612,7 +7612,7 @@ my_decimal *Field_varstring::val_decimal(my_decimal *decimal_value)
int
Field_varstring
::
cmp_max
(
const
uchar
*
a_ptr
,
const
uchar
*
b_ptr
,
uint
max_len
)
uint
max_len
)
const
{
uint
a_length
,
b_length
;
int
diff
;
...
...
@@ -7645,7 +7645,7 @@ int Field_varstring::cmp_max(const uchar *a_ptr, const uchar *b_ptr,
varstring and blob keys are ALWAYS stored with a 2 byte length prefix
*/
int
Field_varstring
::
key_cmp
(
const
uchar
*
key_ptr
,
uint
max_key_length
)
int
Field_varstring
::
key_cmp
(
const
uchar
*
key_ptr
,
uint
max_key_length
)
const
{
size_t
length
=
length_bytes
==
1
?
(
uint
)
*
ptr
:
uint2korr
(
ptr
);
size_t
local_char_length
=
max_key_length
/
field_charset
->
mbmaxlen
;
...
...
@@ -7670,7 +7670,7 @@ int Field_varstring::key_cmp(const uchar *key_ptr, uint max_key_length)
(keys are created and compared in key.cc)
*/
int
Field_varstring
::
key_cmp
(
const
uchar
*
a
,
const
uchar
*
b
)
int
Field_varstring
::
key_cmp
(
const
uchar
*
a
,
const
uchar
*
b
)
const
{
return
field_charset
->
coll
->
strnncollsp
(
field_charset
,
a
+
HA_KEY_BLOB_LENGTH
,
...
...
@@ -7870,7 +7870,7 @@ void Field_varstring::set_key_image(const uchar *buff,uint length)
int
Field_varstring
::
cmp_binary
(
const
uchar
*
a_ptr
,
const
uchar
*
b_ptr
,
uint32
max_length
)
uint32
max_length
)
const
{
uint32
a_length
,
b_length
;
...
...
@@ -8043,7 +8043,7 @@ int Field_longstr::compress(char *to, uint to_length,
*/
String
*
Field_longstr
::
uncompress
(
String
*
val_buffer
,
String
*
val_ptr
,
const
uchar
*
from
,
uint
from_length
)
const
uchar
*
from
,
uint
from_length
)
const
{
if
(
from_length
)
{
...
...
@@ -8122,7 +8122,7 @@ longlong Field_varstring_compressed::val_int(void)
int
Field_varstring_compressed
::
cmp_max
(
const
uchar
*
a_ptr
,
const
uchar
*
b_ptr
,
uint
max_len
)
uint
max_len
)
const
{
String
a
,
b
;
uint
a_length
,
b_length
;
...
...
@@ -8373,7 +8373,7 @@ my_decimal *Field_blob::val_decimal(my_decimal *decimal_value)
int
Field_blob
::
cmp
(
const
uchar
*
a
,
uint32
a_length
,
const
uchar
*
b
,
uint32
b_length
)
uint32
b_length
)
const
{
return
field_charset
->
coll
->
strnncollsp
(
field_charset
,
a
,
a_length
,
b
,
b_length
);
...
...
@@ -8381,7 +8381,7 @@ int Field_blob::cmp(const uchar *a,uint32 a_length, const uchar *b,
int
Field_blob
::
cmp_max
(
const
uchar
*
a_ptr
,
const
uchar
*
b_ptr
,
uint
max_length
)
uint
max_length
)
const
{
uchar
*
blob1
,
*
blob2
;
memcpy
(
&
blob1
,
a_ptr
+
packlength
,
sizeof
(
char
*
));
...
...
@@ -8394,7 +8394,7 @@ int Field_blob::cmp_max(const uchar *a_ptr, const uchar *b_ptr,
int
Field_blob
::
cmp_binary
(
const
uchar
*
a_ptr
,
const
uchar
*
b_ptr
,
uint32
max_length
)
uint32
max_length
)
const
{
char
*
a
,
*
b
;
uint
diff
;
...
...
@@ -8446,7 +8446,7 @@ void Field_blob::set_key_image(const uchar *buff,uint length)
}
int
Field_blob
::
key_cmp
(
const
uchar
*
key_ptr
,
uint
max_key_length
)
int
Field_blob
::
key_cmp
(
const
uchar
*
key_ptr
,
uint
max_key_length
)
const
{
uchar
*
blob1
;
size_t
blob_length
=
get_length
(
ptr
);
...
...
@@ -8461,7 +8461,7 @@ int Field_blob::key_cmp(const uchar *key_ptr, uint max_key_length)
uint2korr
(
key_ptr
));
}
int
Field_blob
::
key_cmp
(
const
uchar
*
a
,
const
uchar
*
b
)
int
Field_blob
::
key_cmp
(
const
uchar
*
a
,
const
uchar
*
b
)
const
{
return
Field_blob
::
cmp
(
a
+
HA_KEY_BLOB_LENGTH
,
uint2korr
(
a
),
b
+
HA_KEY_BLOB_LENGTH
,
uint2korr
(
b
));
...
...
@@ -8858,9 +8858,13 @@ double Field_enum::val_real(void)
longlong
Field_enum
::
val_int
(
void
)
{
DBUG_ASSERT
(
marked_for_read
());
return
read_lowendian
(
ptr
,
packlength
);
return
val_int
(
ptr
);
}
longlong
Field_enum
::
val_int
(
const
uchar
*
real_ptr
)
const
{
return
read_lowendian
(
real_ptr
,
packlength
);
}
/**
Save the field metadata for enum fields.
...
...
@@ -8894,14 +8898,10 @@ String *Field_enum::val_str(String *val_buffer __attribute__((unused)),
return
val_ptr
;
}
int
Field_enum
::
cmp
(
const
uchar
*
a_ptr
,
const
uchar
*
b_ptr
)
int
Field_enum
::
cmp
(
const
uchar
*
a_ptr
,
const
uchar
*
b_ptr
)
const
{
uchar
*
old
=
ptr
;
ptr
=
(
uchar
*
)
a_ptr
;
ulonglong
a
=
Field_enum
::
val_int
();
ptr
=
(
uchar
*
)
b_ptr
;
ulonglong
b
=
Field_enum
::
val_int
();
ptr
=
old
;
ulonglong
a
=
Field_enum
::
val_int
(
a_ptr
);
ulonglong
b
=
Field_enum
::
val_int
(
b_ptr
);
return
(
a
<
b
)
?
-
1
:
(
a
>
b
)
?
1
:
0
;
}
...
...
@@ -9542,7 +9542,7 @@ my_decimal *Field_bit::val_decimal(my_decimal *deciaml_value)
The a and b pointer must be pointers to the field in a record
(not the table->record[0] necessarily)
*/
int
Field_bit
::
cmp_max
(
const
uchar
*
a
,
const
uchar
*
b
,
uint
max_len
)
int
Field_bit
::
cmp_max
(
const
uchar
*
a
,
const
uchar
*
b
,
uint
max_len
)
const
{
my_ptrdiff_t
a_diff
=
a
-
ptr
;
my_ptrdiff_t
b_diff
=
b
-
ptr
;
...
...
@@ -9560,7 +9560,7 @@ int Field_bit::cmp_max(const uchar *a, const uchar *b, uint max_len)
}
int
Field_bit
::
key_cmp
(
const
uchar
*
str
,
uint
length
)
int
Field_bit
::
key_cmp
(
const
uchar
*
str
,
uint
length
)
const
{
if
(
bit_len
)
{
...
...
sql/field.h
View file @
e81db2ba
...
...
@@ -1134,18 +1134,18 @@ class Field: public Value_source
const
Conv_param
&
param
)
const
;
inline
int
cmp
(
const
uchar
*
str
)
{
return
cmp
(
ptr
,
str
);
}
virtual
int
cmp_max
(
const
uchar
*
a
,
const
uchar
*
b
,
uint
max_len
)
virtual
int
cmp_max
(
const
uchar
*
a
,
const
uchar
*
b
,
uint
max_len
)
const
{
return
cmp
(
a
,
b
);
}
virtual
int
cmp
(
const
uchar
*
,
const
uchar
*
)
=
0
;
virtual
int
cmp_binary
(
const
uchar
*
a
,
const
uchar
*
b
,
uint32
max_length
=~
0U
)
virtual
int
cmp
(
const
uchar
*
,
const
uchar
*
)
const
=
0
;
virtual
int
cmp_binary
(
const
uchar
*
a
,
const
uchar
*
b
,
uint32
max_length
=~
0U
)
const
{
return
memcmp
(
a
,
b
,
pack_length
());
}
virtual
int
cmp_offset
(
my_ptrdiff_t
row_offset
)
{
return
cmp
(
ptr
,
ptr
+
row_offset
);
}
virtual
int
cmp_binary_offset
(
uint
row_offset
)
{
return
cmp_binary
(
ptr
,
ptr
+
row_offset
);
};
virtual
int
key_cmp
(
const
uchar
*
a
,
const
uchar
*
b
)
virtual
int
key_cmp
(
const
uchar
*
a
,
const
uchar
*
b
)
const
{
return
cmp
(
a
,
b
);
}
virtual
int
key_cmp
(
const
uchar
*
str
,
uint
length
)
virtual
int
key_cmp
(
const
uchar
*
str
,
uint
length
)
const
{
return
cmp
(
ptr
,
str
);
}
/*
Update the value m of the 'min_val' field with the current value v
...
...
@@ -1977,7 +1977,7 @@ class Field_longstr :public Field_str
uint
*
out_length
,
CHARSET_INFO
*
cs
,
size_t
nchars
);
String
*
uncompress
(
String
*
val_buffer
,
String
*
val_ptr
,
const
uchar
*
from
,
uint
from_length
);
const
uchar
*
from
,
uint
from_length
)
const
;
public:
Field_longstr
(
uchar
*
ptr_arg
,
uint32
len_arg
,
uchar
*
null_ptr_arg
,
uchar
null_bit_arg
,
utype
unireg_check_arg
,
...
...
@@ -2092,7 +2092,7 @@ class Field_decimal :public Field_real {
double
val_real
(
void
);
longlong
val_int
(
void
);
String
*
val_str
(
String
*
,
String
*
);
int
cmp
(
const
uchar
*
,
const
uchar
*
);
int
cmp
(
const
uchar
*
,
const
uchar
*
)
const
;
void
sort_string
(
uchar
*
buff
,
uint
length
);
void
overflow
(
bool
negative
);
bool
zero_pack
()
const
{
return
0
;
}
...
...
@@ -2182,7 +2182,7 @@ class Field_new_decimal :public Field_num {
{
return
my_decimal
(
ptr
,
precision
,
dec
).
to_bool
();
}
int
cmp
(
const
uchar
*
,
const
uchar
*
);
int
cmp
(
const
uchar
*
,
const
uchar
*
)
const
;
void
sort_string
(
uchar
*
buff
,
uint
length
);
bool
zero_pack
()
const
{
return
0
;
}
void
sql_type
(
String
&
str
)
const
;
...
...
@@ -2288,7 +2288,7 @@ class Field_tiny :public Field_int
longlong
val_int
(
void
);
String
*
val_str
(
String
*
,
String
*
);
bool
send_binary
(
Protocol
*
protocol
);
int
cmp
(
const
uchar
*
,
const
uchar
*
);
int
cmp
(
const
uchar
*
,
const
uchar
*
)
const
;
void
sort_string
(
uchar
*
buff
,
uint
length
);
uint32
pack_length
()
const
{
return
1
;
}
void
sql_type
(
String
&
str
)
const
;
...
...
@@ -2345,7 +2345,7 @@ class Field_short :public Field_int
longlong
val_int
(
void
);
String
*
val_str
(
String
*
,
String
*
);
bool
send_binary
(
Protocol
*
protocol
);
int
cmp
(
const
uchar
*
,
const
uchar
*
);
int
cmp
(
const
uchar
*
,
const
uchar
*
)
const
;
void
sort_string
(
uchar
*
buff
,
uint
length
);
uint32
pack_length
()
const
{
return
2
;
}
void
sql_type
(
String
&
str
)
const
;
...
...
@@ -2386,7 +2386,7 @@ class Field_medium :public Field_int
longlong
val_int
(
void
);
String
*
val_str
(
String
*
,
String
*
);
bool
send_binary
(
Protocol
*
protocol
);
int
cmp
(
const
uchar
*
,
const
uchar
*
);
int
cmp
(
const
uchar
*
,
const
uchar
*
)
const
;
void
sort_string
(
uchar
*
buff
,
uint
length
);
uint32
pack_length
()
const
{
return
3
;
}
void
sql_type
(
String
&
str
)
const
;
...
...
@@ -2432,7 +2432,7 @@ class Field_long :public Field_int
longlong
val_int
(
void
);
bool
send_binary
(
Protocol
*
protocol
);
String
*
val_str
(
String
*
,
String
*
);
int
cmp
(
const
uchar
*
,
const
uchar
*
);
int
cmp
(
const
uchar
*
,
const
uchar
*
)
const
;
void
sort_string
(
uchar
*
buff
,
uint
length
);
uint32
pack_length
()
const
{
return
4
;
}
void
sql_type
(
String
&
str
)
const
;
...
...
@@ -2489,7 +2489,7 @@ class Field_longlong :public Field_int
longlong
val_int
(
void
);
String
*
val_str
(
String
*
,
String
*
);
bool
send_binary
(
Protocol
*
protocol
);
int
cmp
(
const
uchar
*
,
const
uchar
*
);
int
cmp
(
const
uchar
*
,
const
uchar
*
)
const
;
void
sort_string
(
uchar
*
buff
,
uint
length
);
uint32
pack_length
()
const
{
return
8
;
}
void
sql_type
(
String
&
str
)
const
;
...
...
@@ -2590,7 +2590,7 @@ class Field_float :public Field_real {
longlong
val_int
(
void
);
String
*
val_str
(
String
*
,
String
*
);
bool
send_binary
(
Protocol
*
protocol
);
int
cmp
(
const
uchar
*
,
const
uchar
*
);
int
cmp
(
const
uchar
*
,
const
uchar
*
)
const
;
void
sort_string
(
uchar
*
buff
,
uint
length
);
uint32
pack_length
()
const
{
return
sizeof
(
float
);
}
uint
row_pack_length
()
const
{
return
pack_length
();
}
...
...
@@ -2655,7 +2655,7 @@ class Field_double :public Field_real {
ulonglong
val_uint
(
void
)
{
return
(
ulonglong
)
val_int_from_real
(
true
);
}
String
*
val_str
(
String
*
,
String
*
);
bool
send_binary
(
Protocol
*
protocol
);
int
cmp
(
const
uchar
*
,
const
uchar
*
);
int
cmp
(
const
uchar
*
,
const
uchar
*
)
const
;
void
sort_string
(
uchar
*
buff
,
uint
length
);
uint32
pack_length
()
const
{
return
sizeof
(
double
);
}
uint
row_pack_length
()
const
{
return
pack_length
();
}
...
...
@@ -2709,7 +2709,7 @@ class Field_null :public Field_str {
String
*
val_str
(
String
*
value
,
String
*
value2
)
{
value2
->
length
(
0
);
return
value2
;}
bool
is_equal
(
const
Column_definition
&
new_field
)
const
;
int
cmp
(
const
uchar
*
a
,
const
uchar
*
b
)
{
return
0
;}
int
cmp
(
const
uchar
*
a
,
const
uchar
*
b
)
const
{
return
0
;}
void
sort_string
(
uchar
*
buff
,
uint
length
)
{}
uint32
pack_length
()
const
{
return
0
;
}
void
sql_type
(
String
&
str
)
const
;
...
...
@@ -2890,7 +2890,7 @@ class Field_timestamp :public Field_temporal {
longlong
val_int
(
void
);
String
*
val_str
(
String
*
,
String
*
);
bool
send_binary
(
Protocol
*
protocol
);
int
cmp
(
const
uchar
*
,
const
uchar
*
);
int
cmp
(
const
uchar
*
,
const
uchar
*
)
const
;
void
sort_string
(
uchar
*
buff
,
uint
length
);
uint32
pack_length
()
const
{
return
4
;
}
void
sql_type
(
String
&
str
)
const
;
...
...
@@ -3003,7 +3003,7 @@ class Field_timestamp_hires :public Field_timestamp_with_dec {
}
bool
val_native
(
Native
*
to
);
my_time_t
get_timestamp
(
const
uchar
*
pos
,
ulong
*
sec_part
)
const
;
int
cmp
(
const
uchar
*
,
const
uchar
*
);
int
cmp
(
const
uchar
*
,
const
uchar
*
)
const
;
uint32
pack_length
()
const
{
return
4
+
sec_part_bytes
(
dec
);
}
uint
size_of
()
const
{
return
sizeof
(
*
this
);
}
};
...
...
@@ -3044,7 +3044,7 @@ class Field_timestampf :public Field_timestamp_with_dec {
uint
tmp
=
my_timestamp_binary_length
(
field_metadata
);
DBUG_RETURN
(
tmp
);
}
int
cmp
(
const
uchar
*
a_ptr
,
const
uchar
*
b_ptr
)
int
cmp
(
const
uchar
*
a_ptr
,
const
uchar
*
b_ptr
)
const
{
return
memcmp
(
a_ptr
,
b_ptr
,
pack_length
());
}
...
...
@@ -3167,7 +3167,7 @@ class Field_date :public Field_date_common
longlong
val_int
(
void
);
String
*
val_str
(
String
*
,
String
*
);
bool
send_binary
(
Protocol
*
protocol
);
int
cmp
(
const
uchar
*
,
const
uchar
*
);
int
cmp
(
const
uchar
*
,
const
uchar
*
)
const
;
void
sort_string
(
uchar
*
buff
,
uint
length
);
uint32
pack_length
()
const
{
return
4
;
}
void
sql_type
(
String
&
str
)
const
;
...
...
@@ -3205,7 +3205,7 @@ class Field_newdate :public Field_date_common
longlong
val_int
(
void
);
String
*
val_str
(
String
*
,
String
*
);
bool
send_binary
(
Protocol
*
protocol
);
int
cmp
(
const
uchar
*
,
const
uchar
*
);
int
cmp
(
const
uchar
*
,
const
uchar
*
)
const
;
void
sort_string
(
uchar
*
buff
,
uint
length
);
uint32
pack_length
()
const
{
return
3
;
}
void
sql_type
(
String
&
str
)
const
;
...
...
@@ -3269,7 +3269,7 @@ class Field_time :public Field_temporal {
String
*
val_str
(
String
*
,
String
*
);
bool
get_date
(
MYSQL_TIME
*
ltime
,
date_mode_t
fuzzydate
);
bool
send_binary
(
Protocol
*
protocol
);
int
cmp
(
const
uchar
*
,
const
uchar
*
);
int
cmp
(
const
uchar
*
,
const
uchar
*
)
const
;
void
sort_string
(
uchar
*
buff
,
uint
length
);
uint32
pack_length
()
const
{
return
3
;
}
void
sql_type
(
String
&
str
)
const
;
...
...
@@ -3329,7 +3329,7 @@ class Field_time_hires :public Field_time_with_dec {
}
int
reset
(
void
);
bool
get_date
(
MYSQL_TIME
*
ltime
,
date_mode_t
fuzzydate
);
int
cmp
(
const
uchar
*
,
const
uchar
*
);
int
cmp
(
const
uchar
*
,
const
uchar
*
)
const
;
void
sort_string
(
uchar
*
buff
,
uint
length
);
uint32
pack_length
()
const
{
return
Type_handler_time
::
hires_bytes
(
dec
);
}
uint
size_of
()
const
{
return
sizeof
(
*
this
);
}
...
...
@@ -3377,7 +3377,7 @@ class Field_timef :public Field_time_with_dec {
DBUG_ASSERT
(
length
==
Field_timef
::
pack_length
());
memcpy
(
to
,
ptr
,
length
);
}
int
cmp
(
const
uchar
*
a_ptr
,
const
uchar
*
b_ptr
)
int
cmp
(
const
uchar
*
a_ptr
,
const
uchar
*
b_ptr
)
const
{
return
memcmp
(
a_ptr
,
b_ptr
,
pack_length
());
}
...
...
@@ -3418,7 +3418,7 @@ class Field_datetime :public Field_temporal_with_date {
longlong
val_int
(
void
);
String
*
val_str
(
String
*
,
String
*
);
bool
send_binary
(
Protocol
*
protocol
);
int
cmp
(
const
uchar
*
,
const
uchar
*
);
int
cmp
(
const
uchar
*
,
const
uchar
*
)
const
;
void
sort_string
(
uchar
*
buff
,
uint
length
);
uint32
pack_length
()
const
{
return
8
;
}
void
sql_type
(
String
&
str
)
const
;
...
...
@@ -3503,7 +3503,7 @@ class Field_datetime_hires :public Field_datetime_with_dec {
{
DBUG_ASSERT
(
dec
);
}
int
cmp
(
const
uchar
*
,
const
uchar
*
);
int
cmp
(
const
uchar
*
,
const
uchar
*
)
const
;
uint32
pack_length
()
const
{
return
Type_handler_datetime
::
hires_bytes
(
dec
);
}
bool
get_date
(
MYSQL_TIME
*
ltime
,
date_mode_t
fuzzydate
)
{
return
Field_datetime_hires
::
get_TIME
(
ltime
,
ptr
,
fuzzydate
);
}
...
...
@@ -3545,7 +3545,7 @@ class Field_datetimef :public Field_datetime_with_dec {
uint
tmp
=
my_datetime_binary_length
(
field_metadata
);
DBUG_RETURN
(
tmp
);
}
int
cmp
(
const
uchar
*
a_ptr
,
const
uchar
*
b_ptr
)
int
cmp
(
const
uchar
*
a_ptr
,
const
uchar
*
b_ptr
)
const
{
return
memcmp
(
a_ptr
,
b_ptr
,
pack_length
());
}
...
...
@@ -3657,7 +3657,7 @@ class Field_string :public Field_longstr {
longlong
val_int
(
void
);
String
*
val_str
(
String
*
,
String
*
);
my_decimal
*
val_decimal
(
my_decimal
*
);
int
cmp
(
const
uchar
*
,
const
uchar
*
);
int
cmp
(
const
uchar
*
,
const
uchar
*
)
const
;
void
sort_string
(
uchar
*
buff
,
uint
length
);
void
update_data_type_statistics
(
Data_type_statistics
*
st
)
const
{
...
...
@@ -3783,8 +3783,8 @@ class Field_varstring :public Field_longstr {
longlong
val_int
(
void
);
String
*
val_str
(
String
*
,
String
*
);
my_decimal
*
val_decimal
(
my_decimal
*
);
int
cmp_max
(
const
uchar
*
,
const
uchar
*
,
uint
max_length
);
int
cmp
(
const
uchar
*
a
,
const
uchar
*
b
)
int
cmp_max
(
const
uchar
*
,
const
uchar
*
,
uint
max_length
)
const
;
int
cmp
(
const
uchar
*
a
,
const
uchar
*
b
)
const
{
return
cmp_max
(
a
,
b
,
~
0U
);
}
...
...
@@ -3795,9 +3795,9 @@ class Field_varstring :public Field_longstr {
virtual
uchar
*
pack
(
uchar
*
to
,
const
uchar
*
from
,
uint
max_length
);
virtual
const
uchar
*
unpack
(
uchar
*
to
,
const
uchar
*
from
,
const
uchar
*
from_end
,
uint
param_data
);
int
cmp_binary
(
const
uchar
*
a
,
const
uchar
*
b
,
uint32
max_length
=~
0U
);
int
key_cmp
(
const
uchar
*
,
const
uchar
*
);
int
key_cmp
(
const
uchar
*
str
,
uint
length
);
int
cmp_binary
(
const
uchar
*
a
,
const
uchar
*
b
,
uint32
max_length
=~
0U
)
const
;
int
key_cmp
(
const
uchar
*
,
const
uchar
*
)
const
;
int
key_cmp
(
const
uchar
*
str
,
uint
length
)
const
;
uint
packed_col_length
(
const
uchar
*
to
,
uint
length
);
uint
max_packed_col_length
(
uint
max_length
);
uint32
data_length
();
...
...
@@ -3856,14 +3856,14 @@ class Field_varstring_compressed: public Field_varstring {
{
return
(
field_length
-
1
)
/
field_charset
->
mbmaxlen
;
}
int
cmp_max
(
const
uchar
*
a_ptr
,
const
uchar
*
b_ptr
,
uint
max_len
);
int
cmp_max
(
const
uchar
*
a_ptr
,
const
uchar
*
b_ptr
,
uint
max_len
)
const
;
/*
Compressed fields can't have keys as two rows may have different
compression methods or compression levels.
*/
int
key_cmp
(
const
uchar
*
str
,
uint
length
)
int
key_cmp
(
const
uchar
*
str
,
uint
length
)
const
{
DBUG_ASSERT
(
0
);
return
0
;
}
using
Field_varstring
::
key_cmp
;
};
...
...
@@ -4035,13 +4035,13 @@ class Field_blob :public Field_longstr {
longlong
val_int
(
void
);
String
*
val_str
(
String
*
,
String
*
);
my_decimal
*
val_decimal
(
my_decimal
*
);
int
cmp_max
(
const
uchar
*
,
const
uchar
*
,
uint
max_length
);
int
cmp
(
const
uchar
*
a
,
const
uchar
*
b
)
int
cmp_max
(
const
uchar
*
,
const
uchar
*
,
uint
max_length
)
const
;
int
cmp
(
const
uchar
*
a
,
const
uchar
*
b
)
const
{
return
cmp_max
(
a
,
b
,
~
0U
);
}
int
cmp
(
const
uchar
*
a
,
uint32
a_length
,
const
uchar
*
b
,
uint32
b_length
);
int
cmp_binary
(
const
uchar
*
a
,
const
uchar
*
b
,
uint32
max_length
=~
0U
);
int
key_cmp
(
const
uchar
*
,
const
uchar
*
);
int
key_cmp
(
const
uchar
*
str
,
uint
length
);
int
cmp
(
const
uchar
*
a
,
uint32
a_length
,
const
uchar
*
b
,
uint32
b_length
)
const
;
int
cmp_binary
(
const
uchar
*
a
,
const
uchar
*
b
,
uint32
max_length
=~
0U
)
const
;
int
key_cmp
(
const
uchar
*
,
const
uchar
*
)
const
;
int
key_cmp
(
const
uchar
*
str
,
uint
length
)
const
;
/* Never update the value of min_val for a blob field */
bool
update_min
(
Field
*
min_val
,
bool
force_update
)
{
return
FALSE
;
}
/* Never update the value of max_val for a blob field */
...
...
@@ -4219,9 +4219,9 @@ class Field_blob_compressed: public Field_blob {
{
DBUG_ASSERT
(
0
);
return
0
;
}
void
set_key_image
(
const
uchar
*
buff
,
uint
length
)
{
DBUG_ASSERT
(
0
);
}
int
key_cmp
(
const
uchar
*
a
,
const
uchar
*
b
)
int
key_cmp
(
const
uchar
*
a
,
const
uchar
*
b
)
const
{
DBUG_ASSERT
(
0
);
return
0
;
}
int
key_cmp
(
const
uchar
*
str
,
uint
length
)
int
key_cmp
(
const
uchar
*
str
,
uint
length
)
const
{
DBUG_ASSERT
(
0
);
return
0
;
}
Field
*
new_key_field
(
MEM_ROOT
*
root
,
TABLE
*
new_table
,
uchar
*
new_ptr
,
uint32
length
,
...
...
@@ -4232,6 +4232,7 @@ class Field_blob_compressed: public Field_blob {
class
Field_enum
:
public
Field_str
{
static
void
do_field_enum
(
Copy_field
*
copy_field
);
longlong
val_int
(
const
uchar
*
)
const
;
protected:
uint
packlength
;
public:
...
...
@@ -4297,7 +4298,7 @@ class Field_enum :public Field_str {
double
val_real
(
void
);
longlong
val_int
(
void
);
String
*
val_str
(
String
*
,
String
*
);
int
cmp
(
const
uchar
*
,
const
uchar
*
);
int
cmp
(
const
uchar
*
,
const
uchar
*
)
const
;
void
sort_string
(
uchar
*
buff
,
uint
length
);
uint32
pack_length
()
const
{
return
(
uint32
)
packlength
;
}
void
store_type
(
ulonglong
value
);
...
...
@@ -4444,7 +4445,7 @@ class Field_bit :public Field {
virtual
bool
str_needs_quotes
()
{
return
TRUE
;
}
my_decimal
*
val_decimal
(
my_decimal
*
);
bool
val_bool
()
{
return
val_int
()
!=
0
;
}
int
cmp
(
const
uchar
*
a
,
const
uchar
*
b
)
virtual
int
cmp
(
const
uchar
*
a
,
const
uchar
*
b
)
const
{
DBUG_ASSERT
(
ptr
==
a
||
ptr
==
b
);
if
(
ptr
==
a
)
...
...
@@ -4454,10 +4455,10 @@ class Field_bit :public Field {
}
int
cmp_binary_offset
(
uint
row_offset
)
{
return
cmp_offset
(
row_offset
);
}
int
cmp_max
(
const
uchar
*
a
,
const
uchar
*
b
,
uint
max_length
);
int
key_cmp
(
const
uchar
*
a
,
const
uchar
*
b
)
int
cmp_max
(
const
uchar
*
a
,
const
uchar
*
b
,
uint
max_length
)
const
;
int
key_cmp
(
const
uchar
*
a
,
const
uchar
*
b
)
const
{
return
cmp_binary
((
uchar
*
)
a
,
(
uchar
*
)
b
);
}
int
key_cmp
(
const
uchar
*
str
,
uint
length
);
int
key_cmp
(
const
uchar
*
str
,
uint
length
)
const
;
int
cmp_offset
(
my_ptrdiff_t
row_offset
);
bool
update_min
(
Field
*
min_val
,
bool
force_update
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment