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
6be67860
Commit
6be67860
authored
Dec 05, 2016
by
Alexander Barkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-11330 Split Item_func_hybrid_field_type::val_xxx() into methods in Type_handler
parent
69f80e5e
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
611 additions
and
215 deletions
+611
-215
sql/item_func.cc
sql/item_func.cc
+168
-209
sql/item_func.h
sql/item_func.h
+88
-5
sql/sql_type.cc
sql/sql_type.cc
+242
-1
sql/sql_type.h
sql/sql_type.h
+113
-0
No files found.
sql/item_func.cc
View file @
6be67860
...
...
@@ -828,237 +828,196 @@ void Item_func_num1::fix_length_and_dec()
}
String
*
Item_func_hybrid_field_type
::
val_str
(
String
*
str
)
String
*
Item_func_hybrid_field_type
::
val_str_from_decimal_op
(
String
*
str
)
{
my_decimal
decimal_value
,
*
val
;
if
(
!
(
val
=
decimal_op_with_null_check
(
&
decimal_value
)))
return
0
;
// null is set
DBUG_ASSERT
(
!
null_value
);
my_decimal_round
(
E_DEC_FATAL_ERROR
,
val
,
decimals
,
FALSE
,
val
);
str
->
set_charset
(
collation
.
collation
);
my_decimal2string
(
E_DEC_FATAL_ERROR
,
val
,
0
,
0
,
0
,
str
);
return
str
;
}
double
Item_func_hybrid_field_type
::
val_real_from_decimal_op
()
{
DBUG_ASSERT
(
fixed
==
1
);
switch
(
Item_func_hybrid_field_type
::
cmp_type
())
{
case
DECIMAL_RESULT
:
{
my_decimal
decimal_value
,
*
val
;
if
(
!
(
val
=
decimal_op_with_null_check
(
&
decimal_value
)))
return
0
;
// null is set
my_decimal_round
(
E_DEC_FATAL_ERROR
,
val
,
decimals
,
FALSE
,
val
);
str
->
set_charset
(
collation
.
collation
);
my_decimal2string
(
E_DEC_FATAL_ERROR
,
val
,
0
,
0
,
0
,
str
);
break
;
}
case
INT_RESULT
:
{
longlong
nr
=
int_op
();
if
(
null_value
)
return
0
;
/* purecov: inspected */
str
->
set_int
(
nr
,
unsigned_flag
,
collation
.
collation
);
break
;
}
case
REAL_RESULT
:
{
double
nr
=
real_op
();
if
(
null_value
)
return
0
;
/* purecov: inspected */
str
->
set_real
(
nr
,
decimals
,
collation
.
collation
);
break
;
}
case
TIME_RESULT
:
{
MYSQL_TIME
ltime
;
if
(
date_op_with_null_check
(
&
ltime
)
||
(
null_value
=
str
->
alloc
(
MAX_DATE_STRING_REP_LENGTH
)))
return
(
String
*
)
0
;
ltime
.
time_type
=
mysql_type_to_time_type
(
field_type
());
str
->
length
(
my_TIME_to_str
(
&
ltime
,
const_cast
<
char
*>
(
str
->
ptr
()),
decimals
));
str
->
set_charset
(
&
my_charset_bin
);
DBUG_ASSERT
(
!
null_value
);
return
str
;
}
case
STRING_RESULT
:
return
str_op_with_null_check
(
&
str_value
);
case
ROW_RESULT
:
DBUG_ASSERT
(
0
);
}
DBUG_ASSERT
(
!
null_value
||
(
str
==
NULL
));
my_decimal
decimal_value
,
*
val
;
if
(
!
(
val
=
decimal_op_with_null_check
(
&
decimal_value
)))
return
0.0
;
// null is set
double
result
;
my_decimal2double
(
E_DEC_FATAL_ERROR
,
val
,
&
result
);
return
result
;
}
longlong
Item_func_hybrid_field_type
::
val_int_from_decimal_op
()
{
my_decimal
decimal_value
,
*
val
;
if
(
!
(
val
=
decimal_op_with_null_check
(
&
decimal_value
)))
return
0
;
// null is set
longlong
result
;
my_decimal2int
(
E_DEC_FATAL_ERROR
,
val
,
unsigned_flag
,
&
result
);
return
result
;
}
bool
Item_func_hybrid_field_type
::
get_date_from_decimal_op
(
MYSQL_TIME
*
ltime
,
ulonglong
fuzzydate
)
{
my_decimal
value
,
*
res
;
if
(
!
(
res
=
decimal_op_with_null_check
(
&
value
))
||
decimal_to_datetime_with_warn
(
res
,
ltime
,
fuzzydate
,
field_name_or_null
()))
return
make_zero_mysql_time
(
ltime
,
fuzzydate
);
return
(
null_value
=
0
);
}
String
*
Item_func_hybrid_field_type
::
val_str_from_int_op
(
String
*
str
)
{
longlong
nr
=
int_op
();
if
(
null_value
)
return
0
;
/* purecov: inspected */
str
->
set_int
(
nr
,
unsigned_flag
,
collation
.
collation
);
return
str
;
}
double
Item_func_hybrid_field_type
::
val_real_from_int_op
()
{
longlong
result
=
int_op
();
return
unsigned_flag
?
(
double
)
((
ulonglong
)
result
)
:
(
double
)
result
;
}
my_decimal
*
Item_func_hybrid_field_type
::
val_decimal_from_int_op
(
my_decimal
*
dec
)
{
longlong
result
=
int_op
();
if
(
null_value
)
return
NULL
;
int2my_decimal
(
E_DEC_FATAL_ERROR
,
result
,
unsigned_flag
,
dec
);
return
dec
;
}
double
Item_func_hybrid_field_type
::
val_real
()
bool
Item_func_hybrid_field_type
::
get_date_from_int_op
(
MYSQL_TIME
*
ltime
,
ulonglong
fuzzydate
)
{
DBUG_ASSERT
(
fixed
==
1
);
switch
(
Item_func_hybrid_field_type
::
cmp_type
())
{
case
DECIMAL_RESULT
:
{
my_decimal
decimal_value
,
*
val
;
double
result
;
if
(
!
(
val
=
decimal_op_with_null_check
(
&
decimal_value
)))
return
0.0
;
// null is set
my_decimal2double
(
E_DEC_FATAL_ERROR
,
val
,
&
result
);
return
result
;
}
case
INT_RESULT
:
{
longlong
result
=
int_op
();
return
unsigned_flag
?
(
double
)
((
ulonglong
)
result
)
:
(
double
)
result
;
}
case
REAL_RESULT
:
return
real_op
();
case
TIME_RESULT
:
{
MYSQL_TIME
ltime
;
if
(
date_op_with_null_check
(
&
ltime
))
return
0
;
ltime
.
time_type
=
mysql_type_to_time_type
(
field_type
());
return
TIME_to_double
(
&
ltime
);
}
case
STRING_RESULT
:
{
String
*
res
=
str_op_with_null_check
(
&
str_value
);
return
res
?
double_from_string_with_check
(
res
)
:
0.0
;
}
case
ROW_RESULT
:
DBUG_ASSERT
(
0
);
}
return
0.0
;
longlong
value
=
int_op
();
bool
neg
=
!
unsigned_flag
&&
value
<
0
;
if
(
null_value
||
int_to_datetime_with_warn
(
neg
,
neg
?
-
value
:
value
,
ltime
,
fuzzydate
,
field_name_or_null
()))
return
make_zero_mysql_time
(
ltime
,
fuzzydate
);
return
(
null_value
=
0
);
}
longlong
Item_func_hybrid_field_type
::
val_int
(
)
String
*
Item_func_hybrid_field_type
::
val_str_from_real_op
(
String
*
str
)
{
DBUG_ASSERT
(
fixed
==
1
);
switch
(
Item_func_hybrid_field_type
::
cmp_type
())
{
case
DECIMAL_RESULT
:
{
my_decimal
decimal_value
,
*
val
;
if
(
!
(
val
=
decimal_op_with_null_check
(
&
decimal_value
)))
return
0
;
// null is set
longlong
result
;
my_decimal2int
(
E_DEC_FATAL_ERROR
,
val
,
unsigned_flag
,
&
result
);
return
result
;
}
case
INT_RESULT
:
return
int_op
();
case
REAL_RESULT
:
return
(
longlong
)
rint
(
real_op
());
case
TIME_RESULT
:
{
MYSQL_TIME
ltime
;
if
(
date_op_with_null_check
(
&
ltime
))
return
0
;
ltime
.
time_type
=
mysql_type_to_time_type
(
field_type
());
return
TIME_to_ulonglong
(
&
ltime
);
}
case
STRING_RESULT
:
{
String
*
res
=
str_op_with_null_check
(
&
str_value
);
return
res
?
longlong_from_string_with_check
(
res
)
:
0
;
}
case
ROW_RESULT
:
DBUG_ASSERT
(
0
);
}
return
0
;
double
nr
=
real_op
();
if
(
null_value
)
return
0
;
/* purecov: inspected */
str
->
set_real
(
nr
,
decimals
,
collation
.
collation
);
return
str
;
}
longlong
Item_func_hybrid_field_type
::
val_int_from_real_op
()
{
return
(
longlong
)
rint
(
real_op
());
}
my_decimal
*
Item_func_hybrid_field_type
::
val_decimal
(
my_decimal
*
decimal_value
)
my_decimal
*
Item_func_hybrid_field_type
::
val_decimal_from_real_op
(
my_decimal
*
dec
)
{
my_decimal
*
val
=
decimal_value
;
DBUG_ASSERT
(
fixed
==
1
);
switch
(
Item_func_hybrid_field_type
::
cmp_type
())
{
case
DECIMAL_RESULT
:
val
=
decimal_op_with_null_check
(
decimal_value
);
break
;
case
INT_RESULT
:
{
longlong
result
=
int_op
();
if
(
null_value
)
return
NULL
;
int2my_decimal
(
E_DEC_FATAL_ERROR
,
result
,
unsigned_flag
,
decimal_value
);
break
;
}
case
REAL_RESULT
:
{
double
result
=
(
double
)
real_op
();
if
(
null_value
)
return
NULL
;
double2my_decimal
(
E_DEC_FATAL_ERROR
,
result
,
decimal_value
);
break
;
}
case
TIME_RESULT
:
{
MYSQL_TIME
ltime
;
if
(
date_op_with_null_check
(
&
ltime
))
{
my_decimal_set_zero
(
decimal_value
);
return
0
;
}
ltime
.
time_type
=
mysql_type_to_time_type
(
field_type
());
return
date2my_decimal
(
&
ltime
,
decimal_value
);
}
case
STRING_RESULT
:
{
String
*
res
=
str_op_with_null_check
(
&
str_value
);
return
res
?
decimal_from_string_with_check
(
decimal_value
,
res
)
:
0
;
}
case
ROW_RESULT
:
DBUG_ASSERT
(
0
);
}
return
val
;
double
result
=
(
double
)
real_op
();
if
(
null_value
)
return
NULL
;
double2my_decimal
(
E_DEC_FATAL_ERROR
,
result
,
dec
);
return
dec
;
}
bool
Item_func_hybrid_field_type
::
get_date_from_real_op
(
MYSQL_TIME
*
ltime
,
ulonglong
fuzzydate
)
{
double
value
=
real_op
();
if
(
null_value
||
double_to_datetime_with_warn
(
value
,
ltime
,
fuzzydate
,
field_name_or_null
()))
return
make_zero_mysql_time
(
ltime
,
fuzzydate
);
return
(
null_value
=
0
);
}
bool
Item_func_hybrid_field_type
::
get_date
(
MYSQL_TIME
*
ltime
,
ulonglong
fuzzydate
)
String
*
Item_func_hybrid_field_type
::
val_str_from_date_op
(
String
*
str
)
{
DBUG_ASSERT
(
fixed
==
1
);
switch
(
Item_func_hybrid_field_type
::
cmp_type
())
{
case
DECIMAL_RESULT
:
{
my_decimal
value
,
*
res
;
if
(
!
(
res
=
decimal_op_with_null_check
(
&
value
))
||
decimal_to_datetime_with_warn
(
res
,
ltime
,
fuzzydate
,
field_name_or_null
()))
goto
err
;
break
;
}
case
INT_RESULT
:
{
longlong
value
=
int_op
();
bool
neg
=
!
unsigned_flag
&&
value
<
0
;
if
(
null_value
||
int_to_datetime_with_warn
(
neg
,
neg
?
-
value
:
value
,
ltime
,
fuzzydate
,
field_name_or_null
()))
goto
err
;
break
;
}
case
REAL_RESULT
:
{
double
value
=
real_op
();
if
(
null_value
||
double_to_datetime_with_warn
(
value
,
ltime
,
fuzzydate
,
field_name_or_null
()))
goto
err
;
break
;
}
case
TIME_RESULT
:
return
date_op
(
ltime
,
fuzzydate
|
(
field_type
()
==
MYSQL_TYPE_TIME
?
TIME_TIME_ONLY
:
0
));
case
STRING_RESULT
:
MYSQL_TIME
ltime
;
if
(
date_op_with_null_check
(
&
ltime
)
||
(
null_value
=
str
->
alloc
(
MAX_DATE_STRING_REP_LENGTH
)))
return
(
String
*
)
0
;
ltime
.
time_type
=
mysql_type_to_time_type
(
field_type
());
str
->
length
(
my_TIME_to_str
(
&
ltime
,
const_cast
<
char
*>
(
str
->
ptr
()),
decimals
));
str
->
set_charset
(
&
my_charset_bin
);
DBUG_ASSERT
(
!
null_value
);
return
str
;
}
double
Item_func_hybrid_field_type
::
val_real_from_date_op
()
{
MYSQL_TIME
ltime
;
if
(
date_op_with_null_check
(
&
ltime
))
return
0
;
ltime
.
time_type
=
mysql_type_to_time_type
(
field_type
());
return
TIME_to_double
(
&
ltime
);
}
longlong
Item_func_hybrid_field_type
::
val_int_from_date_op
()
{
MYSQL_TIME
ltime
;
if
(
date_op_with_null_check
(
&
ltime
))
return
0
;
ltime
.
time_type
=
mysql_type_to_time_type
(
field_type
());
return
TIME_to_ulonglong
(
&
ltime
);
}
my_decimal
*
Item_func_hybrid_field_type
::
val_decimal_from_date_op
(
my_decimal
*
dec
)
{
MYSQL_TIME
ltime
;
if
(
date_op_with_null_check
(
&
ltime
))
{
char
buff
[
40
];
String
tmp
(
buff
,
sizeof
(
buff
),
&
my_charset_bin
),
*
res
;
if
(
!
(
res
=
str_op_with_null_check
(
&
tmp
))
||
str_to_datetime_with_warn
(
res
->
charset
(),
res
->
ptr
(),
res
->
length
(),
ltime
,
fuzzydate
))
goto
err
;
break
;
}
case
ROW_RESULT
:
DBUG_ASSERT
(
0
);
my_decimal_set_zero
(
dec
);
return
0
;
}
ltime
.
time_type
=
mysql_type_to_time_type
(
field_type
());
return
date2my_decimal
(
&
ltime
,
dec
);
}
return
(
null_value
=
0
);
err:
bzero
(
ltime
,
sizeof
(
*
ltime
));
return
null_value
|=
!
(
fuzzydate
&
TIME_FUZZY_DATES
);
double
Item_func_hybrid_field_type
::
val_real_from_str_op
()
{
String
*
res
=
str_op_with_null_check
(
&
str_value
);
return
res
?
double_from_string_with_check
(
res
)
:
0.0
;
}
longlong
Item_func_hybrid_field_type
::
val_int_from_str_op
()
{
String
*
res
=
str_op_with_null_check
(
&
str_value
);
return
res
?
longlong_from_string_with_check
(
res
)
:
0
;
}
my_decimal
*
Item_func_hybrid_field_type
::
val_decimal_from_str_op
(
my_decimal
*
decimal_value
)
{
String
*
res
=
str_op_with_null_check
(
&
str_value
);
return
res
?
decimal_from_string_with_check
(
decimal_value
,
res
)
:
0
;
}
bool
Item_func_hybrid_field_type
::
get_date_from_str_op
(
MYSQL_TIME
*
ltime
,
ulonglong
fuzzydate
)
{
StringBuffer
<
40
>
tmp
;
String
*
res
;
if
(
!
(
res
=
str_op_with_null_check
(
&
tmp
))
||
str_to_datetime_with_warn
(
res
->
charset
(),
res
->
ptr
(),
res
->
length
(),
ltime
,
fuzzydate
))
return
make_zero_mysql_time
(
ltime
,
fuzzydate
);
return
(
null_value
=
0
);
}
...
...
sql/item_func.h
View file @
6be67860
...
...
@@ -451,6 +451,62 @@ class Item_func_hybrid_field_type: public Item_hybrid_func
DBUG_ASSERT
((
res
!=
NULL
)
^
null_value
);
return
res
;
}
bool
make_zero_mysql_time
(
MYSQL_TIME
*
ltime
,
ulonglong
fuzzydate
)
{
bzero
(
ltime
,
sizeof
(
*
ltime
));
return
null_value
|=
!
(
fuzzydate
&
TIME_FUZZY_DATES
);
}
public:
// Value methods that involve no conversion
String
*
val_str_from_str_op
(
String
*
str
)
{
return
str_op_with_null_check
(
&
str_value
);
}
my_decimal
*
val_decimal_from_decimal_op
(
my_decimal
*
dec
)
{
return
decimal_op_with_null_check
(
dec
);
}
longlong
val_int_from_int_op
()
{
return
int_op
();
}
double
val_real_from_real_op
()
{
return
real_op
();
}
bool
get_date_from_date_op
(
MYSQL_TIME
*
ltime
,
ulonglong
fuzzydate
)
{
return
date_op
(
ltime
,
fuzzydate
|
(
field_type
()
==
MYSQL_TYPE_TIME
?
TIME_TIME_ONLY
:
0
));
}
// Value methods that involve conversion
String
*
val_str_from_decimal_op
(
String
*
str
);
String
*
val_str_from_real_op
(
String
*
str
);
String
*
val_str_from_int_op
(
String
*
str
);
String
*
val_str_from_date_op
(
String
*
str
);
my_decimal
*
val_decimal_from_str_op
(
my_decimal
*
dec
);
my_decimal
*
val_decimal_from_real_op
(
my_decimal
*
dec
);
my_decimal
*
val_decimal_from_int_op
(
my_decimal
*
dec
);
my_decimal
*
val_decimal_from_date_op
(
my_decimal
*
dec
);
longlong
val_int_from_str_op
();
longlong
val_int_from_real_op
();
longlong
val_int_from_decimal_op
();
longlong
val_int_from_date_op
();
double
val_real_from_str_op
();
double
val_real_from_decimal_op
();
double
val_real_from_date_op
();
double
val_real_from_int_op
();
bool
get_date_from_str_op
(
MYSQL_TIME
*
ltime
,
ulonglong
fuzzydate
);
bool
get_date_from_real_op
(
MYSQL_TIME
*
ltime
,
ulonglong
fuzzydate
);
bool
get_date_from_decimal_op
(
MYSQL_TIME
*
ltime
,
ulonglong
fuzzydate
);
bool
get_date_from_int_op
(
MYSQL_TIME
*
ltime
,
ulonglong
fuzzydate
);
public:
Item_func_hybrid_field_type
(
THD
*
thd
)
:
...
...
@@ -469,11 +525,38 @@ class Item_func_hybrid_field_type: public Item_hybrid_func
Item_hybrid_func
(
thd
,
list
)
{
collation
.
set_numeric
();
}
double
val_real
();
longlong
val_int
();
my_decimal
*
val_decimal
(
my_decimal
*
);
String
*
val_str
(
String
*
str
);
bool
get_date
(
MYSQL_TIME
*
res
,
ulonglong
fuzzy_date
);
double
val_real
()
{
DBUG_ASSERT
(
fixed
);
return
Item_func_hybrid_field_type
::
type_handler
()
->
Item_func_hybrid_field_type_val_real
(
this
);
}
longlong
val_int
()
{
DBUG_ASSERT
(
fixed
);
return
Item_func_hybrid_field_type
::
type_handler
()
->
Item_func_hybrid_field_type_val_int
(
this
);
}
my_decimal
*
val_decimal
(
my_decimal
*
dec
)
{
DBUG_ASSERT
(
fixed
);
return
Item_func_hybrid_field_type
::
type_handler
()
->
Item_func_hybrid_field_type_val_decimal
(
this
,
dec
);
}
String
*
val_str
(
String
*
str
)
{
DBUG_ASSERT
(
fixed
);
String
*
res
=
Item_func_hybrid_field_type
::
type_handler
()
->
Item_func_hybrid_field_type_val_str
(
this
,
str
);
DBUG_ASSERT
(
null_value
==
(
res
==
NULL
));
return
res
;
}
bool
get_date
(
MYSQL_TIME
*
res
,
ulonglong
fuzzy_date
)
{
DBUG_ASSERT
(
fixed
);
return
Item_func_hybrid_field_type
::
type_handler
()
->
Item_func_hybrid_field_type_get_date
(
this
,
res
,
fuzzy_date
);
}
/**
@brief Performs the operation that this functions implements when the
...
...
sql/sql_type.cc
View file @
6be67860
...
...
@@ -899,4 +899,245 @@ Type_handler_string_result::Item_func_hex_val_str_ascii(Item_func_hex *item,
return
item
->
val_str_ascii_from_val_str
(
str
);
}
/*************************************************************************/
/***************************************************************************/
String
*
Type_handler_decimal_result
::
Item_func_hybrid_field_type_val_str
(
Item_func_hybrid_field_type
*
item
,
String
*
str
)
const
{
return
item
->
val_str_from_decimal_op
(
str
);
}
double
Type_handler_decimal_result
::
Item_func_hybrid_field_type_val_real
(
Item_func_hybrid_field_type
*
item
)
const
{
return
item
->
val_real_from_decimal_op
();
}
longlong
Type_handler_decimal_result
::
Item_func_hybrid_field_type_val_int
(
Item_func_hybrid_field_type
*
item
)
const
{
return
item
->
val_int_from_decimal_op
();
}
my_decimal
*
Type_handler_decimal_result
::
Item_func_hybrid_field_type_val_decimal
(
Item_func_hybrid_field_type
*
item
,
my_decimal
*
dec
)
const
{
return
item
->
val_decimal_from_decimal_op
(
dec
);
}
bool
Type_handler_decimal_result
::
Item_func_hybrid_field_type_get_date
(
Item_func_hybrid_field_type
*
item
,
MYSQL_TIME
*
ltime
,
ulonglong
fuzzydate
)
const
{
return
item
->
get_date_from_decimal_op
(
ltime
,
fuzzydate
);
}
/***************************************************************************/
String
*
Type_handler_int_result
::
Item_func_hybrid_field_type_val_str
(
Item_func_hybrid_field_type
*
item
,
String
*
str
)
const
{
return
item
->
val_str_from_int_op
(
str
);
}
double
Type_handler_int_result
::
Item_func_hybrid_field_type_val_real
(
Item_func_hybrid_field_type
*
item
)
const
{
return
item
->
val_real_from_int_op
();
}
longlong
Type_handler_int_result
::
Item_func_hybrid_field_type_val_int
(
Item_func_hybrid_field_type
*
item
)
const
{
return
item
->
val_int_from_int_op
();
}
my_decimal
*
Type_handler_int_result
::
Item_func_hybrid_field_type_val_decimal
(
Item_func_hybrid_field_type
*
item
,
my_decimal
*
dec
)
const
{
return
item
->
val_decimal_from_int_op
(
dec
);
}
bool
Type_handler_int_result
::
Item_func_hybrid_field_type_get_date
(
Item_func_hybrid_field_type
*
item
,
MYSQL_TIME
*
ltime
,
ulonglong
fuzzydate
)
const
{
return
item
->
get_date_from_int_op
(
ltime
,
fuzzydate
);
}
/***************************************************************************/
String
*
Type_handler_real_result
::
Item_func_hybrid_field_type_val_str
(
Item_func_hybrid_field_type
*
item
,
String
*
str
)
const
{
return
item
->
val_str_from_real_op
(
str
);
}
double
Type_handler_real_result
::
Item_func_hybrid_field_type_val_real
(
Item_func_hybrid_field_type
*
item
)
const
{
return
item
->
val_real_from_real_op
();
}
longlong
Type_handler_real_result
::
Item_func_hybrid_field_type_val_int
(
Item_func_hybrid_field_type
*
item
)
const
{
return
item
->
val_int_from_real_op
();
}
my_decimal
*
Type_handler_real_result
::
Item_func_hybrid_field_type_val_decimal
(
Item_func_hybrid_field_type
*
item
,
my_decimal
*
dec
)
const
{
return
item
->
val_decimal_from_real_op
(
dec
);
}
bool
Type_handler_real_result
::
Item_func_hybrid_field_type_get_date
(
Item_func_hybrid_field_type
*
item
,
MYSQL_TIME
*
ltime
,
ulonglong
fuzzydate
)
const
{
return
item
->
get_date_from_real_op
(
ltime
,
fuzzydate
);
}
/***************************************************************************/
String
*
Type_handler_temporal_result
::
Item_func_hybrid_field_type_val_str
(
Item_func_hybrid_field_type
*
item
,
String
*
str
)
const
{
return
item
->
val_str_from_date_op
(
str
);
}
double
Type_handler_temporal_result
::
Item_func_hybrid_field_type_val_real
(
Item_func_hybrid_field_type
*
item
)
const
{
return
item
->
val_real_from_date_op
();
}
longlong
Type_handler_temporal_result
::
Item_func_hybrid_field_type_val_int
(
Item_func_hybrid_field_type
*
item
)
const
{
return
item
->
val_int_from_date_op
();
}
my_decimal
*
Type_handler_temporal_result
::
Item_func_hybrid_field_type_val_decimal
(
Item_func_hybrid_field_type
*
item
,
my_decimal
*
dec
)
const
{
return
item
->
val_decimal_from_date_op
(
dec
);
}
bool
Type_handler_temporal_result
::
Item_func_hybrid_field_type_get_date
(
Item_func_hybrid_field_type
*
item
,
MYSQL_TIME
*
ltime
,
ulonglong
fuzzydate
)
const
{
return
item
->
get_date_from_date_op
(
ltime
,
fuzzydate
);
}
/***************************************************************************/
String
*
Type_handler_string_result
::
Item_func_hybrid_field_type_val_str
(
Item_func_hybrid_field_type
*
item
,
String
*
str
)
const
{
return
item
->
val_str_from_str_op
(
str
);
}
double
Type_handler_string_result
::
Item_func_hybrid_field_type_val_real
(
Item_func_hybrid_field_type
*
item
)
const
{
return
item
->
val_real_from_str_op
();
}
longlong
Type_handler_string_result
::
Item_func_hybrid_field_type_val_int
(
Item_func_hybrid_field_type
*
item
)
const
{
return
item
->
val_int_from_str_op
();
}
my_decimal
*
Type_handler_string_result
::
Item_func_hybrid_field_type_val_decimal
(
Item_func_hybrid_field_type
*
item
,
my_decimal
*
dec
)
const
{
return
item
->
val_decimal_from_str_op
(
dec
);
}
bool
Type_handler_string_result
::
Item_func_hybrid_field_type_get_date
(
Item_func_hybrid_field_type
*
item
,
MYSQL_TIME
*
ltime
,
ulonglong
fuzzydate
)
const
{
return
item
->
get_date_from_str_op
(
ltime
,
fuzzydate
);
}
/***************************************************************************/
sql/sql_type.h
View file @
6be67860
...
...
@@ -28,6 +28,7 @@ class Item;
class
Item_cache
;
class
Item_sum_hybrid
;
class
Item_func_hex
;
class
Item_func_hybrid_field_type
;
class
Type_std_attributes
;
class
Sort_param
;
class
Arg_comparator
;
...
...
@@ -294,6 +295,25 @@ class Type_handler
virtual
bool
Item_sum_hybrid_fix_length_and_dec
(
Item_sum_hybrid
*
)
const
=
0
;
virtual
String
*
Item_func_hex_val_str_ascii
(
Item_func_hex
*
item
,
String
*
str
)
const
=
0
;
virtual
String
*
Item_func_hybrid_field_type_val_str
(
Item_func_hybrid_field_type
*
,
String
*
)
const
=
0
;
virtual
double
Item_func_hybrid_field_type_val_real
(
Item_func_hybrid_field_type
*
)
const
=
0
;
virtual
longlong
Item_func_hybrid_field_type_val_int
(
Item_func_hybrid_field_type
*
)
const
=
0
;
virtual
my_decimal
*
Item_func_hybrid_field_type_val_decimal
(
Item_func_hybrid_field_type
*
,
my_decimal
*
)
const
=
0
;
virtual
bool
Item_func_hybrid_field_type_get_date
(
Item_func_hybrid_field_type
*
,
MYSQL_TIME
*
,
ulonglong
fuzzydate
)
const
=
0
;
};
...
...
@@ -357,6 +377,39 @@ class Type_handler_row: public Type_handler
DBUG_ASSERT
(
0
);
return
NULL
;
}
String
*
Item_func_hybrid_field_type_val_str
(
Item_func_hybrid_field_type
*
,
String
*
)
const
{
DBUG_ASSERT
(
0
);
return
NULL
;
}
double
Item_func_hybrid_field_type_val_real
(
Item_func_hybrid_field_type
*
)
const
{
DBUG_ASSERT
(
0
);
return
0.0
;
}
longlong
Item_func_hybrid_field_type_val_int
(
Item_func_hybrid_field_type
*
)
const
{
DBUG_ASSERT
(
0
);
return
0
;
}
my_decimal
*
Item_func_hybrid_field_type_val_decimal
(
Item_func_hybrid_field_type
*
,
my_decimal
*
)
const
{
DBUG_ASSERT
(
0
);
return
NULL
;
}
bool
Item_func_hybrid_field_type_get_date
(
Item_func_hybrid_field_type
*
,
MYSQL_TIME
*
,
ulonglong
fuzzydate
)
const
{
DBUG_ASSERT
(
0
);
return
true
;
}
};
...
...
@@ -392,6 +445,18 @@ class Type_handler_real_result: public Type_handler_numeric
bool
set_comparator_func
(
Arg_comparator
*
cmp
)
const
;
bool
Item_sum_hybrid_fix_length_and_dec
(
Item_sum_hybrid
*
func
)
const
;
String
*
Item_func_hex_val_str_ascii
(
Item_func_hex
*
item
,
String
*
str
)
const
;
String
*
Item_func_hybrid_field_type_val_str
(
Item_func_hybrid_field_type
*
,
String
*
)
const
;
double
Item_func_hybrid_field_type_val_real
(
Item_func_hybrid_field_type
*
)
const
;
longlong
Item_func_hybrid_field_type_val_int
(
Item_func_hybrid_field_type
*
)
const
;
my_decimal
*
Item_func_hybrid_field_type_val_decimal
(
Item_func_hybrid_field_type
*
,
my_decimal
*
)
const
;
bool
Item_func_hybrid_field_type_get_date
(
Item_func_hybrid_field_type
*
,
MYSQL_TIME
*
,
ulonglong
fuzzydate
)
const
;
};
...
...
@@ -412,6 +477,18 @@ class Type_handler_decimal_result: public Type_handler_numeric
bool
set_comparator_func
(
Arg_comparator
*
cmp
)
const
;
bool
Item_sum_hybrid_fix_length_and_dec
(
Item_sum_hybrid
*
func
)
const
;
String
*
Item_func_hex_val_str_ascii
(
Item_func_hex
*
item
,
String
*
str
)
const
;
String
*
Item_func_hybrid_field_type_val_str
(
Item_func_hybrid_field_type
*
,
String
*
)
const
;
double
Item_func_hybrid_field_type_val_real
(
Item_func_hybrid_field_type
*
)
const
;
longlong
Item_func_hybrid_field_type_val_int
(
Item_func_hybrid_field_type
*
)
const
;
my_decimal
*
Item_func_hybrid_field_type_val_decimal
(
Item_func_hybrid_field_type
*
,
my_decimal
*
)
const
;
bool
Item_func_hybrid_field_type_get_date
(
Item_func_hybrid_field_type
*
,
MYSQL_TIME
*
,
ulonglong
fuzzydate
)
const
;
};
...
...
@@ -432,6 +509,18 @@ class Type_handler_int_result: public Type_handler_numeric
bool
set_comparator_func
(
Arg_comparator
*
cmp
)
const
;
bool
Item_sum_hybrid_fix_length_and_dec
(
Item_sum_hybrid
*
func
)
const
;
String
*
Item_func_hex_val_str_ascii
(
Item_func_hex
*
item
,
String
*
str
)
const
;
String
*
Item_func_hybrid_field_type_val_str
(
Item_func_hybrid_field_type
*
,
String
*
)
const
;
double
Item_func_hybrid_field_type_val_real
(
Item_func_hybrid_field_type
*
)
const
;
longlong
Item_func_hybrid_field_type_val_int
(
Item_func_hybrid_field_type
*
)
const
;
my_decimal
*
Item_func_hybrid_field_type_val_decimal
(
Item_func_hybrid_field_type
*
,
my_decimal
*
)
const
;
bool
Item_func_hybrid_field_type_get_date
(
Item_func_hybrid_field_type
*
,
MYSQL_TIME
*
,
ulonglong
fuzzydate
)
const
;
};
...
...
@@ -450,6 +539,18 @@ class Type_handler_temporal_result: public Type_handler
bool
set_comparator_func
(
Arg_comparator
*
cmp
)
const
;
bool
Item_sum_hybrid_fix_length_and_dec
(
Item_sum_hybrid
*
func
)
const
;
String
*
Item_func_hex_val_str_ascii
(
Item_func_hex
*
item
,
String
*
str
)
const
;
String
*
Item_func_hybrid_field_type_val_str
(
Item_func_hybrid_field_type
*
,
String
*
)
const
;
double
Item_func_hybrid_field_type_val_real
(
Item_func_hybrid_field_type
*
)
const
;
longlong
Item_func_hybrid_field_type_val_int
(
Item_func_hybrid_field_type
*
)
const
;
my_decimal
*
Item_func_hybrid_field_type_val_decimal
(
Item_func_hybrid_field_type
*
,
my_decimal
*
)
const
;
bool
Item_func_hybrid_field_type_get_date
(
Item_func_hybrid_field_type
*
,
MYSQL_TIME
*
,
ulonglong
fuzzydate
)
const
;
};
...
...
@@ -472,6 +573,18 @@ class Type_handler_string_result: public Type_handler
bool
set_comparator_func
(
Arg_comparator
*
cmp
)
const
;
bool
Item_sum_hybrid_fix_length_and_dec
(
Item_sum_hybrid
*
func
)
const
;
String
*
Item_func_hex_val_str_ascii
(
Item_func_hex
*
item
,
String
*
str
)
const
;
String
*
Item_func_hybrid_field_type_val_str
(
Item_func_hybrid_field_type
*
,
String
*
)
const
;
double
Item_func_hybrid_field_type_val_real
(
Item_func_hybrid_field_type
*
)
const
;
longlong
Item_func_hybrid_field_type_val_int
(
Item_func_hybrid_field_type
*
)
const
;
my_decimal
*
Item_func_hybrid_field_type_val_decimal
(
Item_func_hybrid_field_type
*
,
my_decimal
*
)
const
;
bool
Item_func_hybrid_field_type_get_date
(
Item_func_hybrid_field_type
*
,
MYSQL_TIME
*
,
ulonglong
fuzzydate
)
const
;
};
...
...
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