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
5876acb3
Commit
5876acb3
authored
Nov 24, 2020
by
Varun Gupta
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more changes
parent
074712ab
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
17 deletions
+48
-17
sql/uniques.cc
sql/uniques.cc
+32
-7
sql/uniques.h
sql/uniques.h
+16
-10
No files found.
sql/uniques.cc
View file @
5876acb3
...
@@ -964,8 +964,8 @@ uint Variable_size_keys_descriptor::make_packed_record(bool exclude_nulls)
...
@@ -964,8 +964,8 @@ uint Variable_size_keys_descriptor::make_packed_record(bool exclude_nulls)
*/
*/
bool
bool
D
escriptor
::
setup
(
THD
*
thd
,
Item_sum
*
item
,
Variable_size_keys_d
escriptor
::
setup
(
THD
*
thd
,
Item_sum
*
item
,
uint
non_const_args
,
uint
arg_count
)
uint
non_const_args
,
uint
arg_count
)
{
{
SORT_FIELD
*
sort
,
*
pos
;
SORT_FIELD
*
sort
,
*
pos
;
if
(
sortorder
)
if
(
sortorder
)
...
@@ -1010,7 +1010,7 @@ Descriptor::setup(THD *thd, Item_sum *item,
...
@@ -1010,7 +1010,7 @@ Descriptor::setup(THD *thd, Item_sum *item,
FALSE setup successful
FALSE setup successful
*/
*/
bool
D
escriptor
::
setup
(
THD
*
thd
,
Field
*
field
)
bool
Variable_size_keys_d
escriptor
::
setup
(
THD
*
thd
,
Field
*
field
)
{
{
SORT_FIELD
*
sort
,
*
pos
;
SORT_FIELD
*
sort
,
*
pos
;
if
(
sortorder
)
if
(
sortorder
)
...
@@ -1026,7 +1026,6 @@ bool Descriptor::setup(THD *thd, Field *field)
...
@@ -1026,7 +1026,6 @@ bool Descriptor::setup(THD *thd, Field *field)
return
true
;
return
true
;
sort
=
pos
=
sortorder
;
sort
=
pos
=
sortorder
;
pos
->
setup
(
field
,
false
);
// Nulls are always excluded
pos
->
setup
(
field
,
false
);
// Nulls are always excluded
return
false
;
return
false
;
}
}
...
@@ -1053,18 +1052,44 @@ int Variable_size_keys_descriptor::compare_keys(uchar *a_ptr,
...
@@ -1053,18 +1052,44 @@ int Variable_size_keys_descriptor::compare_keys(uchar *a_ptr,
}
}
int
Variable_size_keys_simple
::
compare_keys
(
uchar
*
a
,
uchar
*
b
)
{
return
sort_keys
->
compare_keys_for_single_arg
(
a
+
size_of_length_field
,
b
+
size_of_length_field
);
}
Variable_size_keys_simple
::
Variable_size_keys_simple
(
uint
length
)
Variable_size_keys_simple
::
Variable_size_keys_simple
(
uint
length
)
:
Variable_size_keys_descriptor
(
length
)
:
Variable_size_keys_descriptor
(
length
)
{}
int
Fixed_size_keys_simple
::
compare_keys
(
uchar
*
a
,
uchar
*
b
)
{
SORT_FIELD
*
sort_field
=
sort_keys
->
begin
();
DBUG_ASSERT
(
sort_field
->
field
);
return
sort_field
->
field
->
cmp
(
a
,
b
);
}
bool
Fixed_size_keys_descriptor
::
setup
(
THD
*
thd
,
Item_sum
*
item
,
uint
non_const_args
,
uint
arg_count
)
{
{
return
false
;
}
bool
Fixed_size_keys_descriptor
::
setup
(
THD
*
thd
,
Field
*
field
)
{
return
false
;
}
}
int
Variable_size_keys_simple
::
compare_keys
(
uchar
*
a
,
uchar
*
b
)
int
Fixed_size_keys_descriptor
::
compare_keys
(
uchar
*
a
,
uchar
*
b
)
{
{
return
sort_keys
->
compare_keys_for_single_arg
(
a
+
size_of_length_field
,
return
0
;
b
+
size_of_length_field
);
}
}
...
...
sql/uniques.h
View file @
5876acb3
...
@@ -59,8 +59,8 @@ class Descriptor : public Sql_alloc
...
@@ -59,8 +59,8 @@ class Descriptor : public Sql_alloc
// Fill structures like sort_keys, sortorder
// Fill structures like sort_keys, sortorder
virtual
bool
setup
(
THD
*
thd
,
Item_sum
*
item
,
virtual
bool
setup
(
THD
*
thd
,
Item_sum
*
item
,
uint
non_const_args
,
uint
arg_count
)
;
uint
non_const_args
,
uint
arg_count
)
{
return
false
;
}
virtual
bool
setup
(
THD
*
thd
,
Field
*
field
)
;
virtual
bool
setup
(
THD
*
thd
,
Field
*
field
)
{
return
false
;
}
virtual
Sort_keys
*
get_keys
()
{
return
sort_keys
;
}
virtual
Sort_keys
*
get_keys
()
{
return
sort_keys
;
}
SORT_FIELD
*
get_sortorder
()
{
return
sortorder
;
}
SORT_FIELD
*
get_sortorder
()
{
return
sortorder
;
}
...
@@ -79,16 +79,19 @@ class Fixed_size_keys_descriptor : public Descriptor
...
@@ -79,16 +79,19 @@ class Fixed_size_keys_descriptor : public Descriptor
Fixed_size_keys_descriptor
(
uint
length
);
Fixed_size_keys_descriptor
(
uint
length
);
~
Fixed_size_keys_descriptor
()
{}
~
Fixed_size_keys_descriptor
()
{}
uint
get_length_of_key
(
uchar
*
ptr
)
override
{
return
max_length
;
}
uint
get_length_of_key
(
uchar
*
ptr
)
override
{
return
max_length
;
}
virtual
int
compare_keys
(
uchar
*
a
,
uchar
*
b
)
override
{
return
0
;
}
bool
setup
(
THD
*
thd
,
Field
*
field
);
bool
setup
(
THD
*
thd
,
Item_sum
*
item
,
uint
non_const_args
,
uint
arg_count
);
virtual
int
compare_keys
(
uchar
*
a
,
uchar
*
b
)
override
;
};
};
class
Fixed_size_keys_simple
_descriptor
:
public
Fixed_size_keys_descriptor
class
Fixed_size_keys_simple
:
public
Fixed_size_keys_descriptor
{
{
public:
public:
Fixed_size_keys_simple
_descriptor
(
uint
length
);
Fixed_size_keys_simple
(
uint
length
);
~
Fixed_size_keys_simple
_descriptor
()
{}
~
Fixed_size_keys_simple
()
{}
int
compare_keys
(
uchar
*
a
,
uchar
*
b
)
override
{
return
0
;
}
int
compare_keys
(
uchar
*
a
,
uchar
*
b
)
override
;
};
};
...
@@ -110,17 +113,18 @@ class Variable_size_keys_descriptor : public Descriptor
...
@@ -110,17 +113,18 @@ class Variable_size_keys_descriptor : public Descriptor
Variable_size_keys_descriptor
(
uint
length
);
Variable_size_keys_descriptor
(
uint
length
);
~
Variable_size_keys_descriptor
();
~
Variable_size_keys_descriptor
();
uchar
*
get_packed_rec_ptr
()
{
return
packed_rec_ptr
;
}
Sort_keys
*
get_keys
()
{
return
sort_keys
;
}
Sort_keys
*
get_keys
()
{
return
sort_keys
;
}
SORT_FIELD
*
get_sortorder
()
{
return
sortorder
;
}
SORT_FIELD
*
get_sortorder
()
{
return
sortorder
;
}
bool
setup
(
THD
*
thd
,
Item_sum
*
item
,
uint
non_const_args
,
uint
arg_count
);
uint
make_packed_record
(
bool
exclude_nulls
);
bool
setup
(
THD
*
thd
,
Field
*
field
);
uint
get_length_of_key
(
uchar
*
ptr
)
override
uint
get_length_of_key
(
uchar
*
ptr
)
override
{
{
return
read_packed_length
(
ptr
);
return
read_packed_length
(
ptr
);
}
}
int
compare_keys
(
uchar
*
a
,
uchar
*
b
)
override
;
int
compare_keys
(
uchar
*
a
,
uchar
*
b
)
override
;
// All need to be moved to some new class
// returns the length of the key along with the length bytes for the key
// returns the length of the key along with the length bytes for the key
static
uint
read_packed_length
(
uchar
*
p
)
static
uint
read_packed_length
(
uchar
*
p
)
{
{
...
@@ -132,6 +136,8 @@ class Variable_size_keys_descriptor : public Descriptor
...
@@ -132,6 +136,8 @@ class Variable_size_keys_descriptor : public Descriptor
}
}
static
const
uint
size_of_length_field
=
4
;
static
const
uint
size_of_length_field
=
4
;
uchar
*
get_packed_rec_ptr
()
{
return
packed_rec_ptr
;
}
uint
make_packed_record
(
bool
exclude_nulls
);
};
};
...
...
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