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
19163841
Commit
19163841
authored
May 10, 2017
by
Alexander Barkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-12772 Add Field::get_typelib() and Item::get_typelib()
parent
0f642188
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
11 deletions
+14
-11
sql/field.h
sql/field.h
+2
-0
sql/item.cc
sql/item.cc
+4
-11
sql/item.h
sql/item.h
+7
-0
sql/item_sum.h
sql/item_sum.h
+1
-0
No files found.
sql/field.h
View file @
19163841
...
...
@@ -1289,6 +1289,7 @@ class Field: public Value_source
uint
fill_cache_field
(
struct
st_cache_field
*
copy
);
virtual
bool
get_date
(
MYSQL_TIME
*
ltime
,
ulonglong
fuzzydate
);
bool
get_time
(
MYSQL_TIME
*
ltime
)
{
return
get_date
(
ltime
,
TIME_TIME_ONLY
);
}
virtual
TYPELIB
*
get_typelib
()
const
{
return
NULL
;
}
virtual
CHARSET_INFO
*
charset
(
void
)
const
{
return
&
my_charset_bin
;
}
virtual
CHARSET_INFO
*
charset_for_protocol
(
void
)
const
{
return
binary
()
?
&
my_charset_bin
:
charset
();
}
...
...
@@ -3547,6 +3548,7 @@ class Field_enum :public Field_str {
/* enum and set are sorted as integers */
CHARSET_INFO
*
sort_charset
(
void
)
const
{
return
&
my_charset_bin
;
}
uint
decimals
()
const
{
return
0
;
}
TYPELIB
*
get_typelib
()
const
{
return
typelib
;
}
virtual
uchar
*
pack
(
uchar
*
to
,
const
uchar
*
from
,
uint
max_length
);
virtual
const
uchar
*
unpack
(
uchar
*
to
,
const
uchar
*
from
,
...
...
sql/item.cc
View file @
19163841
...
...
@@ -9986,21 +9986,14 @@ void Item_type_holder::get_full_info(Item *item)
if
(
Item_type_holder
::
real_type_handler
()
==
&
type_handler_enum
||
Item_type_holder
::
real_type_handler
()
==
&
type_handler_set
)
{
if
(
item
->
type
()
==
Item
::
SUM_FUNC_ITEM
&&
(((
Item_sum
*
)
item
)
->
sum_func
()
==
Item_sum
::
MAX_FUNC
||
((
Item_sum
*
)
item
)
->
sum_func
()
==
Item_sum
::
MIN_FUNC
))
item
=
((
Item_sum
*
)
item
)
->
get_arg
(
0
);
TYPELIB
*
item_typelib
=
item
->
get_typelib
();
/*
We can have enum/set type after merging only if we have one enum|set
field (or MIN|MAX(enum|set field)) and number of NULL fields
*/
DBUG_ASSERT
((
enum_set_typelib
&&
item
->
real_type_handler
()
==
&
type_handler_null
)
||
(
!
enum_set_typelib
&&
item
->
real_item
()
->
type
()
==
Item
::
FIELD_ITEM
&&
(
item
->
real_type_handler
()
==
&
type_handler_enum
||
item
->
real_type_handler
()
==
&
type_handler_set
)
&&
((
Field_enum
*
)((
Item_field
*
)
item
->
real_item
())
->
field
)
->
typelib
));
DBUG_ASSERT
(
item
->
real_type_handler
()
==
&
type_handler_null
||
(
enum_set_typelib
&&
!
item_typelib
)
||
(
!
enum_set_typelib
&&
item_typelib
));
if
(
!
enum_set_typelib
)
{
enum_set_typelib
=
((
Field_enum
*
)((
Item_field
*
)
item
->
real_item
())
->
field
)
->
typelib
;
...
...
sql/item.h
View file @
19163841
...
...
@@ -787,6 +787,7 @@ class Item: public Value_source,
{
return
type_handler
()
->
max_display_length
(
this
);
}
virtual
TYPELIB
*
get_typelib
()
const
{
return
NULL
;
}
Item_cache
*
get_cache
(
THD
*
thd
)
const
{
return
type_handler
()
->
Item_get_cache
(
thd
,
this
);
...
...
@@ -2682,6 +2683,7 @@ class Item_field :public Item_ident
return
&
type_handler_null
;
return
field
->
type_handler
();
}
TYPELIB
*
get_typelib
()
const
{
return
field
->
get_typelib
();
}
enum_monotonicity_info
get_monotonicity_info
()
const
{
return
MONOTONIC_STRICT_INCREASING
;
...
...
@@ -4321,6 +4323,11 @@ class Item_ref :public Item_ident
{
return
ref
?
(
*
ref
)
->
real_item
()
:
this
;
}
TYPELIB
*
get_typelib
()
const
{
return
ref
?
(
*
ref
)
->
get_typelib
()
:
NULL
;
}
bool
walk
(
Item_processor
processor
,
bool
walk_subquery
,
void
*
arg
)
{
if
(
ref
&&
*
ref
)
...
...
sql/item_sum.h
View file @
19163841
...
...
@@ -1044,6 +1044,7 @@ class Item_sum_hybrid :public Item_sum, public Type_handler_hybrid_field_type
}
const
Type_handler
*
type_handler
()
const
{
return
Type_handler_hybrid_field_type
::
type_handler
();
}
TYPELIB
*
get_typelib
()
const
{
return
args
[
0
]
->
get_typelib
();
}
void
update_field
();
void
min_max_update_str_field
();
void
min_max_update_real_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