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
552072e4
Commit
552072e4
authored
Mar 19, 2017
by
Alexander Barkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-12239 Add Type_handler::Item_sum_{sum|avg|variance}_fix_length_and_dec()
parent
7d0c354f
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
355 additions
and
81 deletions
+355
-81
mysql-test/r/gis.result
mysql-test/r/gis.result
+29
-0
mysql-test/r/select.result
mysql-test/r/select.result
+1
-3
mysql-test/r/select_jcl6.result
mysql-test/r/select_jcl6.result
+1
-3
mysql-test/r/select_pkeycache.result
mysql-test/r/select_pkeycache.result
+1
-3
mysql-test/t/gis.test
mysql-test/t/gis.test
+38
-0
mysql-test/t/select.test
mysql-test/t/select.test
+1
-0
sql/item_sum.cc
sql/item_sum.cc
+77
-72
sql/item_sum.h
sql/item_sum.h
+6
-0
sql/sql_type.cc
sql/sql_type.cc
+160
-0
sql/sql_type.h
sql/sql_type.h
+41
-0
No files found.
mysql-test/r/gis.result
View file @
552072e4
...
@@ -3749,5 +3749,34 @@ ERROR HY000: Illegal parameter data type geometry for operation 'ceiling'
...
@@ -3749,5 +3749,34 @@ ERROR HY000: Illegal parameter data type geometry for operation 'ceiling'
SELECT FLOOR(POINT(1,1));
SELECT FLOOR(POINT(1,1));
ERROR HY000: Illegal parameter data type geometry for operation 'floor'
ERROR HY000: Illegal parameter data type geometry for operation 'floor'
#
#
# MDEV-12239 Add Type_handler::Item_sum_{sum|avg|variance}_fix_length_and_dec()
#
CREATE TABLE t1 (a GEOMETRY);
SELECT SUM(POINT(1,1)) FROM t1;
ERROR HY000: Illegal parameter data type geometry for operation 'sum'
SELECT SUM(a) FROM t1;
ERROR HY000: Illegal parameter data type geometry for operation 'sum'
SELECT SUM(COALESCE(a)) FROM t1;
ERROR HY000: Illegal parameter data type geometry for operation 'sum'
SELECT AVG(POINT(1,1)) FROM t1;
ERROR HY000: Illegal parameter data type geometry for operation 'avg'
SELECT AVG(a) FROM t1;
ERROR HY000: Illegal parameter data type geometry for operation 'avg'
SELECT AVG(COALESCE(a)) FROM t1;
ERROR HY000: Illegal parameter data type geometry for operation 'avg'
SELECT VARIANCE(POINT(1,1)) FROM t1;
ERROR HY000: Illegal parameter data type geometry for operation 'variance('
SELECT VARIANCE(a) FROM t1;
ERROR HY000: Illegal parameter data type geometry for operation 'variance('
SELECT VARIANCE(COALESCE(a)) FROM t1;
ERROR HY000: Illegal parameter data type geometry for operation 'variance('
SELECT STDDEV(POINT(1,1)) FROM t1;
ERROR HY000: Illegal parameter data type geometry for operation 'std('
SELECT STDDEV(a) FROM t1;
ERROR HY000: Illegal parameter data type geometry for operation 'std('
SELECT STDDEV(COALESCE(a)) FROM t1;
ERROR HY000: Illegal parameter data type geometry for operation 'std('
DROP TABLE t1;
#
# End of 10.3 tests
# End of 10.3 tests
#
#
mysql-test/r/select.result
View file @
552072e4
...
@@ -5263,9 +5263,7 @@ UNION ALL
...
@@ -5263,9 +5263,7 @@ UNION ALL
SELECT coalesce((avg(distinct (geomfromtext("point(25379 -22010)")))))
SELECT coalesce((avg(distinct (geomfromtext("point(25379 -22010)")))))
AS foo
AS foo
;
;
coalesce((avg(distinct (geomfromtext("point(25379 -22010)")))))
ERROR HY000: Illegal parameter data type geometry for operation 'avg'
0.0000
0.0000
CREATE table t1(a text);
CREATE table t1(a text);
INSERT INTO t1 VALUES (''), ('');
INSERT INTO t1 VALUES (''), ('');
SELECT avg(distinct(t1.a)) FROM t1, t1 t2
SELECT avg(distinct(t1.a)) FROM t1, t1 t2
...
...
mysql-test/r/select_jcl6.result
View file @
552072e4
...
@@ -5274,9 +5274,7 @@ UNION ALL
...
@@ -5274,9 +5274,7 @@ UNION ALL
SELECT coalesce((avg(distinct (geomfromtext("point(25379 -22010)")))))
SELECT coalesce((avg(distinct (geomfromtext("point(25379 -22010)")))))
AS foo
AS foo
;
;
coalesce((avg(distinct (geomfromtext("point(25379 -22010)")))))
ERROR HY000: Illegal parameter data type geometry for operation 'avg'
0.0000
0.0000
CREATE table t1(a text);
CREATE table t1(a text);
INSERT INTO t1 VALUES (''), ('');
INSERT INTO t1 VALUES (''), ('');
SELECT avg(distinct(t1.a)) FROM t1, t1 t2
SELECT avg(distinct(t1.a)) FROM t1, t1 t2
...
...
mysql-test/r/select_pkeycache.result
View file @
552072e4
...
@@ -5263,9 +5263,7 @@ UNION ALL
...
@@ -5263,9 +5263,7 @@ UNION ALL
SELECT coalesce((avg(distinct (geomfromtext("point(25379 -22010)")))))
SELECT coalesce((avg(distinct (geomfromtext("point(25379 -22010)")))))
AS foo
AS foo
;
;
coalesce((avg(distinct (geomfromtext("point(25379 -22010)")))))
ERROR HY000: Illegal parameter data type geometry for operation 'avg'
0.0000
0.0000
CREATE table t1(a text);
CREATE table t1(a text);
INSERT INTO t1 VALUES (''), ('');
INSERT INTO t1 VALUES (''), ('');
SELECT avg(distinct(t1.a)) FROM t1, t1 t2
SELECT avg(distinct(t1.a)) FROM t1, t1 t2
...
...
mysql-test/t/gis.test
View file @
552072e4
...
@@ -1915,6 +1915,44 @@ SELECT CEILING(POINT(1,1));
...
@@ -1915,6 +1915,44 @@ SELECT CEILING(POINT(1,1));
--
error
ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
--
error
ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
SELECT
FLOOR
(
POINT
(
1
,
1
));
SELECT
FLOOR
(
POINT
(
1
,
1
));
--
echo
#
--
echo
# MDEV-12239 Add Type_handler::Item_sum_{sum|avg|variance}_fix_length_and_dec()
--
echo
#
CREATE
TABLE
t1
(
a
GEOMETRY
);
--
error
ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
SELECT
SUM
(
POINT
(
1
,
1
))
FROM
t1
;
--
error
ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
SELECT
SUM
(
a
)
FROM
t1
;
--
error
ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
SELECT
SUM
(
COALESCE
(
a
))
FROM
t1
;
--
error
ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
SELECT
AVG
(
POINT
(
1
,
1
))
FROM
t1
;
--
error
ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
SELECT
AVG
(
a
)
FROM
t1
;
--
error
ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
SELECT
AVG
(
COALESCE
(
a
))
FROM
t1
;
--
error
ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
SELECT
VARIANCE
(
POINT
(
1
,
1
))
FROM
t1
;
--
error
ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
SELECT
VARIANCE
(
a
)
FROM
t1
;
--
error
ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
SELECT
VARIANCE
(
COALESCE
(
a
))
FROM
t1
;
--
error
ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
SELECT
STDDEV
(
POINT
(
1
,
1
))
FROM
t1
;
--
error
ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
SELECT
STDDEV
(
a
)
FROM
t1
;
--
error
ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
SELECT
STDDEV
(
COALESCE
(
a
))
FROM
t1
;
DROP
TABLE
t1
;
--
echo
#
--
echo
#
--
echo
# End of 10.3 tests
--
echo
# End of 10.3 tests
--
echo
#
--
echo
#
mysql-test/t/select.test
View file @
552072e4
...
@@ -4427,6 +4427,7 @@ DROP TABLE t1;
...
@@ -4427,6 +4427,7 @@ DROP TABLE t1;
--
echo
# Bug #57203 Assertion `field_length <= 255' failed.
--
echo
# Bug #57203 Assertion `field_length <= 255' failed.
--
echo
#
--
echo
#
--
error
ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
SELECT
coalesce
((
avg
(
distinct
(
geomfromtext
(
"point(25379 -22010)"
)))))
SELECT
coalesce
((
avg
(
distinct
(
geomfromtext
(
"point(25379 -22010)"
)))))
UNION
ALL
UNION
ALL
SELECT
coalesce
((
avg
(
distinct
(
geomfromtext
(
"point(25379 -22010)"
)))))
SELECT
coalesce
((
avg
(
distinct
(
geomfromtext
(
"point(25379 -22010)"
)))))
...
...
sql/item_sum.cc
View file @
552072e4
...
@@ -1290,41 +1290,35 @@ void Item_sum_sum::clear()
...
@@ -1290,41 +1290,35 @@ void Item_sum_sum::clear()
}
}
void
Item_sum_sum
::
fix_length_and_dec
()
void
Item_sum_sum
::
fix_length_and_dec
_double
()
{
{
DBUG_ENTER
(
"Item_sum_sum::fix_length_and_dec"
);
set_handler
(
&
type_handler_double
);
// Change FLOAT to DOUBLE
maybe_null
=
null_value
=
1
;
decimals
=
args
[
0
]
->
decimals
;
decimals
=
args
[
0
]
->
decimals
;
switch
(
args
[
0
]
->
cast_to_int_type_handler
()
->
cmp_type
())
{
case
REAL_RESULT
:
case
STRING_RESULT
:
set_handler_by_field_type
(
MYSQL_TYPE_DOUBLE
);
sum
=
0.0
;
sum
=
0.0
;
break
;
}
case
INT_RESULT
:
case
TIME_RESULT
:
case
DECIMAL_RESULT
:
void
Item_sum_sum
::
fix_length_and_dec_decimal
()
{
{
set_handler
(
&
type_handler_newdecimal
);
// Change temporal to new DECIMAL
decimals
=
args
[
0
]
->
decimals
;
/* SUM result can't be longer than length(arg) + length(MAX_ROWS) */
/* SUM result can't be longer than length(arg) + length(MAX_ROWS) */
int
precision
=
args
[
0
]
->
decimal_precision
()
+
DECIMAL_LONGLONG_DIGITS
;
int
precision
=
args
[
0
]
->
decimal_precision
()
+
DECIMAL_LONGLONG_DIGITS
;
max_length
=
my_decimal_precision_to_length_no_truncation
(
precision
,
max_length
=
my_decimal_precision_to_length_no_truncation
(
precision
,
decimals
,
decimals
,
unsigned_flag
);
unsigned_flag
);
curr_dec_buff
=
0
;
curr_dec_buff
=
0
;
set_handler_by_field_type
(
MYSQL_TYPE_NEWDECIMAL
);
my_decimal_set_zero
(
dec_buffs
);
my_decimal_set_zero
(
dec_buffs
);
break
;
}
}
case
ROW_RESULT
:
DBUG_ASSERT
(
0
);
void
Item_sum_sum
::
fix_length_and_dec
()
}
{
DBUG_PRINT
(
"info"
,
(
"Type: %s (%d, %d)"
,
DBUG_ENTER
(
"Item_sum_sum::fix_length_and_dec"
);
(
result_type
()
==
REAL_RESULT
?
"REAL_RESULT"
:
maybe_null
=
null_value
=
1
;
result_type
()
==
DECIMAL_RESULT
?
"DECIMAL_RESULT"
:
args
[
0
]
->
cast_to_int_type_handler
()
->
Item_sum_sum_fix_length_and_dec
(
this
);
result_type
()
==
INT_RESULT
?
"INT_RESULT"
:
DBUG_PRINT
(
"info"
,
(
"Type: %s (%d, %d)"
,
type_handler
()
->
name
().
ptr
(),
"--ILLEGAL!!!--"
),
max_length
,
(
int
)
decimals
));
max_length
,
(
int
)
decimals
));
DBUG_VOID_RETURN
;
DBUG_VOID_RETURN
;
}
}
...
@@ -1625,13 +1619,10 @@ void Item_sum_count::cleanup()
...
@@ -1625,13 +1619,10 @@ void Item_sum_count::cleanup()
/*
/*
Avgerage
Avgerage
*/
*/
void
Item_sum_avg
::
fix_length_and_dec
()
void
Item_sum_avg
::
fix_length_and_dec_decimal
()
{
{
Item_sum_sum
::
fix_length_and_dec
();
Item_sum_sum
::
fix_length_and_dec_decimal
();
maybe_null
=
null_value
=
1
;
prec_increment
=
current_thd
->
variables
.
div_precincrement
;
if
(
Item_sum_avg
::
result_type
()
==
DECIMAL_RESULT
)
{
int
precision
=
args
[
0
]
->
decimal_precision
()
+
prec_increment
;
int
precision
=
args
[
0
]
->
decimal_precision
()
+
prec_increment
;
decimals
=
MY_MIN
(
args
[
0
]
->
decimals
+
prec_increment
,
DECIMAL_MAX_SCALE
);
decimals
=
MY_MIN
(
args
[
0
]
->
decimals
+
prec_increment
,
DECIMAL_MAX_SCALE
);
max_length
=
my_decimal_precision_to_length_no_truncation
(
precision
,
max_length
=
my_decimal_precision_to_length_no_truncation
(
precision
,
...
@@ -1640,13 +1631,27 @@ void Item_sum_avg::fix_length_and_dec()
...
@@ -1640,13 +1631,27 @@ void Item_sum_avg::fix_length_and_dec()
f_precision
=
MY_MIN
(
precision
+
DECIMAL_LONGLONG_DIGITS
,
DECIMAL_MAX_PRECISION
);
f_precision
=
MY_MIN
(
precision
+
DECIMAL_LONGLONG_DIGITS
,
DECIMAL_MAX_PRECISION
);
f_scale
=
args
[
0
]
->
decimals
;
f_scale
=
args
[
0
]
->
decimals
;
dec_bin_size
=
my_decimal_get_binary_size
(
f_precision
,
f_scale
);
dec_bin_size
=
my_decimal_get_binary_size
(
f_precision
,
f_scale
);
}
}
else
{
void
Item_sum_avg
::
fix_length_and_dec_double
()
{
Item_sum_sum
::
fix_length_and_dec_double
();
decimals
=
MY_MIN
(
args
[
0
]
->
decimals
+
prec_increment
,
decimals
=
MY_MIN
(
args
[
0
]
->
decimals
+
prec_increment
,
FLOATING_POINT_DECIMALS
);
FLOATING_POINT_DECIMALS
);
max_length
=
MY_MIN
(
args
[
0
]
->
max_length
+
prec_increment
,
float_length
(
decimals
));
max_length
=
MY_MIN
(
args
[
0
]
->
max_length
+
prec_increment
,
float_length
(
decimals
));
}
}
void
Item_sum_avg
::
fix_length_and_dec
()
{
DBUG_ENTER
(
"Item_sum_avg::fix_length_and_dec"
);
prec_increment
=
current_thd
->
variables
.
div_precincrement
;
maybe_null
=
null_value
=
1
;
args
[
0
]
->
cast_to_int_type_handler
()
->
Item_sum_avg_fix_length_and_dec
(
this
);
DBUG_PRINT
(
"info"
,
(
"Type: %s (%d, %d)"
,
type_handler
()
->
name
().
ptr
(),
max_length
,
(
int
)
decimals
));
DBUG_VOID_RETURN
;
}
}
...
@@ -1845,6 +1850,25 @@ Item_sum_variance::Item_sum_variance(THD *thd, Item_sum_variance *item):
...
@@ -1845,6 +1850,25 @@ Item_sum_variance::Item_sum_variance(THD *thd, Item_sum_variance *item):
}
}
void
Item_sum_variance
::
fix_length_and_dec_double
()
{
DBUG_ASSERT
(
Item_sum_variance
::
type_handler
()
==
&
type_handler_double
);
decimals
=
MY_MIN
(
args
[
0
]
->
decimals
+
4
,
FLOATING_POINT_DECIMALS
);
}
void
Item_sum_variance
::
fix_length_and_dec_decimal
()
{
DBUG_ASSERT
(
Item_sum_variance
::
type_handler
()
==
&
type_handler_double
);
int
precision
=
args
[
0
]
->
decimal_precision
()
*
2
+
prec_increment
;
decimals
=
MY_MIN
(
args
[
0
]
->
decimals
+
prec_increment
,
FLOATING_POINT_DECIMALS
-
1
);
max_length
=
my_decimal_precision_to_length_no_truncation
(
precision
,
decimals
,
unsigned_flag
);
}
void
Item_sum_variance
::
fix_length_and_dec
()
void
Item_sum_variance
::
fix_length_and_dec
()
{
{
DBUG_ENTER
(
"Item_sum_variance::fix_length_and_dec"
);
DBUG_ENTER
(
"Item_sum_variance::fix_length_and_dec"
);
...
@@ -1858,28 +1882,9 @@ void Item_sum_variance::fix_length_and_dec()
...
@@ -1858,28 +1882,9 @@ void Item_sum_variance::fix_length_and_dec()
type.
type.
*/
*/
switch
(
args
[
0
]
->
result_type
())
{
args
[
0
]
->
type_handler
()
->
Item_sum_variance_fix_length_and_dec
(
this
);
case
REAL_RESULT
:
DBUG_PRINT
(
"info"
,
(
"Type: %s (%d, %d)"
,
type_handler
()
->
name
().
ptr
(),
case
STRING_RESULT
:
max_length
,
(
int
)
decimals
));
decimals
=
MY_MIN
(
args
[
0
]
->
decimals
+
4
,
FLOATING_POINT_DECIMALS
);
break
;
case
INT_RESULT
:
case
DECIMAL_RESULT
:
{
int
precision
=
args
[
0
]
->
decimal_precision
()
*
2
+
prec_increment
;
decimals
=
MY_MIN
(
args
[
0
]
->
decimals
+
prec_increment
,
FLOATING_POINT_DECIMALS
-
1
);
max_length
=
my_decimal_precision_to_length_no_truncation
(
precision
,
decimals
,
unsigned_flag
);
break
;
}
case
ROW_RESULT
:
case
TIME_RESULT
:
DBUG_ASSERT
(
0
);
}
DBUG_PRINT
(
"info"
,
(
"Type: REAL_RESULT (%d, %d)"
,
max_length
,
(
int
)
decimals
));
DBUG_VOID_RETURN
;
DBUG_VOID_RETURN
;
}
}
...
...
sql/item_sum.h
View file @
552072e4
...
@@ -790,6 +790,8 @@ class Item_sum_sum :public Item_sum_num,
...
@@ -790,6 +790,8 @@ class Item_sum_sum :public Item_sum_num,
{
return
Type_handler_hybrid_field_type
::
result_type
();
}
{
return
Type_handler_hybrid_field_type
::
result_type
();
}
enum
Item_result
cmp_type
()
const
enum
Item_result
cmp_type
()
const
{
return
Type_handler_hybrid_field_type
::
cmp_type
();
}
{
return
Type_handler_hybrid_field_type
::
cmp_type
();
}
void
fix_length_and_dec_double
();
void
fix_length_and_dec_decimal
();
void
reset_field
();
void
reset_field
();
void
update_field
();
void
update_field
();
void
no_rows_in_result
()
{}
void
no_rows_in_result
()
{}
...
@@ -889,6 +891,8 @@ class Item_sum_avg :public Item_sum_sum
...
@@ -889,6 +891,8 @@ class Item_sum_avg :public Item_sum_sum
:
Item_sum_sum
(
thd
,
item
),
count
(
item
->
count
),
:
Item_sum_sum
(
thd
,
item
),
count
(
item
->
count
),
prec_increment
(
item
->
prec_increment
)
{}
prec_increment
(
item
->
prec_increment
)
{}
void
fix_length_and_dec_double
();
void
fix_length_and_dec_decimal
();
void
fix_length_and_dec
();
void
fix_length_and_dec
();
enum
Sumfunctype
sum_func
()
const
enum
Sumfunctype
sum_func
()
const
{
{
...
@@ -963,6 +967,8 @@ class Item_sum_variance : public Item_sum_num
...
@@ -963,6 +967,8 @@ class Item_sum_variance : public Item_sum_num
{}
{}
Item_sum_variance
(
THD
*
thd
,
Item_sum_variance
*
item
);
Item_sum_variance
(
THD
*
thd
,
Item_sum_variance
*
item
);
enum
Sumfunctype
sum_func
()
const
{
return
VARIANCE_FUNC
;
}
enum
Sumfunctype
sum_func
()
const
{
return
VARIANCE_FUNC
;
}
void
fix_length_and_dec_double
();
void
fix_length_and_dec_decimal
();
void
clear
();
void
clear
();
bool
add
();
bool
add
();
double
val_real
();
double
val_real
();
...
...
sql/sql_type.cc
View file @
552072e4
...
@@ -1398,6 +1398,166 @@ bool Type_handler_temporal_result::
...
@@ -1398,6 +1398,166 @@ bool Type_handler_temporal_result::
return
false
;
return
false
;
}
}
/*************************************************************************/
bool
Type_handler_int_result
::
Item_sum_sum_fix_length_and_dec
(
Item_sum_sum
*
item
)
const
{
item
->
fix_length_and_dec_decimal
();
return
false
;
}
bool
Type_handler_decimal_result
::
Item_sum_sum_fix_length_and_dec
(
Item_sum_sum
*
item
)
const
{
item
->
fix_length_and_dec_decimal
();
return
false
;
}
bool
Type_handler_temporal_result
::
Item_sum_sum_fix_length_and_dec
(
Item_sum_sum
*
item
)
const
{
item
->
fix_length_and_dec_decimal
();
return
false
;
}
bool
Type_handler_real_result
::
Item_sum_sum_fix_length_and_dec
(
Item_sum_sum
*
item
)
const
{
item
->
fix_length_and_dec_double
();
return
false
;
}
bool
Type_handler_string_result
::
Item_sum_sum_fix_length_and_dec
(
Item_sum_sum
*
item
)
const
{
item
->
fix_length_and_dec_double
();
return
false
;
}
#ifdef HAVE_SPATIAL
bool
Type_handler_geometry
::
Item_sum_sum_fix_length_and_dec
(
Item_sum_sum
*
item
)
const
{
my_error
(
ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
,
MYF
(
0
),
type_handler_geometry
.
name
().
ptr
(),
"sum"
);
return
false
;
}
#endif
/*************************************************************************/
bool
Type_handler_int_result
::
Item_sum_avg_fix_length_and_dec
(
Item_sum_avg
*
item
)
const
{
item
->
fix_length_and_dec_decimal
();
return
false
;
}
bool
Type_handler_decimal_result
::
Item_sum_avg_fix_length_and_dec
(
Item_sum_avg
*
item
)
const
{
item
->
fix_length_and_dec_decimal
();
return
false
;
}
bool
Type_handler_temporal_result
::
Item_sum_avg_fix_length_and_dec
(
Item_sum_avg
*
item
)
const
{
item
->
fix_length_and_dec_decimal
();
return
false
;
}
bool
Type_handler_real_result
::
Item_sum_avg_fix_length_and_dec
(
Item_sum_avg
*
item
)
const
{
item
->
fix_length_and_dec_double
();
return
false
;
}
bool
Type_handler_string_result
::
Item_sum_avg_fix_length_and_dec
(
Item_sum_avg
*
item
)
const
{
item
->
fix_length_and_dec_double
();
return
false
;
}
#ifdef HAVE_SPATIAL
bool
Type_handler_geometry
::
Item_sum_avg_fix_length_and_dec
(
Item_sum_avg
*
item
)
const
{
my_error
(
ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
,
MYF
(
0
),
type_handler_geometry
.
name
().
ptr
(),
"avg"
);
return
false
;
}
#endif
/*************************************************************************/
bool
Type_handler_int_result
::
Item_sum_variance_fix_length_and_dec
(
Item_sum_variance
*
item
)
const
{
item
->
fix_length_and_dec_decimal
();
return
false
;
}
bool
Type_handler_decimal_result
::
Item_sum_variance_fix_length_and_dec
(
Item_sum_variance
*
item
)
const
{
item
->
fix_length_and_dec_decimal
();
return
false
;
}
bool
Type_handler_temporal_result
::
Item_sum_variance_fix_length_and_dec
(
Item_sum_variance
*
item
)
const
{
item
->
fix_length_and_dec_decimal
();
return
false
;
}
bool
Type_handler_real_result
::
Item_sum_variance_fix_length_and_dec
(
Item_sum_variance
*
item
)
const
{
item
->
fix_length_and_dec_double
();
return
false
;
}
bool
Type_handler_string_result
::
Item_sum_variance_fix_length_and_dec
(
Item_sum_variance
*
item
)
const
{
item
->
fix_length_and_dec_double
();
return
false
;
}
#ifdef HAVE_SPATIAL
bool
Type_handler_geometry
::
Item_sum_variance_fix_length_and_dec
(
Item_sum_variance
*
item
)
const
{
my_error
(
ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
,
MYF
(
0
),
type_handler_geometry
.
name
().
ptr
(),
item
->
func_name
());
return
false
;
}
#endif
/*************************************************************************/
/*************************************************************************/
String
*
String
*
...
...
sql/sql_type.h
View file @
552072e4
...
@@ -28,6 +28,9 @@ class Field;
...
@@ -28,6 +28,9 @@ class Field;
class
Item
;
class
Item
;
class
Item_cache
;
class
Item_cache
;
class
Item_sum_hybrid
;
class
Item_sum_hybrid
;
class
Item_sum_sum
;
class
Item_sum_avg
;
class
Item_sum_variance
;
class
Item_func_hex
;
class
Item_func_hex
;
class
Item_hybrid_func
;
class
Item_hybrid_func
;
class
Item_func_min_max
;
class
Item_func_min_max
;
...
@@ -403,6 +406,11 @@ class Type_handler
...
@@ -403,6 +406,11 @@ class Type_handler
Item
**
items
,
Item
**
items
,
uint
nitems
)
const
=
0
;
uint
nitems
)
const
=
0
;
virtual
bool
Item_sum_hybrid_fix_length_and_dec
(
Item_sum_hybrid
*
)
const
=
0
;
virtual
bool
Item_sum_hybrid_fix_length_and_dec
(
Item_sum_hybrid
*
)
const
=
0
;
virtual
bool
Item_sum_sum_fix_length_and_dec
(
Item_sum_sum
*
)
const
=
0
;
virtual
bool
Item_sum_avg_fix_length_and_dec
(
Item_sum_avg
*
)
const
=
0
;
virtual
bool
Item_sum_variance_fix_length_and_dec
(
Item_sum_variance
*
)
const
=
0
;
virtual
String
*
Item_func_hex_val_str_ascii
(
Item_func_hex
*
item
,
virtual
String
*
Item_func_hex_val_str_ascii
(
Item_func_hex
*
item
,
String
*
str
)
const
=
0
;
String
*
str
)
const
=
0
;
...
@@ -540,6 +548,21 @@ class Type_handler_row: public Type_handler
...
@@ -540,6 +548,21 @@ class Type_handler_row: public Type_handler
DBUG_ASSERT
(
0
);
DBUG_ASSERT
(
0
);
return
true
;
return
true
;
}
}
bool
Item_sum_sum_fix_length_and_dec
(
Item_sum_sum
*
)
const
{
DBUG_ASSERT
(
0
);
return
true
;
}
bool
Item_sum_avg_fix_length_and_dec
(
Item_sum_avg
*
)
const
{
DBUG_ASSERT
(
0
);
return
true
;
}
bool
Item_sum_variance_fix_length_and_dec
(
Item_sum_variance
*
)
const
{
DBUG_ASSERT
(
0
);
return
true
;
}
String
*
Item_func_hex_val_str_ascii
(
Item_func_hex
*
item
,
String
*
str
)
const
String
*
Item_func_hex_val_str_ascii
(
Item_func_hex
*
item
,
String
*
str
)
const
{
{
DBUG_ASSERT
(
0
);
DBUG_ASSERT
(
0
);
...
@@ -662,6 +685,9 @@ class Type_handler_real_result: public Type_handler_numeric
...
@@ -662,6 +685,9 @@ class Type_handler_real_result: public Type_handler_numeric
bool
Item_hybrid_func_fix_attributes
(
THD
*
thd
,
Item_hybrid_func
*
func
,
bool
Item_hybrid_func_fix_attributes
(
THD
*
thd
,
Item_hybrid_func
*
func
,
Item
**
items
,
uint
nitems
)
const
;
Item
**
items
,
uint
nitems
)
const
;
bool
Item_sum_hybrid_fix_length_and_dec
(
Item_sum_hybrid
*
func
)
const
;
bool
Item_sum_hybrid_fix_length_and_dec
(
Item_sum_hybrid
*
func
)
const
;
bool
Item_sum_sum_fix_length_and_dec
(
Item_sum_sum
*
)
const
;
bool
Item_sum_avg_fix_length_and_dec
(
Item_sum_avg
*
)
const
;
bool
Item_sum_variance_fix_length_and_dec
(
Item_sum_variance
*
)
const
;
String
*
Item_func_hex_val_str_ascii
(
Item_func_hex
*
item
,
String
*
str
)
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
*
Item_func_hybrid_field_type_val_str
(
Item_func_hybrid_field_type
*
,
String
*
)
const
;
String
*
)
const
;
...
@@ -709,6 +735,9 @@ class Type_handler_decimal_result: public Type_handler_numeric
...
@@ -709,6 +735,9 @@ class Type_handler_decimal_result: public Type_handler_numeric
bool
Item_hybrid_func_fix_attributes
(
THD
*
thd
,
Item_hybrid_func
*
func
,
bool
Item_hybrid_func_fix_attributes
(
THD
*
thd
,
Item_hybrid_func
*
func
,
Item
**
items
,
uint
nitems
)
const
;
Item
**
items
,
uint
nitems
)
const
;
bool
Item_sum_hybrid_fix_length_and_dec
(
Item_sum_hybrid
*
func
)
const
;
bool
Item_sum_hybrid_fix_length_and_dec
(
Item_sum_hybrid
*
func
)
const
;
bool
Item_sum_sum_fix_length_and_dec
(
Item_sum_sum
*
)
const
;
bool
Item_sum_avg_fix_length_and_dec
(
Item_sum_avg
*
)
const
;
bool
Item_sum_variance_fix_length_and_dec
(
Item_sum_variance
*
)
const
;
String
*
Item_func_hex_val_str_ascii
(
Item_func_hex
*
item
,
String
*
str
)
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
*
Item_func_hybrid_field_type_val_str
(
Item_func_hybrid_field_type
*
,
String
*
)
const
;
String
*
)
const
;
...
@@ -754,6 +783,9 @@ class Type_handler_int_result: public Type_handler_numeric
...
@@ -754,6 +783,9 @@ class Type_handler_int_result: public Type_handler_numeric
bool
Item_hybrid_func_fix_attributes
(
THD
*
thd
,
Item_hybrid_func
*
func
,
bool
Item_hybrid_func_fix_attributes
(
THD
*
thd
,
Item_hybrid_func
*
func
,
Item
**
items
,
uint
nitems
)
const
;
Item
**
items
,
uint
nitems
)
const
;
bool
Item_sum_hybrid_fix_length_and_dec
(
Item_sum_hybrid
*
func
)
const
;
bool
Item_sum_hybrid_fix_length_and_dec
(
Item_sum_hybrid
*
func
)
const
;
bool
Item_sum_sum_fix_length_and_dec
(
Item_sum_sum
*
)
const
;
bool
Item_sum_avg_fix_length_and_dec
(
Item_sum_avg
*
)
const
;
bool
Item_sum_variance_fix_length_and_dec
(
Item_sum_variance
*
)
const
;
String
*
Item_func_hex_val_str_ascii
(
Item_func_hex
*
item
,
String
*
str
)
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
*
Item_func_hybrid_field_type_val_str
(
Item_func_hybrid_field_type
*
,
String
*
)
const
;
String
*
)
const
;
...
@@ -799,6 +831,9 @@ class Type_handler_temporal_result: public Type_handler
...
@@ -799,6 +831,9 @@ class Type_handler_temporal_result: public Type_handler
Item_cache
*
Item_get_cache
(
THD
*
thd
,
const
Item
*
item
)
const
;
Item_cache
*
Item_get_cache
(
THD
*
thd
,
const
Item
*
item
)
const
;
bool
set_comparator_func
(
Arg_comparator
*
cmp
)
const
;
bool
set_comparator_func
(
Arg_comparator
*
cmp
)
const
;
bool
Item_sum_hybrid_fix_length_and_dec
(
Item_sum_hybrid
*
func
)
const
;
bool
Item_sum_hybrid_fix_length_and_dec
(
Item_sum_hybrid
*
func
)
const
;
bool
Item_sum_sum_fix_length_and_dec
(
Item_sum_sum
*
)
const
;
bool
Item_sum_avg_fix_length_and_dec
(
Item_sum_avg
*
)
const
;
bool
Item_sum_variance_fix_length_and_dec
(
Item_sum_variance
*
)
const
;
String
*
Item_func_hex_val_str_ascii
(
Item_func_hex
*
item
,
String
*
str
)
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
*
Item_func_hybrid_field_type_val_str
(
Item_func_hybrid_field_type
*
,
String
*
)
const
;
String
*
)
const
;
...
@@ -860,6 +895,9 @@ class Type_handler_string_result: public Type_handler
...
@@ -860,6 +895,9 @@ class Type_handler_string_result: public Type_handler
bool
Item_hybrid_func_fix_attributes
(
THD
*
thd
,
Item_hybrid_func
*
func
,
bool
Item_hybrid_func_fix_attributes
(
THD
*
thd
,
Item_hybrid_func
*
func
,
Item
**
items
,
uint
nitems
)
const
;
Item
**
items
,
uint
nitems
)
const
;
bool
Item_sum_hybrid_fix_length_and_dec
(
Item_sum_hybrid
*
func
)
const
;
bool
Item_sum_hybrid_fix_length_and_dec
(
Item_sum_hybrid
*
func
)
const
;
bool
Item_sum_sum_fix_length_and_dec
(
Item_sum_sum
*
)
const
;
bool
Item_sum_avg_fix_length_and_dec
(
Item_sum_avg
*
)
const
;
bool
Item_sum_variance_fix_length_and_dec
(
Item_sum_variance
*
)
const
;
String
*
Item_func_hex_val_str_ascii
(
Item_func_hex
*
item
,
String
*
str
)
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
*
Item_func_hybrid_field_type_val_str
(
Item_func_hybrid_field_type
*
,
String
*
)
const
;
String
*
)
const
;
...
@@ -1307,6 +1345,9 @@ class Type_handler_geometry: public Type_handler_string_result
...
@@ -1307,6 +1345,9 @@ class Type_handler_geometry: public Type_handler_string_result
bool
Item_func_int_val_fix_length_and_dec
(
Item_func_int_val
*
)
const
;
bool
Item_func_int_val_fix_length_and_dec
(
Item_func_int_val
*
)
const
;
bool
Item_func_abs_fix_length_and_dec
(
Item_func_abs
*
)
const
;
bool
Item_func_abs_fix_length_and_dec
(
Item_func_abs
*
)
const
;
bool
Item_func_neg_fix_length_and_dec
(
Item_func_neg
*
)
const
;
bool
Item_func_neg_fix_length_and_dec
(
Item_func_neg
*
)
const
;
bool
Item_sum_sum_fix_length_and_dec
(
Item_sum_sum
*
)
const
;
bool
Item_sum_avg_fix_length_and_dec
(
Item_sum_avg
*
)
const
;
bool
Item_sum_variance_fix_length_and_dec
(
Item_sum_variance
*
)
const
;
};
};
extern
Type_handler_geometry
type_handler_geometry
;
extern
Type_handler_geometry
type_handler_geometry
;
...
...
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