MDEV-13967 Parameter data type control for Item_long_func
- Implementing stricter data type control for Item_long_func descendants - Cleanup: renaming Type_handler::can_return_str_ascii() to can_return_text() (a better name).
This commit is contained in:
parent
aa582dedcb
commit
6857cb57fe
@ -33,5 +33,102 @@ ERROR HY000: Illegal parameter data type row for operation 'inet_aton'
|
||||
SELECT LAST_INSERT_ID(ROW(1,1));
|
||||
ERROR HY000: Illegal parameter data type row for operation 'last_insert_id'
|
||||
#
|
||||
# MDEV-13967 Parameter data type control for Item_long_func
|
||||
#
|
||||
SELECT STRCMP(ROW(1,1),'');
|
||||
ERROR HY000: Illegal parameter data type row for operation 'strcmp'
|
||||
SELECT STRCMP('',ROW(1,1));
|
||||
ERROR HY000: Illegal parameter data type row for operation 'strcmp'
|
||||
SELECT CHAR_LENGTH(ROW(1,1));
|
||||
ERROR HY000: Illegal parameter data type row for operation 'char_length'
|
||||
SELECT OCTET_LENGTH(ROW(1,1));
|
||||
ERROR HY000: Illegal parameter data type row for operation 'octet_length'
|
||||
SELECT UNCOMPRESSED_LENGTH(ROW(1,1));
|
||||
ERROR HY000: Illegal parameter data type row for operation 'uncompressed_length'
|
||||
SELECT COERCIBILITY(ROW(1,1));
|
||||
ERROR HY000: Illegal parameter data type row for operation 'coercibility'
|
||||
SELECT ASCII(ROW(1,1));
|
||||
ERROR HY000: Illegal parameter data type row for operation 'ascii'
|
||||
SELECT CRC32(ROW(1,1));
|
||||
ERROR HY000: Illegal parameter data type row for operation 'crc32'
|
||||
SELECT ORD(ROW(1,1));
|
||||
ERROR HY000: Illegal parameter data type row for operation 'ord'
|
||||
SELECT SIGN(ROW(1,1));
|
||||
ERROR HY000: Illegal parameter data type row for operation 'sign'
|
||||
SELECT LOCATE(ROW(1,1),'a',1);
|
||||
ERROR HY000: Illegal parameter data type row for operation 'locate'
|
||||
SELECT LOCATE('a',ROW(1,1),1);
|
||||
ERROR HY000: Illegal parameter data type row for operation 'locate'
|
||||
SELECT LOCATE('a','a',ROW(1,1));
|
||||
ERROR HY000: Illegal parameter data type row for operation 'locate'
|
||||
SELECT BIT_COUNT(ROW(1,1));
|
||||
ERROR HY000: Illegal parameter data type row for operation 'bit_count'
|
||||
SELECT BENCHMARK(1, ROW(1,1));
|
||||
ERROR 21000: Operand should contain 1 column(s)
|
||||
SELECT BENCHMARK(ROW(1,1),'');
|
||||
ERROR HY000: Illegal parameter data type row for operation 'benchmark'
|
||||
SELECT SLEEP(ROW(1,1));
|
||||
ERROR HY000: Illegal parameter data type row for operation 'sleep'
|
||||
SELECT GET_LOCK('x', ROW(1,1));
|
||||
ERROR HY000: Illegal parameter data type row for operation 'get_lock'
|
||||
SELECT GET_LOCK(ROW(1,1),'x');
|
||||
ERROR HY000: Illegal parameter data type row for operation 'get_lock'
|
||||
SELECT PERIOD_ADD(ROW(1,1),1);
|
||||
ERROR HY000: Illegal parameter data type row for operation 'period_add'
|
||||
SELECT PERIOD_ADD(1,ROW(1,1));
|
||||
ERROR HY000: Illegal parameter data type row for operation 'period_add'
|
||||
SELECT PERIOD_DIFF(ROW(1,1),1);
|
||||
ERROR HY000: Illegal parameter data type row for operation 'period_diff'
|
||||
SELECT PERIOD_DIFF(1,ROW(1,1));
|
||||
ERROR HY000: Illegal parameter data type row for operation 'period_diff'
|
||||
SELECT TO_DAYS(ROW(1,1));
|
||||
ERROR HY000: Illegal parameter data type row for operation 'to_days'
|
||||
SELECT DAYOFMONTH(ROW(1,1));
|
||||
ERROR HY000: Illegal parameter data type row for operation 'dayofmonth'
|
||||
SELECT DAYOFYEAR(ROW(1,1));
|
||||
ERROR HY000: Illegal parameter data type row for operation 'dayofyear'
|
||||
SELECT QUARTER(ROW(1,1));
|
||||
ERROR HY000: Illegal parameter data type row for operation 'quarter'
|
||||
SELECT YEAR(ROW(1,1));
|
||||
ERROR HY000: Illegal parameter data type row for operation 'year'
|
||||
SELECT YEARWEEK(ROW(1,1));
|
||||
ERROR HY000: Illegal parameter data type row for operation 'yearweek'
|
||||
SELECT WEEK(ROW(1,1));
|
||||
ERROR HY000: Illegal parameter data type row for operation 'week'
|
||||
SELECT WEEK(ROW(1,1),1);
|
||||
ERROR HY000: Illegal parameter data type row for operation 'week'
|
||||
SELECT WEEK(1,ROW(1,1));
|
||||
ERROR HY000: Illegal parameter data type row for operation 'week'
|
||||
SELECT HOUR(ROW(1,1));
|
||||
ERROR HY000: Illegal parameter data type row for operation 'hour'
|
||||
SELECT MINUTE(ROW(1,1));
|
||||
ERROR HY000: Illegal parameter data type row for operation 'minute'
|
||||
SELECT SECOND(ROW(1,1));
|
||||
ERROR HY000: Illegal parameter data type row for operation 'second'
|
||||
SELECT MICROSECOND(ROW(1,1));
|
||||
ERROR HY000: Illegal parameter data type row for operation 'microsecond'
|
||||
SELECT JSON_DEPTH(ROW(1,1));
|
||||
ERROR HY000: Illegal parameter data type row for operation 'json_depth'
|
||||
SELECT JSON_LENGTH(ROW(1,1));
|
||||
ERROR HY000: Illegal parameter data type row for operation 'json_length'
|
||||
SELECT JSON_LENGTH('json', ROW(1,1));
|
||||
ERROR HY000: Illegal parameter data type row for operation 'json_length'
|
||||
SELECT JSON_LENGTH(ROW(1,1), ROW(1,1));
|
||||
ERROR HY000: Illegal parameter data type row for operation 'json_length'
|
||||
SELECT REGEXP_INSTR(ROW(1,1),'');
|
||||
ERROR HY000: Illegal parameter data type row for operation 'regexp_instr'
|
||||
SELECT REGEXP_INSTR('',ROW(1,1));
|
||||
ERROR HY000: Illegal parameter data type row for operation 'regexp_instr'
|
||||
SELECT FIND_IN_SET(ROW(1,1),'');
|
||||
ERROR HY000: Illegal parameter data type row for operation 'find_in_set'
|
||||
SELECT FIND_IN_SET('',ROW(1,1));
|
||||
ERROR HY000: Illegal parameter data type row for operation 'find_in_set'
|
||||
SELECT RELEASE_LOCK(ROW(1,1));
|
||||
ERROR HY000: Illegal parameter data type row for operation 'release_lock'
|
||||
SELECT IS_FREE_LOCK(ROW(1,1));
|
||||
ERROR HY000: Illegal parameter data type row for operation 'is_free_lock'
|
||||
SELECT IS_USED_LOCK(ROW(1,1));
|
||||
ERROR HY000: Illegal parameter data type row for operation 'is_used_lock'
|
||||
#
|
||||
# End of 10.3 tests
|
||||
#
|
||||
|
@ -157,3 +157,9 @@ SELECT ' ' REGEXP '[[:space:]]';
|
||||
SELECT '\t' REGEXP '[[:space:]]';
|
||||
'\t' REGEXP '[[:space:]]'
|
||||
1
|
||||
#
|
||||
# MDEV-13967 Parameter data type control for Item_long_func
|
||||
#
|
||||
SELECT REGEXP_INSTR('111222333',2);
|
||||
REGEXP_INSTR('111222333',2)
|
||||
4
|
||||
|
@ -4817,5 +4817,106 @@ ERROR HY000: Illegal parameter data type geometry for operation 'convert_tz'
|
||||
SELECT CONVERT_TZ(1, 1, POINT(1,1));
|
||||
ERROR HY000: Illegal parameter data type geometry for operation 'convert_tz'
|
||||
#
|
||||
# MDEV-13967 Parameter data type control for Item_long_func
|
||||
#
|
||||
SELECT STRCMP(POINT(1,1),POINT(1,1));
|
||||
STRCMP(POINT(1,1),POINT(1,1))
|
||||
0
|
||||
SELECT CHAR_LENGTH(POINT(1,1));
|
||||
CHAR_LENGTH(POINT(1,1))
|
||||
25
|
||||
SELECT OCTET_LENGTH(POINT(1,1));
|
||||
OCTET_LENGTH(POINT(1,1))
|
||||
25
|
||||
SELECT UNCOMPRESSED_LENGTH(POINT(1,1));
|
||||
UNCOMPRESSED_LENGTH(POINT(1,1))
|
||||
0
|
||||
SELECT COERCIBILITY(POINT(1,1));
|
||||
COERCIBILITY(POINT(1,1))
|
||||
4
|
||||
SELECT ASCII(POINT(1,1));
|
||||
ASCII(POINT(1,1))
|
||||
0
|
||||
SELECT CRC32(POINT(1,1));
|
||||
CRC32(POINT(1,1))
|
||||
1349318989
|
||||
SELECT ORD(POINT(1,1));
|
||||
ORD(POINT(1,1))
|
||||
0
|
||||
SELECT SIGN(POINT(1,1));
|
||||
ERROR HY000: Illegal parameter data type geometry for operation 'sign'
|
||||
SELECT LOCATE('a','a',POINT(1,1));
|
||||
ERROR HY000: Illegal parameter data type geometry for operation 'locate'
|
||||
SELECT LOCATE(POINT(1,1),POINT(1,1));
|
||||
LOCATE(POINT(1,1),POINT(1,1))
|
||||
1
|
||||
SELECT BIT_COUNT(POINT(1,1));
|
||||
ERROR HY000: Illegal parameter data type geometry for operation 'bit_count'
|
||||
SELECT BENCHMARK(POINT(1,1),'');
|
||||
ERROR HY000: Illegal parameter data type geometry for operation 'benchmark'
|
||||
SELECT SLEEP(POINT(1,1));
|
||||
ERROR HY000: Illegal parameter data type geometry for operation 'sleep'
|
||||
SELECT GET_LOCK('x', POINT(1,1));
|
||||
ERROR HY000: Illegal parameter data type geometry for operation 'get_lock'
|
||||
SELECT PERIOD_ADD(POINT(1,1),1);
|
||||
ERROR HY000: Illegal parameter data type geometry for operation 'period_add'
|
||||
SELECT PERIOD_ADD(1,POINT(1,1));
|
||||
ERROR HY000: Illegal parameter data type geometry for operation 'period_add'
|
||||
SELECT PERIOD_DIFF(POINT(1,1),1);
|
||||
ERROR HY000: Illegal parameter data type geometry for operation 'period_diff'
|
||||
SELECT PERIOD_DIFF(1,POINT(1,1));
|
||||
ERROR HY000: Illegal parameter data type geometry for operation 'period_diff'
|
||||
SELECT TO_DAYS(POINT(1,1));
|
||||
ERROR HY000: Illegal parameter data type geometry for operation 'to_days'
|
||||
SELECT DAYOFMONTH(POINT(1,1));
|
||||
ERROR HY000: Illegal parameter data type geometry for operation 'dayofmonth'
|
||||
SELECT DAYOFYEAR(POINT(1,1));
|
||||
ERROR HY000: Illegal parameter data type geometry for operation 'dayofyear'
|
||||
SELECT QUARTER(POINT(1,1));
|
||||
ERROR HY000: Illegal parameter data type geometry for operation 'quarter'
|
||||
SELECT YEAR(POINT(1,1));
|
||||
ERROR HY000: Illegal parameter data type geometry for operation 'year'
|
||||
SELECT YEARWEEK(POINT(1,1));
|
||||
ERROR HY000: Illegal parameter data type geometry for operation 'yearweek'
|
||||
SELECT WEEK(POINT(1,1));
|
||||
ERROR HY000: Illegal parameter data type geometry for operation 'week'
|
||||
SELECT WEEK(POINT(1,1),1);
|
||||
ERROR HY000: Illegal parameter data type geometry for operation 'week'
|
||||
SELECT WEEK(1,POINT(1,1));
|
||||
ERROR HY000: Illegal parameter data type geometry for operation 'week'
|
||||
SELECT HOUR(POINT(1,1));
|
||||
ERROR HY000: Illegal parameter data type geometry for operation 'hour'
|
||||
SELECT MINUTE(POINT(1,1));
|
||||
ERROR HY000: Illegal parameter data type geometry for operation 'minute'
|
||||
SELECT SECOND(POINT(1,1));
|
||||
ERROR HY000: Illegal parameter data type geometry for operation 'second'
|
||||
SELECT MICROSECOND(POINT(1,1));
|
||||
ERROR HY000: Illegal parameter data type geometry for operation 'microsecond'
|
||||
SELECT JSON_DEPTH(POINT(1,1));
|
||||
ERROR HY000: Illegal parameter data type geometry for operation 'json_depth'
|
||||
SELECT JSON_LENGTH(POINT(1,1));
|
||||
ERROR HY000: Illegal parameter data type geometry for operation 'json_length'
|
||||
SELECT JSON_LENGTH('json', POINT(1,1));
|
||||
ERROR HY000: Illegal parameter data type geometry for operation 'json_length'
|
||||
SELECT JSON_LENGTH(POINT(1,1), POINT(1,1));
|
||||
ERROR HY000: Illegal parameter data type geometry for operation 'json_length'
|
||||
SELECT REGEXP_INSTR(POINT(1,1),'');
|
||||
REGEXP_INSTR(POINT(1,1),'')
|
||||
1
|
||||
SELECT REGEXP_INSTR('',POINT(1,1));
|
||||
ERROR HY000: Illegal parameter data type geometry for operation 'regexp_instr'
|
||||
SELECT FIND_IN_SET(POINT(1,1),'');
|
||||
FIND_IN_SET(POINT(1,1),'')
|
||||
0
|
||||
SELECT FIND_IN_SET('',POINT(1,1));
|
||||
FIND_IN_SET('',POINT(1,1))
|
||||
0
|
||||
SELECT RELEASE_LOCK(POINT(1,1));
|
||||
ERROR HY000: Illegal parameter data type geometry for operation 'release_lock'
|
||||
SELECT IS_FREE_LOCK(POINT(1,1));
|
||||
ERROR HY000: Illegal parameter data type geometry for operation 'is_free_lock'
|
||||
SELECT IS_USED_LOCK(POINT(1,1));
|
||||
ERROR HY000: Illegal parameter data type geometry for operation 'is_used_lock'
|
||||
#
|
||||
# End of 10.3 tests
|
||||
#
|
||||
|
@ -568,3 +568,16 @@ ERROR HY000: Function or expression 'binlog_gtid_pos()' cannot be used in the DE
|
||||
#
|
||||
# End of 10.2 tests
|
||||
#
|
||||
#
|
||||
# Start of 10.3 tests
|
||||
#
|
||||
#
|
||||
# MDEV-13967 Parameter data type control for Item_long_func
|
||||
#
|
||||
SELECT MASTER_GTID_WAIT(ROW(1,1),'str');
|
||||
ERROR HY000: Illegal parameter data type row for operation 'master_gtid_wait'
|
||||
SELECT MASTER_GTID_WAIT('str',ROW(1,1));
|
||||
ERROR HY000: Illegal parameter data type row for operation 'master_gtid_wait'
|
||||
#
|
||||
# End of 10.3 tests
|
||||
#
|
||||
|
@ -14,3 +14,23 @@ CREATE TABLE t1 (a VARCHAR(100) DEFAULT BINLOG_GTID_POS("master-bin.000001", 600
|
||||
--echo #
|
||||
--echo # End of 10.2 tests
|
||||
--echo #
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # Start of 10.3 tests
|
||||
--echo #
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-13967 Parameter data type control for Item_long_func
|
||||
--echo #
|
||||
|
||||
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
|
||||
SELECT MASTER_GTID_WAIT(ROW(1,1),'str');
|
||||
|
||||
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
|
||||
SELECT MASTER_GTID_WAIT('str',ROW(1,1));
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # End of 10.3 tests
|
||||
--echo #
|
||||
|
@ -44,6 +44,145 @@ SELECT INET_ATON(ROW(1,1));
|
||||
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
|
||||
SELECT LAST_INSERT_ID(ROW(1,1));
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-13967 Parameter data type control for Item_long_func
|
||||
--echo #
|
||||
|
||||
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
|
||||
SELECT STRCMP(ROW(1,1),'');
|
||||
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
|
||||
SELECT STRCMP('',ROW(1,1));
|
||||
|
||||
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
|
||||
SELECT CHAR_LENGTH(ROW(1,1));
|
||||
|
||||
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
|
||||
SELECT OCTET_LENGTH(ROW(1,1));
|
||||
|
||||
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
|
||||
SELECT UNCOMPRESSED_LENGTH(ROW(1,1));
|
||||
|
||||
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
|
||||
SELECT COERCIBILITY(ROW(1,1));
|
||||
|
||||
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
|
||||
SELECT ASCII(ROW(1,1));
|
||||
|
||||
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
|
||||
SELECT CRC32(ROW(1,1));
|
||||
|
||||
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
|
||||
SELECT ORD(ROW(1,1));
|
||||
|
||||
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
|
||||
SELECT SIGN(ROW(1,1));
|
||||
|
||||
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
|
||||
SELECT LOCATE(ROW(1,1),'a',1);
|
||||
|
||||
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
|
||||
SELECT LOCATE('a',ROW(1,1),1);
|
||||
|
||||
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
|
||||
SELECT LOCATE('a','a',ROW(1,1));
|
||||
|
||||
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
|
||||
SELECT BIT_COUNT(ROW(1,1));
|
||||
|
||||
--error ER_OPERAND_COLUMNS
|
||||
SELECT BENCHMARK(1, ROW(1,1));
|
||||
|
||||
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
|
||||
SELECT BENCHMARK(ROW(1,1),'');
|
||||
|
||||
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
|
||||
SELECT SLEEP(ROW(1,1));
|
||||
|
||||
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
|
||||
SELECT GET_LOCK('x', ROW(1,1));
|
||||
|
||||
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
|
||||
SELECT GET_LOCK(ROW(1,1),'x');
|
||||
|
||||
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
|
||||
SELECT PERIOD_ADD(ROW(1,1),1);
|
||||
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
|
||||
SELECT PERIOD_ADD(1,ROW(1,1));
|
||||
|
||||
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
|
||||
SELECT PERIOD_DIFF(ROW(1,1),1);
|
||||
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
|
||||
SELECT PERIOD_DIFF(1,ROW(1,1));
|
||||
|
||||
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
|
||||
SELECT TO_DAYS(ROW(1,1));
|
||||
|
||||
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
|
||||
SELECT DAYOFMONTH(ROW(1,1));
|
||||
|
||||
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
|
||||
SELECT DAYOFYEAR(ROW(1,1));
|
||||
|
||||
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
|
||||
SELECT QUARTER(ROW(1,1));
|
||||
|
||||
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
|
||||
SELECT YEAR(ROW(1,1));
|
||||
|
||||
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
|
||||
SELECT YEARWEEK(ROW(1,1));
|
||||
|
||||
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
|
||||
SELECT WEEK(ROW(1,1));
|
||||
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
|
||||
SELECT WEEK(ROW(1,1),1);
|
||||
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
|
||||
SELECT WEEK(1,ROW(1,1));
|
||||
|
||||
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
|
||||
SELECT HOUR(ROW(1,1));
|
||||
|
||||
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
|
||||
SELECT MINUTE(ROW(1,1));
|
||||
|
||||
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
|
||||
SELECT SECOND(ROW(1,1));
|
||||
|
||||
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
|
||||
SELECT MICROSECOND(ROW(1,1));
|
||||
|
||||
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
|
||||
SELECT JSON_DEPTH(ROW(1,1));
|
||||
|
||||
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
|
||||
SELECT JSON_LENGTH(ROW(1,1));
|
||||
|
||||
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
|
||||
SELECT JSON_LENGTH('json', ROW(1,1));
|
||||
|
||||
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
|
||||
SELECT JSON_LENGTH(ROW(1,1), ROW(1,1));
|
||||
|
||||
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
|
||||
SELECT REGEXP_INSTR(ROW(1,1),'');
|
||||
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
|
||||
SELECT REGEXP_INSTR('',ROW(1,1));
|
||||
|
||||
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
|
||||
SELECT FIND_IN_SET(ROW(1,1),'');
|
||||
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
|
||||
SELECT FIND_IN_SET('',ROW(1,1));
|
||||
|
||||
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
|
||||
SELECT RELEASE_LOCK(ROW(1,1));
|
||||
|
||||
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
|
||||
SELECT IS_FREE_LOCK(ROW(1,1));
|
||||
|
||||
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
|
||||
SELECT IS_USED_LOCK(ROW(1,1));
|
||||
|
||||
--echo #
|
||||
--echo # End of 10.3 tests
|
||||
--echo #
|
||||
|
@ -104,3 +104,9 @@ SELECT '\t' REGEXP '[[:blank:]]';
|
||||
|
||||
SELECT ' ' REGEXP '[[:space:]]';
|
||||
SELECT '\t' REGEXP '[[:space:]]';
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-13967 Parameter data type control for Item_long_func
|
||||
--echo #
|
||||
SELECT REGEXP_INSTR('111222333',2);
|
||||
|
||||
|
@ -2877,6 +2877,115 @@ SELECT CONVERT_TZ(1, POINT(1,1), 1);
|
||||
SELECT CONVERT_TZ(1, 1, POINT(1,1));
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-13967 Parameter data type control for Item_long_func
|
||||
--echo #
|
||||
|
||||
SELECT STRCMP(POINT(1,1),POINT(1,1));
|
||||
SELECT CHAR_LENGTH(POINT(1,1));
|
||||
SELECT OCTET_LENGTH(POINT(1,1));
|
||||
SELECT UNCOMPRESSED_LENGTH(POINT(1,1));
|
||||
SELECT COERCIBILITY(POINT(1,1));
|
||||
SELECT ASCII(POINT(1,1));
|
||||
SELECT CRC32(POINT(1,1));
|
||||
SELECT ORD(POINT(1,1));
|
||||
|
||||
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
|
||||
SELECT SIGN(POINT(1,1));
|
||||
|
||||
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
|
||||
SELECT LOCATE('a','a',POINT(1,1));
|
||||
|
||||
SELECT LOCATE(POINT(1,1),POINT(1,1));
|
||||
|
||||
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
|
||||
SELECT BIT_COUNT(POINT(1,1));
|
||||
|
||||
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
|
||||
SELECT BENCHMARK(POINT(1,1),'');
|
||||
|
||||
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
|
||||
SELECT SLEEP(POINT(1,1));
|
||||
|
||||
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
|
||||
SELECT GET_LOCK('x', POINT(1,1));
|
||||
|
||||
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
|
||||
SELECT PERIOD_ADD(POINT(1,1),1);
|
||||
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
|
||||
SELECT PERIOD_ADD(1,POINT(1,1));
|
||||
|
||||
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
|
||||
SELECT PERIOD_DIFF(POINT(1,1),1);
|
||||
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
|
||||
SELECT PERIOD_DIFF(1,POINT(1,1));
|
||||
|
||||
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
|
||||
SELECT TO_DAYS(POINT(1,1));
|
||||
|
||||
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
|
||||
SELECT DAYOFMONTH(POINT(1,1));
|
||||
|
||||
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
|
||||
SELECT DAYOFYEAR(POINT(1,1));
|
||||
|
||||
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
|
||||
SELECT QUARTER(POINT(1,1));
|
||||
|
||||
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
|
||||
SELECT YEAR(POINT(1,1));
|
||||
|
||||
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
|
||||
SELECT YEARWEEK(POINT(1,1));
|
||||
|
||||
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
|
||||
SELECT WEEK(POINT(1,1));
|
||||
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
|
||||
SELECT WEEK(POINT(1,1),1);
|
||||
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
|
||||
SELECT WEEK(1,POINT(1,1));
|
||||
|
||||
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
|
||||
SELECT HOUR(POINT(1,1));
|
||||
|
||||
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
|
||||
SELECT MINUTE(POINT(1,1));
|
||||
|
||||
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
|
||||
SELECT SECOND(POINT(1,1));
|
||||
|
||||
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
|
||||
SELECT MICROSECOND(POINT(1,1));
|
||||
|
||||
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
|
||||
SELECT JSON_DEPTH(POINT(1,1));
|
||||
|
||||
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
|
||||
SELECT JSON_LENGTH(POINT(1,1));
|
||||
|
||||
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
|
||||
SELECT JSON_LENGTH('json', POINT(1,1));
|
||||
|
||||
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
|
||||
SELECT JSON_LENGTH(POINT(1,1), POINT(1,1));
|
||||
|
||||
SELECT REGEXP_INSTR(POINT(1,1),'');
|
||||
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
|
||||
SELECT REGEXP_INSTR('',POINT(1,1));
|
||||
|
||||
SELECT FIND_IN_SET(POINT(1,1),'');
|
||||
SELECT FIND_IN_SET('',POINT(1,1));
|
||||
|
||||
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
|
||||
SELECT RELEASE_LOCK(POINT(1,1));
|
||||
|
||||
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
|
||||
SELECT IS_FREE_LOCK(POINT(1,1));
|
||||
|
||||
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
|
||||
SELECT IS_USED_LOCK(POINT(1,1));
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # End of 10.3 tests
|
||||
--echo #
|
||||
|
15
sql/item.cc
15
sql/item.cc
@ -1113,10 +1113,21 @@ bool Item::check_type_can_return_time(const char *opname) const
|
||||
}
|
||||
|
||||
|
||||
bool Item::check_type_can_return_str_ascii(const char *opname) const
|
||||
bool Item::check_type_can_return_str(const char *opname) const
|
||||
{
|
||||
const Type_handler *handler= type_handler();
|
||||
if (handler->can_return_str_ascii())
|
||||
if (handler->can_return_str())
|
||||
return false;
|
||||
my_error(ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION, MYF(0),
|
||||
handler->name().ptr(), opname);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool Item::check_type_can_return_text(const char *opname) const
|
||||
{
|
||||
const Type_handler *handler= type_handler();
|
||||
if (handler->can_return_text())
|
||||
return false;
|
||||
my_error(ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION, MYF(0),
|
||||
handler->name().ptr(), opname);
|
||||
|
@ -1712,7 +1712,8 @@ public:
|
||||
bool check_type_can_return_int(const char *opname) const;
|
||||
bool check_type_can_return_decimal(const char *opname) const;
|
||||
bool check_type_can_return_real(const char *opname) const;
|
||||
bool check_type_can_return_str_ascii(const char *opname) const;
|
||||
bool check_type_can_return_str(const char *opname) const;
|
||||
bool check_type_can_return_text(const char *opname) const;
|
||||
bool check_type_can_return_date(const char *opname) const;
|
||||
bool check_type_can_return_time(const char *opname) const;
|
||||
// It is not row => null inside is impossible
|
||||
|
@ -930,6 +930,8 @@ public:
|
||||
|
||||
class Item_func_strcmp :public Item_long_func
|
||||
{
|
||||
bool check_arguments() const
|
||||
{ return check_argument_types_can_return_str(0, 2); }
|
||||
String value1, value2;
|
||||
DTCollation cmp_collation;
|
||||
public:
|
||||
@ -2829,6 +2831,11 @@ public:
|
||||
*/
|
||||
class Item_func_regexp_instr :public Item_long_func
|
||||
{
|
||||
bool check_arguments() const
|
||||
{
|
||||
return args[0]->check_type_can_return_str(func_name()) ||
|
||||
args[1]->check_type_can_return_text(func_name());
|
||||
}
|
||||
Regexp_processor_pcre re;
|
||||
DTCollation cmp_collation;
|
||||
public:
|
||||
|
@ -218,13 +218,26 @@ bool Item_func::check_argument_types_can_return_real(uint start,
|
||||
}
|
||||
|
||||
|
||||
bool Item_func::check_argument_types_can_return_str_ascii(uint start,
|
||||
uint end) const
|
||||
bool Item_func::check_argument_types_can_return_text(uint start,
|
||||
uint end) const
|
||||
{
|
||||
for (uint i= start; i < end ; i++)
|
||||
{
|
||||
DBUG_ASSERT(i < arg_count);
|
||||
if (args[i]->check_type_can_return_str_ascii(func_name()))
|
||||
if (args[i]->check_type_can_return_text(func_name()))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool Item_func::check_argument_types_can_return_str(uint start,
|
||||
uint end) const
|
||||
{
|
||||
for (uint i= start; i < end ; i++)
|
||||
{
|
||||
DBUG_ASSERT(i < arg_count);
|
||||
if (args[i]->check_type_can_return_str(func_name()))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -48,7 +48,8 @@ protected:
|
||||
uint start, uint end) const;
|
||||
bool check_argument_types_can_return_int(uint start, uint end) const;
|
||||
bool check_argument_types_can_return_real(uint start, uint end) const;
|
||||
bool check_argument_types_can_return_str_ascii(uint start, uint end) const;
|
||||
bool check_argument_types_can_return_str(uint start, uint end) const;
|
||||
bool check_argument_types_can_return_text(uint start, uint end) const;
|
||||
bool check_argument_types_can_return_date(uint start, uint end) const;
|
||||
bool check_argument_types_can_return_time(uint start, uint end) const;
|
||||
public:
|
||||
@ -1433,6 +1434,8 @@ private:
|
||||
|
||||
class Item_func_sign :public Item_long_func
|
||||
{
|
||||
bool check_arguments() const
|
||||
{ return args[0]->check_type_can_return_real(func_name()); }
|
||||
public:
|
||||
Item_func_sign(THD *thd, Item *a): Item_long_func(thd, a) {}
|
||||
const char *func_name() const { return "sign"; }
|
||||
@ -1599,14 +1602,23 @@ public:
|
||||
};
|
||||
|
||||
|
||||
class Item_func_octet_length :public Item_long_func
|
||||
class Item_long_func_length: public Item_long_func
|
||||
{
|
||||
bool check_arguments() const
|
||||
{ return args[0]->check_type_can_return_str(func_name()); }
|
||||
public:
|
||||
Item_long_func_length(THD *thd, Item *a): Item_long_func(thd, a) {}
|
||||
void fix_length_and_dec() { max_length=10; }
|
||||
};
|
||||
|
||||
|
||||
class Item_func_octet_length :public Item_long_func_length
|
||||
{
|
||||
String value;
|
||||
public:
|
||||
Item_func_octet_length(THD *thd, Item *a): Item_long_func(thd, a) {}
|
||||
Item_func_octet_length(THD *thd, Item *a): Item_long_func_length(thd, a) {}
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "octet_length"; }
|
||||
void fix_length_and_dec() { max_length=10; }
|
||||
Item *get_copy(THD *thd, MEM_ROOT *mem_root)
|
||||
{ return get_item_copy<Item_func_octet_length>(thd, mem_root, this); }
|
||||
};
|
||||
@ -1626,20 +1638,21 @@ public:
|
||||
{ return get_item_copy<Item_func_bit_length>(thd, mem_root, this); }
|
||||
};
|
||||
|
||||
class Item_func_char_length :public Item_long_func
|
||||
class Item_func_char_length :public Item_long_func_length
|
||||
{
|
||||
String value;
|
||||
public:
|
||||
Item_func_char_length(THD *thd, Item *a): Item_long_func(thd, a) {}
|
||||
Item_func_char_length(THD *thd, Item *a): Item_long_func_length(thd, a) {}
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "char_length"; }
|
||||
void fix_length_and_dec() { max_length=10; }
|
||||
Item *get_copy(THD *thd, MEM_ROOT *mem_root)
|
||||
{ return get_item_copy<Item_func_char_length>(thd, mem_root, this); }
|
||||
};
|
||||
|
||||
class Item_func_coercibility :public Item_long_func
|
||||
{
|
||||
bool check_arguments() const
|
||||
{ return args[0]->check_type_can_return_str(func_name()); }
|
||||
public:
|
||||
Item_func_coercibility(THD *thd, Item *a): Item_long_func(thd, a) {}
|
||||
longlong val_int();
|
||||
@ -1666,6 +1679,11 @@ public:
|
||||
*/
|
||||
class Item_func_locate :public Item_long_func
|
||||
{
|
||||
bool check_arguments() const
|
||||
{
|
||||
return check_argument_types_can_return_str(0, 2) ||
|
||||
(arg_count > 2 && args[2]->check_type_can_return_int(func_name()));
|
||||
}
|
||||
String value1,value2;
|
||||
DTCollation cmp_collation;
|
||||
public:
|
||||
@ -1703,6 +1721,8 @@ public:
|
||||
|
||||
class Item_func_ascii :public Item_long_func
|
||||
{
|
||||
bool check_arguments() const
|
||||
{ return check_argument_types_can_return_str(0, arg_count); }
|
||||
String value;
|
||||
public:
|
||||
Item_func_ascii(THD *thd, Item *a): Item_long_func(thd, a) {}
|
||||
@ -1715,6 +1735,8 @@ public:
|
||||
|
||||
class Item_func_ord :public Item_long_func
|
||||
{
|
||||
bool check_arguments() const
|
||||
{ return args[0]->check_type_can_return_str(func_name()); }
|
||||
String value;
|
||||
public:
|
||||
Item_func_ord(THD *thd, Item *a): Item_long_func(thd, a) {}
|
||||
@ -1727,6 +1749,8 @@ public:
|
||||
|
||||
class Item_func_find_in_set :public Item_long_func
|
||||
{
|
||||
bool check_arguments() const
|
||||
{ return check_argument_types_can_return_str(0, 2); }
|
||||
String value,value2;
|
||||
uint enum_value;
|
||||
ulonglong enum_bit;
|
||||
@ -1783,6 +1807,8 @@ public:
|
||||
|
||||
class Item_func_bit_count :public Item_long_func
|
||||
{
|
||||
bool check_arguments() const
|
||||
{ return args[0]->check_type_can_return_int(func_name()); }
|
||||
public:
|
||||
Item_func_bit_count(THD *thd, Item *a): Item_long_func(thd, a) {}
|
||||
longlong val_int();
|
||||
@ -1858,6 +1884,11 @@ public:
|
||||
|
||||
class Item_func_benchmark :public Item_long_func
|
||||
{
|
||||
bool check_arguments() const
|
||||
{
|
||||
return args[0]->check_type_can_return_int(func_name()) ||
|
||||
args[1]->check_type_scalar(func_name());
|
||||
}
|
||||
public:
|
||||
Item_func_benchmark(THD *thd, Item *count_expr, Item *expr):
|
||||
Item_long_func(thd, count_expr, expr)
|
||||
@ -1880,6 +1911,8 @@ void item_func_sleep_free(void);
|
||||
|
||||
class Item_func_sleep :public Item_long_func
|
||||
{
|
||||
bool check_arguments() const
|
||||
{ return args[0]->check_type_can_return_real(func_name()); }
|
||||
public:
|
||||
Item_func_sleep(THD *thd, Item *a): Item_long_func(thd, a) {}
|
||||
void fix_length_and_dec() { fix_char_length(1); }
|
||||
@ -2160,6 +2193,11 @@ void mysql_ull_set_explicit_lock_duration(THD *thd);
|
||||
|
||||
class Item_func_get_lock :public Item_long_func
|
||||
{
|
||||
bool check_arguments() const
|
||||
{
|
||||
return args[0]->check_type_general_purpose_string(func_name()) ||
|
||||
args[1]->check_type_can_return_real(func_name());
|
||||
}
|
||||
String value;
|
||||
public:
|
||||
Item_func_get_lock(THD *thd, Item *a, Item *b) :Item_long_func(thd, a, b) {}
|
||||
@ -2182,6 +2220,8 @@ class Item_func_get_lock :public Item_long_func
|
||||
|
||||
class Item_func_release_lock :public Item_long_func
|
||||
{
|
||||
bool check_arguments() const
|
||||
{ return args[0]->check_type_general_purpose_string(func_name()); }
|
||||
String value;
|
||||
public:
|
||||
Item_func_release_lock(THD *thd, Item *a): Item_long_func(thd, a) {}
|
||||
@ -2236,6 +2276,11 @@ public:
|
||||
|
||||
class Item_master_gtid_wait :public Item_long_func
|
||||
{
|
||||
bool check_arguments() const
|
||||
{
|
||||
return args[0]->check_type_general_purpose_string(func_name()) ||
|
||||
(arg_count > 1 && args[1]->check_type_can_return_real(func_name()));
|
||||
}
|
||||
String value;
|
||||
public:
|
||||
Item_master_gtid_wait(THD *thd, Item *a)
|
||||
@ -2599,6 +2644,8 @@ public:
|
||||
|
||||
class Item_func_is_free_lock :public Item_long_func
|
||||
{
|
||||
bool check_arguments() const
|
||||
{ return args[0]->check_type_general_purpose_string(func_name()); }
|
||||
String value;
|
||||
public:
|
||||
Item_func_is_free_lock(THD *thd, Item *a): Item_long_func(thd, a) {}
|
||||
@ -2615,6 +2662,8 @@ public:
|
||||
|
||||
class Item_func_is_used_lock :public Item_long_func
|
||||
{
|
||||
bool check_arguments() const
|
||||
{ return args[0]->check_type_general_purpose_string(func_name()); }
|
||||
String value;
|
||||
public:
|
||||
Item_func_is_used_lock(THD *thd, Item *a): Item_long_func(thd, a) {}
|
||||
|
@ -27,7 +27,7 @@
|
||||
class Item_func_inet_aton : public Item_longlong_func
|
||||
{
|
||||
bool check_arguments() const
|
||||
{ return check_argument_types_can_return_str_ascii(0, arg_count); }
|
||||
{ return check_argument_types_can_return_text(0, arg_count); }
|
||||
public:
|
||||
Item_func_inet_aton(THD *thd, Item *a): Item_longlong_func(thd, a) {}
|
||||
longlong val_int();
|
||||
|
@ -295,6 +295,12 @@ public:
|
||||
|
||||
class Item_func_json_length: public Item_long_func
|
||||
{
|
||||
bool check_arguments() const
|
||||
{
|
||||
return args[0]->check_type_can_return_text(func_name()) ||
|
||||
(arg_count > 1 &&
|
||||
args[1]->check_type_general_purpose_string(func_name()));
|
||||
}
|
||||
protected:
|
||||
json_path_with_flags path;
|
||||
String tmp_js;
|
||||
@ -312,6 +318,8 @@ public:
|
||||
|
||||
class Item_func_json_depth: public Item_long_func
|
||||
{
|
||||
bool check_arguments() const
|
||||
{ return args[0]->check_type_can_return_text(func_name()); }
|
||||
protected:
|
||||
String tmp_js;
|
||||
public:
|
||||
|
@ -1451,6 +1451,8 @@ public:
|
||||
|
||||
class Item_func_crc32 :public Item_long_func
|
||||
{
|
||||
bool check_arguments() const
|
||||
{ return args[0]->check_type_can_return_str(func_name()); }
|
||||
String value;
|
||||
public:
|
||||
Item_func_crc32(THD *thd, Item *a): Item_long_func(thd, a)
|
||||
@ -1462,11 +1464,12 @@ public:
|
||||
{ return get_item_copy<Item_func_crc32>(thd, mem_root, this); }
|
||||
};
|
||||
|
||||
class Item_func_uncompressed_length : public Item_long_func
|
||||
class Item_func_uncompressed_length : public Item_long_func_length
|
||||
{
|
||||
String value;
|
||||
public:
|
||||
Item_func_uncompressed_length(THD *thd, Item *a): Item_long_func(thd, a) {}
|
||||
Item_func_uncompressed_length(THD *thd, Item *a)
|
||||
:Item_long_func_length(thd, a) {}
|
||||
const char *func_name() const{return "uncompressed_length";}
|
||||
void fix_length_and_dec() { max_length=10; maybe_null= true; }
|
||||
longlong val_int();
|
||||
|
@ -33,8 +33,31 @@ enum date_time_format_types
|
||||
|
||||
bool get_interval_value(Item *args,interval_type int_type, INTERVAL *interval);
|
||||
|
||||
|
||||
class Item_long_func_date_field: public Item_long_func
|
||||
{
|
||||
bool check_arguments() const
|
||||
{ return args[0]->check_type_can_return_date(func_name()); }
|
||||
public:
|
||||
Item_long_func_date_field(THD *thd, Item *a)
|
||||
:Item_long_func(thd, a) { }
|
||||
};
|
||||
|
||||
|
||||
class Item_long_func_time_field: public Item_long_func
|
||||
{
|
||||
bool check_arguments() const
|
||||
{ return args[0]->check_type_can_return_time(func_name()); }
|
||||
public:
|
||||
Item_long_func_time_field(THD *thd, Item *a)
|
||||
:Item_long_func(thd, a) { }
|
||||
};
|
||||
|
||||
|
||||
class Item_func_period_add :public Item_long_func
|
||||
{
|
||||
bool check_arguments() const
|
||||
{ return check_argument_types_can_return_int(0, 2); }
|
||||
public:
|
||||
Item_func_period_add(THD *thd, Item *a, Item *b): Item_long_func(thd, a, b) {}
|
||||
longlong val_int();
|
||||
@ -50,6 +73,8 @@ public:
|
||||
|
||||
class Item_func_period_diff :public Item_long_func
|
||||
{
|
||||
bool check_arguments() const
|
||||
{ return check_argument_types_can_return_int(0, 2); }
|
||||
public:
|
||||
Item_func_period_diff(THD *thd, Item *a, Item *b): Item_long_func(thd, a, b) {}
|
||||
longlong val_int();
|
||||
@ -64,10 +89,10 @@ public:
|
||||
};
|
||||
|
||||
|
||||
class Item_func_to_days :public Item_long_func
|
||||
class Item_func_to_days :public Item_long_func_date_field
|
||||
{
|
||||
public:
|
||||
Item_func_to_days(THD *thd, Item *a): Item_long_func(thd, a) {}
|
||||
Item_func_to_days(THD *thd, Item *a): Item_long_func_date_field(thd, a) {}
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "to_days"; }
|
||||
void fix_length_and_dec()
|
||||
@ -117,10 +142,10 @@ public:
|
||||
};
|
||||
|
||||
|
||||
class Item_func_dayofmonth :public Item_long_func
|
||||
class Item_func_dayofmonth :public Item_long_func_date_field
|
||||
{
|
||||
public:
|
||||
Item_func_dayofmonth(THD *thd, Item *a): Item_long_func(thd, a) {}
|
||||
Item_func_dayofmonth(THD *thd, Item *a): Item_long_func_date_field(thd, a) {}
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "dayofmonth"; }
|
||||
void fix_length_and_dec()
|
||||
@ -197,10 +222,10 @@ public:
|
||||
};
|
||||
|
||||
|
||||
class Item_func_dayofyear :public Item_long_func
|
||||
class Item_func_dayofyear :public Item_long_func_date_field
|
||||
{
|
||||
public:
|
||||
Item_func_dayofyear(THD *thd, Item *a): Item_long_func(thd, a) {}
|
||||
Item_func_dayofyear(THD *thd, Item *a): Item_long_func_date_field(thd, a) {}
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "dayofyear"; }
|
||||
void fix_length_and_dec()
|
||||
@ -220,10 +245,10 @@ public:
|
||||
};
|
||||
|
||||
|
||||
class Item_func_hour :public Item_long_func
|
||||
class Item_func_hour :public Item_long_func_time_field
|
||||
{
|
||||
public:
|
||||
Item_func_hour(THD *thd, Item *a): Item_long_func(thd, a) {}
|
||||
Item_func_hour(THD *thd, Item *a): Item_long_func_time_field(thd, a) {}
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "hour"; }
|
||||
void fix_length_and_dec()
|
||||
@ -243,10 +268,10 @@ public:
|
||||
};
|
||||
|
||||
|
||||
class Item_func_minute :public Item_long_func
|
||||
class Item_func_minute :public Item_long_func_time_field
|
||||
{
|
||||
public:
|
||||
Item_func_minute(THD *thd, Item *a): Item_long_func(thd, a) {}
|
||||
Item_func_minute(THD *thd, Item *a): Item_long_func_time_field(thd, a) {}
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "minute"; }
|
||||
void fix_length_and_dec()
|
||||
@ -266,10 +291,10 @@ public:
|
||||
};
|
||||
|
||||
|
||||
class Item_func_quarter :public Item_long_func
|
||||
class Item_func_quarter :public Item_long_func_date_field
|
||||
{
|
||||
public:
|
||||
Item_func_quarter(THD *thd, Item *a): Item_long_func(thd, a) {}
|
||||
Item_func_quarter(THD *thd, Item *a): Item_long_func_date_field(thd, a) {}
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "quarter"; }
|
||||
void fix_length_and_dec()
|
||||
@ -289,10 +314,10 @@ public:
|
||||
};
|
||||
|
||||
|
||||
class Item_func_second :public Item_long_func
|
||||
class Item_func_second :public Item_long_func_time_field
|
||||
{
|
||||
public:
|
||||
Item_func_second(THD *thd, Item *a): Item_long_func(thd, a) {}
|
||||
Item_func_second(THD *thd, Item *a): Item_long_func_time_field(thd, a) {}
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "second"; }
|
||||
void fix_length_and_dec()
|
||||
@ -314,6 +339,11 @@ public:
|
||||
|
||||
class Item_func_week :public Item_long_func
|
||||
{
|
||||
bool check_arguments() const
|
||||
{
|
||||
return args[0]->check_type_can_return_date(func_name()) ||
|
||||
(arg_count > 1 && args[1]->check_type_can_return_int(func_name()));
|
||||
}
|
||||
public:
|
||||
Item_func_week(THD *thd, Item *a): Item_long_func(thd, a) {}
|
||||
Item_func_week(THD *thd, Item *a, Item *b): Item_long_func(thd, a, b) {}
|
||||
@ -341,8 +371,14 @@ public:
|
||||
|
||||
class Item_func_yearweek :public Item_long_func
|
||||
{
|
||||
bool check_arguments() const
|
||||
{
|
||||
return args[0]->check_type_can_return_date(func_name()) ||
|
||||
args[1]->check_type_can_return_int(func_name());
|
||||
}
|
||||
public:
|
||||
Item_func_yearweek(THD *thd, Item *a, Item *b): Item_long_func(thd, a, b) {}
|
||||
Item_func_yearweek(THD *thd, Item *a, Item *b)
|
||||
:Item_long_func(thd, a, b) {}
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "yearweek"; }
|
||||
void fix_length_and_dec()
|
||||
@ -362,10 +398,10 @@ public:
|
||||
};
|
||||
|
||||
|
||||
class Item_func_year :public Item_long_func
|
||||
class Item_func_year :public Item_long_func_date_field
|
||||
{
|
||||
public:
|
||||
Item_func_year(THD *thd, Item *a): Item_long_func(thd, a) {}
|
||||
Item_func_year(THD *thd, Item *a): Item_long_func_date_field(thd, a) {}
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "year"; }
|
||||
enum_monotonicity_info get_monotonicity_info() const;
|
||||
@ -872,7 +908,7 @@ class Item_func_convert_tz :public Item_datetimefunc
|
||||
bool check_arguments() const
|
||||
{
|
||||
return args[0]->check_type_can_return_date(func_name()) ||
|
||||
check_argument_types_can_return_str_ascii(1, arg_count);
|
||||
check_argument_types_can_return_text(1, arg_count);
|
||||
}
|
||||
/*
|
||||
If time zone parameters are constants we are caching objects that
|
||||
@ -1211,10 +1247,10 @@ public:
|
||||
};
|
||||
|
||||
|
||||
class Item_func_microsecond :public Item_long_func
|
||||
class Item_func_microsecond :public Item_long_func_time_field
|
||||
{
|
||||
public:
|
||||
Item_func_microsecond(THD *thd, Item *a): Item_long_func(thd, a) {}
|
||||
Item_func_microsecond(THD *thd, Item *a): Item_long_func_time_field(thd, a) {}
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "microsecond"; }
|
||||
void fix_length_and_dec()
|
||||
|
@ -706,7 +706,8 @@ public:
|
||||
virtual bool can_return_int() const { return true; }
|
||||
virtual bool can_return_decimal() const { return true; }
|
||||
virtual bool can_return_real() const { return true; }
|
||||
virtual bool can_return_str_ascii() const { return true; }
|
||||
virtual bool can_return_str() const { return true; }
|
||||
virtual bool can_return_text() const { return true; }
|
||||
virtual bool can_return_date() const { return true; }
|
||||
virtual bool can_return_time() const { return true; }
|
||||
virtual bool is_general_purpose_string_type() const { return false; }
|
||||
@ -1007,7 +1008,8 @@ public:
|
||||
bool can_return_int() const { return false; }
|
||||
bool can_return_decimal() const { return false; }
|
||||
bool can_return_real() const { return false; }
|
||||
bool can_return_str_ascii() const { return false; }
|
||||
bool can_return_str() const { return false; }
|
||||
bool can_return_text() const { return false; }
|
||||
bool can_return_date() const { return false; }
|
||||
bool can_return_time() const { return false; }
|
||||
enum_field_types field_type() const
|
||||
@ -2683,7 +2685,7 @@ public:
|
||||
bool can_return_int() const { return false; }
|
||||
bool can_return_decimal() const { return false; }
|
||||
bool can_return_real() const { return false; }
|
||||
bool can_return_str_ascii() const { return false; }
|
||||
bool can_return_text() const { return false; }
|
||||
bool can_return_date() const { return false; }
|
||||
bool can_return_time() const { return false; }
|
||||
bool is_traditional_type() const
|
||||
|
Loading…
x
Reference in New Issue
Block a user