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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
2510f9c6
Commit
2510f9c6
authored
Jun 09, 2014
by
Sergei Golubchik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleanup: remove special case from store_key::store_key(), add Field_blob::new_key_field
(prep for MDEV-6065)
parent
dc9b2a95
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
42 additions
and
40 deletions
+42
-40
sql/field.cc
sql/field.cc
+25
-19
sql/field.h
sql/field.h
+13
-6
sql/opt_subselect.cc
sql/opt_subselect.cc
+1
-0
sql/sql_select.cc
sql/sql_select.cc
+1
-0
sql/sql_select.h
sql/sql_select.h
+2
-15
No files found.
sql/field.cc
View file @
2510f9c6
...
...
@@ -1965,8 +1965,8 @@ Field *Field::new_field(MEM_ROOT *root, TABLE *new_table,
Field
*
Field
::
new_key_field
(
MEM_ROOT
*
root
,
TABLE
*
new_table
,
uchar
*
new_ptr
,
u
char
*
new_null_ptr
,
uint
new_null_bit
)
uchar
*
new_ptr
,
u
int32
length
,
u
char
*
new_null_ptr
,
u
int
new_null_bit
)
{
Field
*
tmp
;
if
((
tmp
=
new_field
(
root
,
new_table
,
table
==
new_table
)))
...
...
@@ -7204,17 +7204,14 @@ Field *Field_varstring::new_field(MEM_ROOT *root, TABLE *new_table,
}
Field
*
Field_varstring
::
new_key_field
(
MEM_ROOT
*
root
,
TABLE
*
new_table
,
uchar
*
new_ptr
,
uchar
*
new_null_ptr
,
uint
new_null_bit
)
Field
*
Field_varstring
::
new_key_field
(
MEM_ROOT
*
root
,
TABLE
*
new_table
,
uchar
*
new_ptr
,
uint32
length
,
uchar
*
new_null_ptr
,
uint
new_null_bit
)
{
Field_varstring
*
res
;
if
((
res
=
(
Field_varstring
*
)
Field
::
new_key_field
(
root
,
new_table
,
new_ptr
,
new_null_ptr
,
new_null_bit
)))
if
((
res
=
(
Field_varstring
*
)
Field
::
new_key_field
(
root
,
new_table
,
new_ptr
,
length
,
new_null_ptr
,
new_null_bit
)))
{
/* Keys length prefixes are always packed with 2 bytes */
res
->
length_bytes
=
2
;
...
...
@@ -7222,7 +7219,6 @@ Field *Field_varstring::new_key_field(MEM_ROOT *root,
return
res
;
}
uint
Field_varstring
::
is_equal
(
Create_field
*
new_field
)
{
if
(
new_field
->
sql_type
==
real_type
()
&&
...
...
@@ -7579,6 +7575,18 @@ int Field_blob::key_cmp(const uchar *a,const uchar *b)
}
Field
*
Field_blob
::
new_key_field
(
MEM_ROOT
*
root
,
TABLE
*
new_table
,
uchar
*
new_ptr
,
uint32
length
,
uchar
*
new_null_ptr
,
uint
new_null_bit
)
{
Field_varstring
*
res
=
new
(
root
)
Field_varstring
(
new_ptr
,
length
,
2
,
new_null_ptr
,
new_null_bit
,
Field
::
NONE
,
field_name
,
table
->
s
,
charset
());
res
->
init
(
new_table
);
return
res
;
}
/**
Save the field metadata for blob fields.
...
...
@@ -8426,15 +8434,13 @@ Field_bit::do_last_null_byte() const
}
Field
*
Field_bit
::
new_key_field
(
MEM_ROOT
*
root
,
TABLE
*
new_table
,
uchar
*
new_ptr
,
uchar
*
new_null_ptr
,
uint
new_null_bit
)
Field
*
Field_bit
::
new_key_field
(
MEM_ROOT
*
root
,
TABLE
*
new_table
,
uchar
*
new_ptr
,
uint32
length
,
uchar
*
new_null_ptr
,
uint
new_null_bit
)
{
Field_bit
*
res
;
if
((
res
=
(
Field_bit
*
)
Field
::
new_key_field
(
root
,
new_table
,
new_ptr
,
new_null_ptr
,
new_null_bit
)))
if
((
res
=
(
Field_bit
*
)
Field
::
new_key_field
(
root
,
new_table
,
new_ptr
,
length
,
new_null_ptr
,
new_null_bit
)))
{
/* Move bits normally stored in null_pointer to new_ptr */
res
->
bit_ptr
=
new_ptr
;
...
...
sql/field.h
View file @
2510f9c6
...
...
@@ -253,9 +253,13 @@ class Field
Field
(
const
Item
&
);
/* Prevent use of these */
void
operator
=
(
Field
&
);
public:
static
void
*
operator
new
(
size_t
size
,
MEM_ROOT
*
mem_root
)
throw
()
{
return
alloc_root
(
mem_root
,
size
);
}
static
void
*
operator
new
(
size_t
size
)
throw
()
{
return
sql_alloc
(
size
);
}
static
void
operator
delete
(
void
*
ptr_arg
,
size_t
size
)
{
TRASH
(
ptr_arg
,
size
);
}
static
void
operator
delete
(
void
*
ptr
,
MEM_ROOT
*
mem_root
)
{
DBUG_ASSERT
(
0
);
}
uchar
*
ptr
;
// Position to field in record
/**
...
...
@@ -709,8 +713,8 @@ public:
virtual
Field
*
new_field
(
MEM_ROOT
*
root
,
TABLE
*
new_table
,
bool
keep_type
);
virtual
Field
*
new_key_field
(
MEM_ROOT
*
root
,
TABLE
*
new_table
,
uchar
*
new_ptr
,
u
char
*
new_null_ptr
,
uint
new_null_bit
);
uchar
*
new_ptr
,
u
int32
length
,
u
char
*
new_null_ptr
,
u
int
new_null_bit
);
Field
*
clone
(
MEM_ROOT
*
mem_root
,
TABLE
*
new_table
);
Field
*
clone
(
MEM_ROOT
*
mem_root
,
TABLE
*
new_table
,
my_ptrdiff_t
diff
,
bool
stat_flag
=
FALSE
);
...
...
@@ -2323,8 +2327,8 @@ public:
{
return
charset
()
==
&
my_charset_bin
?
FALSE
:
TRUE
;
}
Field
*
new_field
(
MEM_ROOT
*
root
,
TABLE
*
new_table
,
bool
keep_type
);
Field
*
new_key_field
(
MEM_ROOT
*
root
,
TABLE
*
new_table
,
uchar
*
new_ptr
,
u
char
*
new_null_ptr
,
uint
new_null_bit
);
uchar
*
new_ptr
,
u
int32
length
,
u
char
*
new_null_ptr
,
u
int
new_null_bit
);
uint
is_equal
(
Create_field
*
new_field
);
void
hash
(
ulong
*
nr
,
ulong
*
nr2
);
uint
length_size
()
{
return
length_bytes
;
}
...
...
@@ -2457,6 +2461,9 @@ public:
}
uint
get_key_image
(
uchar
*
buff
,
uint
length
,
imagetype
type
);
void
set_key_image
(
const
uchar
*
buff
,
uint
length
);
Field
*
new_key_field
(
MEM_ROOT
*
root
,
TABLE
*
new_table
,
uchar
*
new_ptr
,
uint32
length
,
uchar
*
new_null_ptr
,
uint
new_null_bit
);
void
sql_type
(
String
&
str
)
const
;
inline
bool
copy
()
{
...
...
@@ -2727,8 +2734,8 @@ public:
virtual
void
set_default
();
Field
*
new_key_field
(
MEM_ROOT
*
root
,
TABLE
*
new_table
,
uchar
*
new_ptr
,
u
char
*
new_null_ptr
,
uint
new_null_bit
);
uchar
*
new_ptr
,
u
int32
length
,
u
char
*
new_null_ptr
,
u
int
new_null_bit
);
void
set_bit_ptr
(
uchar
*
bit_ptr_arg
,
uchar
bit_ofs_arg
)
{
bit_ptr
=
bit_ptr_arg
;
...
...
sql/opt_subselect.cc
View file @
2510f9c6
...
...
@@ -4120,6 +4120,7 @@ SJ_TMP_TABLE::create_sj_weedout_tmp_table(THD *thd)
{
if
(
!
(
key_field
=
field
->
new_key_field
(
thd
->
mem_root
,
table
,
group_buff
,
key_part_info
->
length
,
field
->
null_ptr
,
field
->
null_bit
)))
goto
err
;
...
...
sql/sql_select.cc
View file @
2510f9c6
...
...
@@ -16204,6 +16204,7 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List<Item> &fields,
if
(
!
(
cur_group
->
field
=
field
->
new_key_field
(
thd
->
mem_root
,
table
,
group_buff
+
MY_TEST
(
maybe_null
),
key_part_info
->
length
,
field
->
null_ptr
,
field
->
null_bit
)))
goto
err
;
/* purecov: inspected */
...
...
sql/sql_select.h
View file @
2510f9c6
...
...
@@ -1548,21 +1548,8 @@ public:
store_key
(
THD
*
thd
,
Field
*
field_arg
,
uchar
*
ptr
,
uchar
*
null
,
uint
length
)
:
null_key
(
0
),
null_ptr
(
null
),
err
(
0
)
{
if
(
field_arg
->
type
()
==
MYSQL_TYPE_BLOB
||
field_arg
->
type
()
==
MYSQL_TYPE_GEOMETRY
)
{
/*
Key segments are always packed with a 2 byte length prefix.
See mi_rkey for details.
*/
to_field
=
new
Field_varstring
(
ptr
,
length
,
2
,
null
,
1
,
Field
::
NONE
,
field_arg
->
field_name
,
field_arg
->
table
->
s
,
field_arg
->
charset
());
to_field
->
init
(
field_arg
->
table
);
}
else
to_field
=
field_arg
->
new_key_field
(
thd
->
mem_root
,
field_arg
->
table
,
ptr
,
null
,
1
);
to_field
=
field_arg
->
new_key_field
(
thd
->
mem_root
,
field_arg
->
table
,
ptr
,
length
,
null
,
1
);
}
store_key
(
store_key
&
arg
)
:
Sql_alloc
(),
null_key
(
arg
.
null_key
),
to_field
(
arg
.
to_field
),
...
...
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