diff options
author | Alexander Barkov <bar@mariadb.org> | 2017-10-01 00:30:58 +0400 |
---|---|---|
committer | Alexander Barkov <bar@mariadb.org> | 2017-10-01 00:30:58 +0400 |
commit | 6857cb57fe7090f131b272f31485b7a478a0b324 (patch) | |
tree | 44cd80409ab7d173b7263c55d3f37ddc8b6914ab | |
parent | aa582dedcbd22182e06355b94d1de4fc62f71910 (diff) | |
download | mariadb-git-6857cb57fe7090f131b272f31485b7a478a0b324.tar.gz |
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).
-rw-r--r-- | mysql-test/r/func_int.result | 97 | ||||
-rw-r--r-- | mysql-test/r/func_regexp.result | 6 | ||||
-rw-r--r-- | mysql-test/r/gis.result | 101 | ||||
-rw-r--r-- | mysql-test/suite/rpl/r/rpl_gtid_basic.result | 13 | ||||
-rw-r--r-- | mysql-test/suite/rpl/t/rpl_gtid_basic.test | 20 | ||||
-rw-r--r-- | mysql-test/t/func_int.test | 139 | ||||
-rw-r--r-- | mysql-test/t/func_regexp.test | 6 | ||||
-rw-r--r-- | mysql-test/t/gis.test | 109 | ||||
-rw-r--r-- | sql/item.cc | 15 | ||||
-rw-r--r-- | sql/item.h | 3 | ||||
-rw-r--r-- | sql/item_cmpfunc.h | 7 | ||||
-rw-r--r-- | sql/item_func.cc | 19 | ||||
-rw-r--r-- | sql/item_func.h | 63 | ||||
-rw-r--r-- | sql/item_inetfunc.h | 2 | ||||
-rw-r--r-- | sql/item_jsonfunc.h | 8 | ||||
-rw-r--r-- | sql/item_strfunc.h | 7 | ||||
-rw-r--r-- | sql/item_timefunc.h | 76 | ||||
-rw-r--r-- | sql/sql_type.h | 8 |
18 files changed, 660 insertions, 39 deletions
diff --git a/mysql-test/r/func_int.result b/mysql-test/r/func_int.result index 1d4620ff6ac..05573858b17 100644 --- a/mysql-test/r/func_int.result +++ b/mysql-test/r/func_int.result @@ -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 # diff --git a/mysql-test/r/func_regexp.result b/mysql-test/r/func_regexp.result index 53c58d5dddb..187df785f69 100644 --- a/mysql-test/r/func_regexp.result +++ b/mysql-test/r/func_regexp.result @@ -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 diff --git a/mysql-test/r/gis.result b/mysql-test/r/gis.result index ecc29bbb659..fe67da8001f 100644 --- a/mysql-test/r/gis.result +++ b/mysql-test/r/gis.result @@ -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 # diff --git a/mysql-test/suite/rpl/r/rpl_gtid_basic.result b/mysql-test/suite/rpl/r/rpl_gtid_basic.result index 3722e438d32..32df09789cc 100644 --- a/mysql-test/suite/rpl/r/rpl_gtid_basic.result +++ b/mysql-test/suite/rpl/r/rpl_gtid_basic.result @@ -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 +# diff --git a/mysql-test/suite/rpl/t/rpl_gtid_basic.test b/mysql-test/suite/rpl/t/rpl_gtid_basic.test index b04f82e1725..e14bf89425d 100644 --- a/mysql-test/suite/rpl/t/rpl_gtid_basic.test +++ b/mysql-test/suite/rpl/t/rpl_gtid_basic.test @@ -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 # diff --git a/mysql-test/t/func_int.test b/mysql-test/t/func_int.test index dac3d936f53..98794561933 100644 --- a/mysql-test/t/func_int.test +++ b/mysql-test/t/func_int.test @@ -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 # diff --git a/mysql-test/t/func_regexp.test b/mysql-test/t/func_regexp.test index d0ab0cc9044..6d5186269a5 100644 --- a/mysql-test/t/func_regexp.test +++ b/mysql-test/t/func_regexp.test @@ -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); + diff --git a/mysql-test/t/gis.test b/mysql-test/t/gis.test index b746ec2abfc..94e56774bf4 100644 --- a/mysql-test/t/gis.test +++ b/mysql-test/t/gis.test @@ -2878,5 +2878,114 @@ 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 # diff --git a/sql/item.cc b/sql/item.cc index c62ca8029d3..9f8e3df05f5 100644 --- a/sql/item.cc +++ b/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); diff --git a/sql/item.h b/sql/item.h index 7662d358b42..bb341959103 100644 --- a/sql/item.h +++ b/sql/item.h @@ -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 diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h index 0756899f47c..0cb66cd1d33 100644 --- a/sql/item_cmpfunc.h +++ b/sql/item_cmpfunc.h @@ -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: diff --git a/sql/item_func.cc b/sql/item_func.cc index 7db5e3bccc7..fc7417411e8 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -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_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_ascii(func_name())) + if (args[i]->check_type_can_return_str(func_name())) return true; } return false; diff --git a/sql/item_func.h b/sql/item_func.h index c061c713de5..605b17b540e 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -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) {} diff --git a/sql/item_inetfunc.h b/sql/item_inetfunc.h index 5d24835a625..13ce003a374 100644 --- a/sql/item_inetfunc.h +++ b/sql/item_inetfunc.h @@ -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(); diff --git a/sql/item_jsonfunc.h b/sql/item_jsonfunc.h index 7da72dc7f89..77e7588be25 100644 --- a/sql/item_jsonfunc.h +++ b/sql/item_jsonfunc.h @@ -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: diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h index d73bd0b76d7..1c35588f884 100644 --- a/sql/item_strfunc.h +++ b/sql/item_strfunc.h @@ -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(); diff --git a/sql/item_timefunc.h b/sql/item_timefunc.h index 6bbc37a78e2..65057a71c4e 100644 --- a/sql/item_timefunc.h +++ b/sql/item_timefunc.h @@ -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() diff --git a/sql/sql_type.h b/sql/sql_type.h index f570e91f882..910172134fd 100644 --- a/sql/sql_type.h +++ b/sql/sql_type.h @@ -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 |