mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
MDEV-12854 Synchronize CREATE..SELECT data type and result set metadata data type for INT functions
This commit is contained in:
@ -382,7 +382,7 @@ create table t1 as select concat(sign(0.5)) as c1;
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` varbinary(21) DEFAULT NULL
|
||||
`c1` varbinary(2) DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
||||
create table t1 as select concat(rand()) as c1;
|
||||
@ -419,7 +419,7 @@ create table t1 as select concat(bit_length('a')) as c1;
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` varbinary(10) DEFAULT NULL
|
||||
`c1` varbinary(11) DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
||||
select hex(concat(coercibility('a')));
|
||||
@ -469,7 +469,7 @@ create table t1 as select concat(ord(61)) as c1;
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` varbinary(21) DEFAULT NULL
|
||||
`c1` varbinary(7) DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
||||
select hex(concat(find_in_set('b','a,b,c,d')));
|
||||
@ -696,7 +696,7 @@ create table t1 as select concat(sleep(0)) as c1;
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` varbinary(21) DEFAULT NULL
|
||||
`c1` varbinary(1) DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
||||
select hex(concat(is_free_lock('xxxx')));
|
||||
@ -1447,7 +1447,7 @@ create table t1 as select concat(microsecond('12:00:00.123456')) as c1;
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` varbinary(21) DEFAULT NULL
|
||||
`c1` varbinary(6) DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
||||
select hex(concat(month(20090224)));
|
||||
|
@ -791,7 +791,7 @@ create table t1 as select concat(sign(0.5)) as c1;
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` varchar(21) CHARACTER SET cp1251 DEFAULT NULL
|
||||
`c1` varchar(2) CHARACTER SET cp1251 DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
||||
create table t1 as select concat(rand()) as c1;
|
||||
@ -828,7 +828,7 @@ create table t1 as select concat(bit_length('a')) as c1;
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` varchar(10) CHARACTER SET cp1251 DEFAULT NULL
|
||||
`c1` varchar(11) CHARACTER SET cp1251 DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
||||
select hex(concat(coercibility('a')));
|
||||
@ -878,7 +878,7 @@ create table t1 as select concat(ord(61)) as c1;
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` varchar(21) CHARACTER SET cp1251 DEFAULT NULL
|
||||
`c1` varchar(7) CHARACTER SET cp1251 DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
||||
select hex(concat(find_in_set('b','a,b,c,d')));
|
||||
@ -1105,7 +1105,7 @@ create table t1 as select concat(sleep(0)) as c1;
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` varchar(21) CHARACTER SET cp1251 DEFAULT NULL
|
||||
`c1` varchar(1) CHARACTER SET cp1251 DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
||||
select hex(concat(is_free_lock('xxxx')));
|
||||
@ -1856,7 +1856,7 @@ create table t1 as select concat(microsecond('12:00:00.123456')) as c1;
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` varchar(21) CHARACTER SET cp1251 DEFAULT NULL
|
||||
`c1` varchar(6) CHARACTER SET cp1251 DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
||||
select hex(concat(month(20090224)));
|
||||
|
@ -1088,7 +1088,7 @@ create table t1 as select concat(sign(0.5)) as c1;
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` varchar(21) DEFAULT NULL
|
||||
`c1` varchar(2) DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
||||
create table t1 as select concat(rand()) as c1;
|
||||
@ -1125,7 +1125,7 @@ create table t1 as select concat(bit_length('a')) as c1;
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` varchar(10) DEFAULT NULL
|
||||
`c1` varchar(11) DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
||||
select hex(concat(coercibility('a')));
|
||||
@ -1175,7 +1175,7 @@ create table t1 as select concat(ord(61)) as c1;
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` varchar(21) DEFAULT NULL
|
||||
`c1` varchar(7) DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
||||
select hex(concat(find_in_set('b','a,b,c,d')));
|
||||
@ -1402,7 +1402,7 @@ create table t1 as select concat(sleep(0)) as c1;
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` varchar(21) DEFAULT NULL
|
||||
`c1` varchar(1) DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
||||
select hex(concat(is_free_lock('xxxx')));
|
||||
@ -2153,7 +2153,7 @@ create table t1 as select concat(microsecond('12:00:00.123456')) as c1;
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` varchar(21) DEFAULT NULL
|
||||
`c1` varchar(6) DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
||||
select hex(concat(month(20090224)));
|
||||
|
@ -1967,7 +1967,7 @@ create table t1 as select concat(sign(0.5)) as c1;
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` varchar(21) CHARACTER SET ucs2 DEFAULT NULL
|
||||
`c1` varchar(2) CHARACTER SET ucs2 DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
||||
create table t1 as select concat(rand()) as c1;
|
||||
@ -2004,7 +2004,7 @@ create table t1 as select concat(bit_length('a')) as c1;
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` varchar(10) CHARACTER SET ucs2 DEFAULT NULL
|
||||
`c1` varchar(11) CHARACTER SET ucs2 DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
||||
select hex(concat(coercibility('a')));
|
||||
@ -2054,7 +2054,7 @@ create table t1 as select concat(ord(61)) as c1;
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` varchar(21) CHARACTER SET ucs2 DEFAULT NULL
|
||||
`c1` varchar(7) CHARACTER SET ucs2 DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
||||
select hex(concat(find_in_set('b','a,b,c,d')));
|
||||
@ -2281,7 +2281,7 @@ create table t1 as select concat(sleep(0)) as c1;
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` varchar(21) CHARACTER SET ucs2 DEFAULT NULL
|
||||
`c1` varchar(1) CHARACTER SET ucs2 DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
||||
select hex(concat(is_free_lock('xxxx')));
|
||||
@ -3032,7 +3032,7 @@ create table t1 as select concat(microsecond('12:00:00.123456')) as c1;
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` varchar(21) CHARACTER SET ucs2 DEFAULT NULL
|
||||
`c1` varchar(6) CHARACTER SET ucs2 DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
||||
select hex(concat(month(20090224)));
|
||||
|
@ -2839,7 +2839,7 @@ create table t1 as select concat(sign(0.5)) as c1;
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` varchar(21) CHARACTER SET utf8 DEFAULT NULL
|
||||
`c1` varchar(2) CHARACTER SET utf8 DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
||||
create table t1 as select concat(rand()) as c1;
|
||||
@ -2876,7 +2876,7 @@ create table t1 as select concat(bit_length('a')) as c1;
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` varchar(10) CHARACTER SET utf8 DEFAULT NULL
|
||||
`c1` varchar(11) CHARACTER SET utf8 DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
||||
select hex(concat(coercibility('a')));
|
||||
@ -2926,7 +2926,7 @@ create table t1 as select concat(ord(61)) as c1;
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` varchar(21) CHARACTER SET utf8 DEFAULT NULL
|
||||
`c1` varchar(7) CHARACTER SET utf8 DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
||||
select hex(concat(find_in_set('b','a,b,c,d')));
|
||||
@ -3153,7 +3153,7 @@ create table t1 as select concat(sleep(0)) as c1;
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` varchar(21) CHARACTER SET utf8 DEFAULT NULL
|
||||
`c1` varchar(1) CHARACTER SET utf8 DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
||||
select hex(concat(is_free_lock('xxxx')));
|
||||
@ -3904,7 +3904,7 @@ create table t1 as select concat(microsecond('12:00:00.123456')) as c1;
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` varchar(21) CHARACTER SET utf8 DEFAULT NULL
|
||||
`c1` varchar(6) CHARACTER SET utf8 DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
||||
select hex(concat(month(20090224)));
|
||||
|
@ -642,3 +642,29 @@ SELECT JSON_KEYS(f) FROM t1 ORDER BY 1;
|
||||
JSON_KEYS(f)
|
||||
NULL
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Start of 10.3 tests
|
||||
#
|
||||
#
|
||||
# MDEV-12854 Synchronize CREATE..SELECT data type and result set metadata data type for INT functions
|
||||
#
|
||||
SELECT
|
||||
JSON_VALID('{"id": 1, "name": "Monty"}') AS json_valid,
|
||||
JSON_EXISTS('{"key1":"xxxx", "key2":[1, 2, 3]}', "$.key2") AS json_exists,
|
||||
JSON_CONTAINS('{"A": 0, "B": {"C": 1}, "D": 2}', '2', '$.A') AS ison_contains,
|
||||
JSON_CONTAINS_PATH('{"A": 1, "B": [2], "C": [3, 4]}', 'one', '$.A', '$.D') AS json_contains_path;
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def json_valid 3 1 1 Y 32896 0 63
|
||||
def json_exists 3 1 1 Y 32896 0 63
|
||||
def ison_contains 3 1 1 Y 32896 0 63
|
||||
def json_contains_path 3 1 1 Y 32896 0 63
|
||||
json_valid json_exists ison_contains json_contains_path
|
||||
1 1 0 1
|
||||
SELECT
|
||||
JSON_LENGTH('{"a": 1, "b": {"c": 30}}') AS json_length,
|
||||
JSON_DEPTH('[10, {"a": 20}]') AS json_depnth;
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def json_length 3 10 1 Y 32896 0 63
|
||||
def json_depnth 3 10 1 N 32897 0 63
|
||||
json_length json_depnth
|
||||
2 3
|
||||
|
@ -1494,3 +1494,14 @@ DROP TABLE t1;
|
||||
#
|
||||
# End of 10.2 tests
|
||||
#
|
||||
#
|
||||
# Start of 10.3 tests
|
||||
#
|
||||
#
|
||||
# MDEV-12854 Synchronize CREATE..SELECT data type and result set metadata data type for INT functions
|
||||
#
|
||||
SELECT INET_ATON("255.255.255.255.255.255.255.255");
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def INET_ATON("255.255.255.255.255.255.255.255") 8 21 20 Y 32928 0 63
|
||||
INET_ATON("255.255.255.255.255.255.255.255")
|
||||
18446744073709551615
|
||||
|
@ -4318,5 +4318,28 @@ t1 CREATE TABLE `t1` (
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# MDEV-12854 Synchronize CREATE..SELECT data type and result set metadata data type for INT functions
|
||||
#
|
||||
SELECT
|
||||
ST_ISSIMPLE(POINT(1,1)),
|
||||
ST_ISRING(POINT(1,1)),
|
||||
ST_ISCLOSED(POINT(1,1)),
|
||||
ST_DIMENSION(POINT(1,1)),
|
||||
ST_NUMGEOMETRIES(POINT(1,1)),
|
||||
ST_NUMINTERIORRINGS(POINT(1,1)),
|
||||
ST_NUMPOINTS(POINT(1,1)),
|
||||
ST_SRID(POINT(1,1));
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def ST_ISSIMPLE(POINT(1,1)) 3 2 1 Y 32896 0 63
|
||||
def ST_ISRING(POINT(1,1)) 3 2 2 Y 32896 0 63
|
||||
def ST_ISCLOSED(POINT(1,1)) 3 2 2 Y 32896 0 63
|
||||
def ST_DIMENSION(POINT(1,1)) 3 10 1 Y 32896 0 63
|
||||
def ST_NUMGEOMETRIES(POINT(1,1)) 3 10 0 Y 32896 0 63
|
||||
def ST_NUMINTERIORRINGS(POINT(1,1)) 3 10 0 Y 32896 0 63
|
||||
def ST_NUMPOINTS(POINT(1,1)) 3 10 0 Y 32896 0 63
|
||||
def ST_SRID(POINT(1,1)) 3 10 1 Y 32896 0 63
|
||||
ST_ISSIMPLE(POINT(1,1)) ST_ISRING(POINT(1,1)) ST_ISCLOSED(POINT(1,1)) ST_DIMENSION(POINT(1,1)) ST_NUMGEOMETRIES(POINT(1,1)) ST_NUMINTERIORRINGS(POINT(1,1)) ST_NUMPOINTS(POINT(1,1)) ST_SRID(POINT(1,1))
|
||||
1 -1 -1 0 NULL NULL NULL 0
|
||||
#
|
||||
# End of 10.3 tests
|
||||
#
|
||||
|
@ -400,3 +400,139 @@ def cast('01:01:01' as time) 11 10 8 Y 128 0 63
|
||||
def cast('01:01:01' as time(2)) 11 13 11 Y 128 2 63
|
||||
cast('01:01:01' as time) cast('01:01:01' as time(2))
|
||||
01:01:01 01:01:01.00
|
||||
#
|
||||
# MDEV-12854 Synchronize CREATE..SELECT data type and result set metadata data type for INT functions
|
||||
#
|
||||
SELECT
|
||||
STRCMP('a','b'),
|
||||
OCTET_LENGTH('a'),
|
||||
CHAR_LENGTH('a'),
|
||||
COERCIBILITY('a'),
|
||||
ASCII('a'),
|
||||
ORD('a'),
|
||||
CRC32('a'),
|
||||
UNCOMPRESSED_LENGTH(COMPRESS('a'));
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def STRCMP('a','b') 3 2 2 N 32897 0 63
|
||||
def OCTET_LENGTH('a') 3 10 1 N 32897 0 63
|
||||
def CHAR_LENGTH('a') 3 10 1 N 32897 0 63
|
||||
def COERCIBILITY('a') 3 10 1 N 32897 0 63
|
||||
def ASCII('a') 3 3 2 N 32897 0 63
|
||||
def ORD('a') 3 7 2 N 32897 0 63
|
||||
def CRC32('a') 3 10 10 N 32929 0 63
|
||||
def UNCOMPRESSED_LENGTH(COMPRESS('a')) 3 10 1 Y 32896 0 63
|
||||
STRCMP('a','b') OCTET_LENGTH('a') CHAR_LENGTH('a') COERCIBILITY('a') ASCII('a') ORD('a') CRC32('a') UNCOMPRESSED_LENGTH(COMPRESS('a'))
|
||||
-1 1 1 4 97 97 3904355907 1
|
||||
SELECT
|
||||
INTERVAL(2,1,2,3),
|
||||
REGEXP_INSTR('a','a'),
|
||||
LOCATE('a','a'),
|
||||
FIND_IN_SET('b','a,b,c,d'),
|
||||
FIELD('a','a','b');
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def INTERVAL(2,1,2,3) 3 2 1 N 32897 0 63
|
||||
def REGEXP_INSTR('a','a') 3 11 1 N 32897 0 63
|
||||
def LOCATE('a','a') 3 11 1 N 32897 0 63
|
||||
def FIND_IN_SET('b','a,b,c,d') 3 3 1 N 32897 0 63
|
||||
def FIELD('a','a','b') 3 3 1 N 32897 0 63
|
||||
INTERVAL(2,1,2,3) REGEXP_INSTR('a','a') LOCATE('a','a') FIND_IN_SET('b','a,b,c,d') FIELD('a','a','b')
|
||||
2 1 1 2 1
|
||||
SELECT
|
||||
SIGN(1),
|
||||
BIT_COUNT(1);
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def SIGN(1) 3 2 1 N 32897 0 63
|
||||
def BIT_COUNT(1) 3 2 1 N 32897 0 63
|
||||
SIGN(1) BIT_COUNT(1)
|
||||
1 1
|
||||
SELECT
|
||||
BENCHMARK(0,0),
|
||||
SLEEP(0);
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def BENCHMARK(0,0) 3 1 1 N 32897 0 63
|
||||
def SLEEP(0) 3 1 1 N 32897 0 63
|
||||
BENCHMARK(0,0) SLEEP(0)
|
||||
0 0
|
||||
SELECT
|
||||
GET_LOCK('metadata',0),
|
||||
IS_FREE_LOCK('metadata'),
|
||||
RELEASE_LOCK('metadata');
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def GET_LOCK('metadata',0) 3 1 1 Y 32896 0 63
|
||||
def IS_FREE_LOCK('metadata') 3 1 1 Y 32896 0 63
|
||||
def RELEASE_LOCK('metadata') 3 1 1 Y 32896 0 63
|
||||
GET_LOCK('metadata',0) IS_FREE_LOCK('metadata') RELEASE_LOCK('metadata')
|
||||
1 0 1
|
||||
SELECT
|
||||
PERIOD_ADD(200801,2),
|
||||
PERIOD_DIFF(200802,200703),
|
||||
TO_DAYS('2007-10-07'),
|
||||
DAYOFMONTH('2007-02-03'),
|
||||
DAYOFWEEK('2007-02-03'),
|
||||
TO_SECONDS('2013-06-13');
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def PERIOD_ADD(200801,2) 3 6 6 N 32897 0 63
|
||||
def PERIOD_DIFF(200802,200703) 3 6 2 N 32897 0 63
|
||||
def TO_DAYS('2007-10-07') 3 6 6 Y 32896 0 63
|
||||
def DAYOFMONTH('2007-02-03') 3 2 1 Y 32896 0 63
|
||||
def DAYOFWEEK('2007-02-03') 3 1 1 Y 32896 0 63
|
||||
def TO_SECONDS('2013-06-13') 3 6 11 Y 32896 0 63
|
||||
PERIOD_ADD(200801,2) PERIOD_DIFF(200802,200703) TO_DAYS('2007-10-07') DAYOFMONTH('2007-02-03') DAYOFWEEK('2007-02-03') TO_SECONDS('2013-06-13')
|
||||
200803 11 733321 3 7 63538300800
|
||||
SELECT
|
||||
YEAR('2001-02-03 04:05:06.000007'),
|
||||
DAY('2001-02-03 04:05:06.000007'),
|
||||
HOUR('2001-02-03 04:05:06.000007'),
|
||||
MINUTE('2001-02-03 04:05:06.000007'),
|
||||
SECOND('2001-02-03 04:05:06.000007'),
|
||||
MICROSECOND('2001-02-03 04:05:06.000007');
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def YEAR('2001-02-03 04:05:06.000007') 3 4 4 Y 32896 0 63
|
||||
def DAY('2001-02-03 04:05:06.000007') 3 2 1 Y 32896 0 63
|
||||
def HOUR('2001-02-03 04:05:06.000007') 3 2 1 Y 32896 0 63
|
||||
def MINUTE('2001-02-03 04:05:06.000007') 3 2 1 Y 32896 0 63
|
||||
def SECOND('2001-02-03 04:05:06.000007') 3 2 1 Y 32896 0 63
|
||||
def MICROSECOND('2001-02-03 04:05:06.000007') 3 6 1 Y 32896 0 63
|
||||
YEAR('2001-02-03 04:05:06.000007') DAY('2001-02-03 04:05:06.000007') HOUR('2001-02-03 04:05:06.000007') MINUTE('2001-02-03 04:05:06.000007') SECOND('2001-02-03 04:05:06.000007') MICROSECOND('2001-02-03 04:05:06.000007')
|
||||
2001 3 4 5 6 7
|
||||
SELECT
|
||||
WEEK('2001-02-03 04:05:06.000007'),
|
||||
QUARTER('2001-02-03 04:05:06.000007'),
|
||||
YEARWEEK('2001-02-03 04:05:06.000007');
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def WEEK('2001-02-03 04:05:06.000007') 3 2 1 Y 32896 0 63
|
||||
def QUARTER('2001-02-03 04:05:06.000007') 3 1 1 Y 32896 0 63
|
||||
def YEARWEEK('2001-02-03 04:05:06.000007') 3 6 6 Y 32896 0 63
|
||||
WEEK('2001-02-03 04:05:06.000007') QUARTER('2001-02-03 04:05:06.000007') YEARWEEK('2001-02-03 04:05:06.000007')
|
||||
4 1 200104
|
||||
SELECT BIT_LENGTH(10);
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def BIT_LENGTH(10) 8 11 2 N 32897 0 63
|
||||
BIT_LENGTH(10)
|
||||
16
|
||||
SELECT 1|2, 1&2, 1<<2, 1>>2, ~0, 1^2;
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def 1|2 8 21 1 N 32929 0 63
|
||||
def 1&2 8 21 1 N 32929 0 63
|
||||
def 1<<2 8 21 1 N 32929 0 63
|
||||
def 1>>2 8 21 1 N 32929 0 63
|
||||
def ~0 8 21 20 N 32929 0 63
|
||||
def 1^2 8 21 1 N 32929 0 63
|
||||
1|2 1&2 1<<2 1>>2 ~0 1^2
|
||||
3 0 4 0 18446744073709551615 3
|
||||
SELECT LAST_INSERT_ID();
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def LAST_INSERT_ID() 8 21 1 N 32929 0 63
|
||||
LAST_INSERT_ID()
|
||||
0
|
||||
SELECT ROW_COUNT(), FOUND_ROWS();
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def ROW_COUNT() 8 21 2 N 32897 0 63
|
||||
def FOUND_ROWS() 8 21 1 N 32897 0 63
|
||||
ROW_COUNT() FOUND_ROWS()
|
||||
-1 1
|
||||
SELECT TIMESTAMPDIFF(MONTH,'2003-02-01','2003-05-01');
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def TIMESTAMPDIFF(MONTH,'2003-02-01','2003-05-01') 8 21 1 Y 32896 0 63
|
||||
TIMESTAMPDIFF(MONTH,'2003-02-01','2003-05-01')
|
||||
3
|
||||
|
@ -306,3 +306,14 @@ DROP TABLE t1;
|
||||
#
|
||||
# End of MDEV-10578 sql_mode=ORACLE: SP control functions SQLCODE, SQLERRM
|
||||
#
|
||||
#
|
||||
# MDEV-12854 Synchronize CREATE..SELECT data type and result set metadata data type for INT functions
|
||||
#
|
||||
BEGIN
|
||||
SELECT SQLCODE;
|
||||
END
|
||||
$$
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def SQLCODE 3 11 1 N 32897 0 63
|
||||
SQLCODE
|
||||
0
|
||||
|
@ -160,7 +160,7 @@ CALL p1();
|
||||
Table Create Table
|
||||
t2 CREATE TABLE "t2" (
|
||||
"c%ISOPEN" int(1) NOT NULL,
|
||||
"c%ROWCOUNT" bigint(21) NOT NULL,
|
||||
"c%ROWCOUNT" bigint(21) DEFAULT NULL,
|
||||
"c%FOUND" int(1) DEFAULT NULL,
|
||||
"c%NOTFOUND" int(1) DEFAULT NULL
|
||||
)
|
||||
@ -927,3 +927,25 @@ x0 x1.a x1.b
|
||||
100 10 Tbl-t1.b0
|
||||
DROP PROCEDURE p1;
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# MDEV-12854 Synchronize CREATE..SELECT data type and result set metadata data type for INT functions
|
||||
#
|
||||
DECLARE
|
||||
CURSOR c IS SELECT 1 AS c FROM DUAL;
|
||||
BEGIN
|
||||
OPEN c;
|
||||
SELECT
|
||||
c%ISOPEN,
|
||||
c%NOTFOUND,
|
||||
c%FOUND,
|
||||
c%ROWCOUNT;
|
||||
CLOSE c;
|
||||
END;
|
||||
$$
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def c%ISOPEN 3 1 1 N 32897 0 63
|
||||
def c%NOTFOUND 3 1 0 Y 32896 0 63
|
||||
def c%FOUND 3 1 0 Y 32896 0 63
|
||||
def c%ROWCOUNT 8 21 1 Y 32896 0 63
|
||||
c%ISOPEN c%NOTFOUND c%FOUND c%ROWCOUNT
|
||||
1 NULL NULL 0
|
||||
|
@ -2274,3 +2274,11 @@ This is p2
|
||||
DROP PROCEDURE p3;
|
||||
DROP PROCEDURE p2;
|
||||
DROP PROCEDURE p1;
|
||||
#
|
||||
# MDEV-12854 Synchronize CREATE..SELECT data type and result set metadata data type for INT functions
|
||||
#
|
||||
SELECT SQL%ROWCOUNT;
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def SQL%ROWCOUNT 8 21 1 N 32897 0 63
|
||||
SQL%ROWCOUNT
|
||||
0
|
||||
|
@ -329,3 +329,18 @@ DROP TABLE t1;
|
||||
--echo #
|
||||
--echo # End of MDEV-10578 sql_mode=ORACLE: SP control functions SQLCODE, SQLERRM
|
||||
--echo #
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-12854 Synchronize CREATE..SELECT data type and result set metadata data type for INT functions
|
||||
--echo #
|
||||
|
||||
--enable_metadata
|
||||
--disable_ps_protocol
|
||||
DELIMITER $$;
|
||||
BEGIN
|
||||
SELECT SQLCODE;
|
||||
END
|
||||
$$
|
||||
DELIMITER ;$$
|
||||
--enable_ps_protocol
|
||||
--disable_metadata
|
||||
|
@ -929,3 +929,26 @@ DELIMITER ;$$
|
||||
CALL p1();
|
||||
DROP PROCEDURE p1;
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-12854 Synchronize CREATE..SELECT data type and result set metadata data type for INT functions
|
||||
--echo #
|
||||
|
||||
--enable_metadata
|
||||
--disable_ps_protocol
|
||||
DELIMITER $$;
|
||||
DECLARE
|
||||
CURSOR c IS SELECT 1 AS c FROM DUAL;
|
||||
BEGIN
|
||||
OPEN c;
|
||||
SELECT
|
||||
c%ISOPEN,
|
||||
c%NOTFOUND,
|
||||
c%FOUND,
|
||||
c%ROWCOUNT;
|
||||
CLOSE c;
|
||||
END;
|
||||
$$
|
||||
DELIMITER ;$$
|
||||
--enable_ps_protocol
|
||||
--disable_metadata
|
||||
|
@ -2120,3 +2120,14 @@ CALL p3;
|
||||
DROP PROCEDURE p3;
|
||||
DROP PROCEDURE p2;
|
||||
DROP PROCEDURE p1;
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-12854 Synchronize CREATE..SELECT data type and result set metadata data type for INT functions
|
||||
--echo #
|
||||
|
||||
--enable_metadata
|
||||
--disable_ps_protocol
|
||||
SELECT SQL%ROWCOUNT;
|
||||
--enable_ps_protocol
|
||||
--disable_metadata
|
||||
|
@ -412,3 +412,16 @@ next value for t1
|
||||
select next value for t1, min_value;
|
||||
ERROR 42S22: Unknown column 'min_value' in 'field list'
|
||||
drop sequence t1;
|
||||
#
|
||||
# MDEV-12854 Synchronize CREATE..SELECT data type and result set metadata data type for INT functions
|
||||
#
|
||||
CREATE SEQUENCE s1;
|
||||
SELECT
|
||||
NEXT VALUE FOR s1,
|
||||
PREVIOUS VALUE FOR s1;
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def NEXT VALUE FOR s1 8 20 1 Y 32896 0 63
|
||||
def PREVIOUS VALUE FOR s1 8 20 1 Y 32896 0 63
|
||||
NEXT VALUE FOR s1 PREVIOUS VALUE FOR s1
|
||||
1 1
|
||||
DROP SEQUENCE s1;
|
||||
|
@ -200,3 +200,17 @@ select next value for t1;
|
||||
--error ER_BAD_FIELD_ERROR
|
||||
select next value for t1, min_value;
|
||||
drop sequence t1;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-12854 Synchronize CREATE..SELECT data type and result set metadata data type for INT functions
|
||||
--echo #
|
||||
|
||||
--enable_metadata
|
||||
--disable_ps_protocol
|
||||
CREATE SEQUENCE s1;
|
||||
SELECT
|
||||
NEXT VALUE FOR s1,
|
||||
PREVIOUS VALUE FOR s1;
|
||||
DROP SEQUENCE s1;
|
||||
--enable_ps_protocol
|
||||
--disable_metadata
|
||||
|
@ -244,3 +244,13 @@ create table t1 (a int);
|
||||
select setval(t1,10);
|
||||
ERROR 42S02: 'test.t1' is not a SEQUENCE
|
||||
drop table t1;
|
||||
#
|
||||
# MDEV-12854 Synchronize CREATE..SELECT data type and result set metadata data type for INT functions
|
||||
#
|
||||
CREATE SEQUENCE s1;
|
||||
SELECT SETVAL(s1,10);
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def SETVAL(s1,10) 8 20 2 Y 32896 0 63
|
||||
SETVAL(s1,10)
|
||||
10
|
||||
DROP SEQUENCE s1;
|
||||
|
@ -124,3 +124,16 @@ create table t1 (a int);
|
||||
--error ER_NOT_SEQUENCE
|
||||
select setval(t1,10);
|
||||
drop table t1;
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-12854 Synchronize CREATE..SELECT data type and result set metadata data type for INT functions
|
||||
--echo #
|
||||
|
||||
--enable_metadata
|
||||
--disable_ps_protocol
|
||||
CREATE SEQUENCE s1;
|
||||
SELECT SETVAL(s1,10);
|
||||
DROP SEQUENCE s1;
|
||||
--enable_ps_protocol
|
||||
--disable_metadata
|
||||
|
@ -296,3 +296,26 @@ INSERT INTO t1 VALUES (0);
|
||||
SELECT JSON_KEYS(f) FROM t1 ORDER BY 1;
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo #
|
||||
--echo # Start of 10.3 tests
|
||||
--echo #
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-12854 Synchronize CREATE..SELECT data type and result set metadata data type for INT functions
|
||||
--echo #
|
||||
|
||||
--enable_metadata
|
||||
--disable_ps_protocol
|
||||
|
||||
SELECT
|
||||
JSON_VALID('{"id": 1, "name": "Monty"}') AS json_valid,
|
||||
JSON_EXISTS('{"key1":"xxxx", "key2":[1, 2, 3]}', "$.key2") AS json_exists,
|
||||
JSON_CONTAINS('{"A": 0, "B": {"C": 1}, "D": 2}', '2', '$.A') AS ison_contains,
|
||||
JSON_CONTAINS_PATH('{"A": 1, "B": [2], "C": [3, 4]}', 'one', '$.A', '$.D') AS json_contains_path;
|
||||
|
||||
SELECT
|
||||
JSON_LENGTH('{"a": 1, "b": {"c": 30}}') AS json_length,
|
||||
JSON_DEPTH('[10, {"a": 20}]') AS json_depnth;
|
||||
|
||||
--enable_ps_protocol
|
||||
--disable_metadata
|
||||
|
@ -1127,3 +1127,19 @@ DROP TABLE t1;
|
||||
--echo #
|
||||
--echo # End of 10.2 tests
|
||||
--echo #
|
||||
|
||||
--echo #
|
||||
--echo # Start of 10.3 tests
|
||||
--echo #
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-12854 Synchronize CREATE..SELECT data type and result set metadata data type for INT functions
|
||||
--echo #
|
||||
|
||||
--enable_metadata
|
||||
--disable_ps_protocol
|
||||
|
||||
SELECT INET_ATON("255.255.255.255.255.255.255.255");
|
||||
|
||||
--enable_ps_protocol
|
||||
--disable_metadata
|
||||
|
@ -2306,6 +2306,25 @@ SHOW CREATE TABLE t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-12854 Synchronize CREATE..SELECT data type and result set metadata data type for INT functions
|
||||
--echo #
|
||||
|
||||
--enable_metadata
|
||||
--disable_ps_protocol
|
||||
SELECT
|
||||
ST_ISSIMPLE(POINT(1,1)),
|
||||
ST_ISRING(POINT(1,1)),
|
||||
ST_ISCLOSED(POINT(1,1)),
|
||||
ST_DIMENSION(POINT(1,1)),
|
||||
ST_NUMGEOMETRIES(POINT(1,1)),
|
||||
ST_NUMINTERIORRINGS(POINT(1,1)),
|
||||
ST_NUMPOINTS(POINT(1,1)),
|
||||
ST_SRID(POINT(1,1));
|
||||
--enable_ps_protocol
|
||||
--disable_metadata
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # End of 10.3 tests
|
||||
--echo #
|
||||
|
@ -252,3 +252,77 @@ drop table t1;
|
||||
--enable_metadata
|
||||
select cast('01:01:01' as time), cast('01:01:01' as time(2));
|
||||
--disable_metadata
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-12854 Synchronize CREATE..SELECT data type and result set metadata data type for INT functions
|
||||
--echo #
|
||||
|
||||
--enable_metadata
|
||||
SELECT
|
||||
STRCMP('a','b'),
|
||||
OCTET_LENGTH('a'),
|
||||
CHAR_LENGTH('a'),
|
||||
COERCIBILITY('a'),
|
||||
ASCII('a'),
|
||||
ORD('a'),
|
||||
CRC32('a'),
|
||||
UNCOMPRESSED_LENGTH(COMPRESS('a'));
|
||||
|
||||
SELECT
|
||||
INTERVAL(2,1,2,3),
|
||||
REGEXP_INSTR('a','a'),
|
||||
LOCATE('a','a'),
|
||||
FIND_IN_SET('b','a,b,c,d'),
|
||||
FIELD('a','a','b');
|
||||
|
||||
SELECT
|
||||
SIGN(1),
|
||||
BIT_COUNT(1);
|
||||
|
||||
|
||||
SELECT
|
||||
BENCHMARK(0,0),
|
||||
SLEEP(0);
|
||||
|
||||
SELECT
|
||||
GET_LOCK('metadata',0),
|
||||
IS_FREE_LOCK('metadata'),
|
||||
RELEASE_LOCK('metadata');
|
||||
|
||||
# Metadata the following functions is not deterministic
|
||||
#SELECT CONNECTION_ID();
|
||||
#SELECT IS_FREE_LOCK('metadata');
|
||||
#SELECT UUID_SHORT();
|
||||
|
||||
|
||||
SELECT
|
||||
PERIOD_ADD(200801,2),
|
||||
PERIOD_DIFF(200802,200703),
|
||||
TO_DAYS('2007-10-07'),
|
||||
DAYOFMONTH('2007-02-03'),
|
||||
DAYOFWEEK('2007-02-03'),
|
||||
TO_SECONDS('2013-06-13');
|
||||
|
||||
SELECT
|
||||
YEAR('2001-02-03 04:05:06.000007'),
|
||||
DAY('2001-02-03 04:05:06.000007'),
|
||||
HOUR('2001-02-03 04:05:06.000007'),
|
||||
MINUTE('2001-02-03 04:05:06.000007'),
|
||||
SECOND('2001-02-03 04:05:06.000007'),
|
||||
MICROSECOND('2001-02-03 04:05:06.000007');
|
||||
|
||||
SELECT
|
||||
WEEK('2001-02-03 04:05:06.000007'),
|
||||
QUARTER('2001-02-03 04:05:06.000007'),
|
||||
YEARWEEK('2001-02-03 04:05:06.000007');
|
||||
|
||||
--disable_metadata
|
||||
|
||||
--enable_metadata
|
||||
SELECT BIT_LENGTH(10);
|
||||
SELECT 1|2, 1&2, 1<<2, 1>>2, ~0, 1^2;
|
||||
SELECT LAST_INSERT_ID();
|
||||
SELECT ROW_COUNT(), FOUND_ROWS();
|
||||
SELECT TIMESTAMPDIFF(MONTH,'2003-02-01','2003-05-01');
|
||||
--disable_metadata
|
||||
|
@ -5519,6 +5519,7 @@ Item_func_regexp_instr::fix_length_and_dec()
|
||||
|
||||
re.init(cmp_collation.collation, 0, 1);
|
||||
re.fix_owner(this, args[0], args[1]);
|
||||
max_length= MY_INT32_NUM_DECIMAL_DIGITS; // See also Item_func_locate
|
||||
}
|
||||
|
||||
|
||||
|
@ -204,7 +204,12 @@ public:
|
||||
Item_bool_func(THD *thd, Item *a, Item *b, Item *c): Item_int_func(thd, a, b, c) {}
|
||||
Item_bool_func(THD *thd, List<Item> &list): Item_int_func(thd, list) { }
|
||||
Item_bool_func(THD *thd, Item_bool_func *item) :Item_int_func(thd, item) {}
|
||||
const Type_handler *type_handler() const { return &type_handler_long; }
|
||||
bool is_bool_type() { return true; }
|
||||
Field *create_tmp_field(bool group, TABLE *table)
|
||||
{ return tmp_table_field_from_field_type(table); }
|
||||
Field *create_field_for_create_select(TABLE *table)
|
||||
{ return tmp_table_field_from_field_type(table); }
|
||||
virtual CHARSET_INFO *compare_collation() const { return NULL; }
|
||||
void fix_length_and_dec() { decimals=0; max_length=1; }
|
||||
uint decimal_precision() const { return 1; }
|
||||
@ -919,13 +924,13 @@ public:
|
||||
};
|
||||
|
||||
|
||||
class Item_func_strcmp :public Item_int_func
|
||||
class Item_func_strcmp :public Item_long_func
|
||||
{
|
||||
String value1, value2;
|
||||
DTCollation cmp_collation;
|
||||
public:
|
||||
Item_func_strcmp(THD *thd, Item *a, Item *b):
|
||||
Item_int_func(thd, a, b) {}
|
||||
Item_long_func(thd, a, b) {}
|
||||
longlong val_int();
|
||||
uint decimal_precision() const { return 1; }
|
||||
const char *func_name() const { return "strcmp"; }
|
||||
@ -946,14 +951,14 @@ struct interval_range
|
||||
my_decimal dec;
|
||||
};
|
||||
|
||||
class Item_func_interval :public Item_int_func
|
||||
class Item_func_interval :public Item_long_func
|
||||
{
|
||||
Item_row *row;
|
||||
bool use_decimal_comparison;
|
||||
interval_range *intervals;
|
||||
public:
|
||||
Item_func_interval(THD *thd, Item_row *a):
|
||||
Item_int_func(thd, a), row(a), intervals(0)
|
||||
Item_long_func(thd, a), row(a), intervals(0)
|
||||
{
|
||||
allowed_arg_cols= 0; // Fetch this value from first argument
|
||||
}
|
||||
@ -2661,12 +2666,19 @@ public:
|
||||
};
|
||||
|
||||
|
||||
class Item_func_regexp_instr :public Item_int_func
|
||||
/*
|
||||
In the corner case REGEXP_INSTR could return (2^32 + 1),
|
||||
which would not fit into Item_long_func range.
|
||||
But string lengths are limited with max_allowed_packet,
|
||||
which cannot be bigger than 1024*1024*1024.
|
||||
*/
|
||||
class Item_func_regexp_instr :public Item_long_func
|
||||
{
|
||||
Regexp_processor_pcre re;
|
||||
DTCollation cmp_collation;
|
||||
public:
|
||||
Item_func_regexp_instr(THD *thd, Item *a, Item *b): Item_int_func(thd, a, b)
|
||||
Item_func_regexp_instr(THD *thd, Item *a, Item *b)
|
||||
:Item_long_func(thd, a, b)
|
||||
{}
|
||||
void cleanup()
|
||||
{
|
||||
@ -3130,6 +3142,61 @@ public:
|
||||
{ return get_item_copy<Item_func_dyncol_exists>(thd, mem_root, this); }
|
||||
};
|
||||
|
||||
|
||||
class Item_func_cursor_bool_attr: public Item_bool_func, public Cursor_ref
|
||||
{
|
||||
public:
|
||||
Item_func_cursor_bool_attr(THD *thd, const LEX_CSTRING *name, uint offset)
|
||||
:Item_bool_func(thd), Cursor_ref(name, offset)
|
||||
{ }
|
||||
bool check_vcol_func_processor(void *arg)
|
||||
{
|
||||
return mark_unsupported_function(func_name(), arg, VCOL_SESSION_FUNC);
|
||||
}
|
||||
void print(String *str, enum_query_type query_type)
|
||||
{
|
||||
Cursor_ref::print_func(str, func_name());
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class Item_func_cursor_isopen: public Item_func_cursor_bool_attr
|
||||
{
|
||||
public:
|
||||
Item_func_cursor_isopen(THD *thd, const LEX_CSTRING *name, uint offset)
|
||||
:Item_func_cursor_bool_attr(thd, name, offset) { }
|
||||
const char *func_name() const { return "%ISOPEN"; }
|
||||
longlong val_int();
|
||||
Item *get_copy(THD *thd, MEM_ROOT *mem_root)
|
||||
{ return get_item_copy<Item_func_cursor_isopen>(thd, mem_root, this); }
|
||||
};
|
||||
|
||||
|
||||
class Item_func_cursor_found: public Item_func_cursor_bool_attr
|
||||
{
|
||||
public:
|
||||
Item_func_cursor_found(THD *thd, const LEX_CSTRING *name, uint offset)
|
||||
:Item_func_cursor_bool_attr(thd, name, offset) { maybe_null= true; }
|
||||
const char *func_name() const { return "%FOUND"; }
|
||||
longlong val_int();
|
||||
Item *get_copy(THD *thd, MEM_ROOT *mem_root)
|
||||
{ return get_item_copy<Item_func_cursor_found>(thd, mem_root, this); }
|
||||
};
|
||||
|
||||
|
||||
class Item_func_cursor_notfound: public Item_func_cursor_bool_attr
|
||||
{
|
||||
public:
|
||||
Item_func_cursor_notfound(THD *thd, const LEX_CSTRING *name, uint offset)
|
||||
:Item_func_cursor_bool_attr(thd, name, offset) { maybe_null= true; }
|
||||
const char *func_name() const { return "%NOTFOUND"; }
|
||||
longlong val_int();
|
||||
Item *get_copy(THD *thd, MEM_ROOT *mem_root)
|
||||
{ return get_item_copy<Item_func_cursor_notfound>(thd, mem_root, this); }
|
||||
};
|
||||
|
||||
|
||||
|
||||
inline bool is_cond_or(Item *item)
|
||||
{
|
||||
if (item->type() != Item::COND_ITEM)
|
||||
|
@ -632,7 +632,7 @@ String *Item_int_func::val_str(String *str)
|
||||
|
||||
void Item_func_connection_id::fix_length_and_dec()
|
||||
{
|
||||
Item_int_func::fix_length_and_dec();
|
||||
Item_long_func::fix_length_and_dec();
|
||||
max_length= 10;
|
||||
}
|
||||
|
||||
@ -2709,6 +2709,14 @@ my_decimal *Item_func_min_max::val_decimal_native(my_decimal *dec)
|
||||
}
|
||||
|
||||
|
||||
longlong Item_func_bit_length::val_int()
|
||||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
String *res= args[0]->val_str(&value);
|
||||
return (null_value= !res) ? 0 : (longlong) res->length() * 8;
|
||||
}
|
||||
|
||||
|
||||
longlong Item_func_octet_length::val_int()
|
||||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
@ -2745,13 +2753,6 @@ longlong Item_func_coercibility::val_int()
|
||||
}
|
||||
|
||||
|
||||
void Item_func_locate::fix_length_and_dec()
|
||||
{
|
||||
max_length= MY_INT32_NUM_DECIMAL_DIGITS;
|
||||
agg_arg_charsets_for_comparison(cmp_collation, args, 2);
|
||||
}
|
||||
|
||||
|
||||
longlong Item_func_locate::val_int()
|
||||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
@ -6624,14 +6625,14 @@ void Item_func_last_value::fix_length_and_dec()
|
||||
}
|
||||
|
||||
|
||||
void Item_func_cursor_int_attr::print(String *str, enum_query_type query_type)
|
||||
void Cursor_ref::print_func(String *str, const char *func_name)
|
||||
{
|
||||
append_identifier(current_thd, str, m_cursor_name.str, m_cursor_name.length);
|
||||
str->append(func_name());
|
||||
str->append(func_name);
|
||||
}
|
||||
|
||||
|
||||
sp_cursor *Item_func_cursor_int_attr::get_open_cursor_or_error()
|
||||
sp_cursor *Cursor_ref::get_open_cursor_or_error()
|
||||
{
|
||||
THD *thd= current_thd;
|
||||
sp_cursor *c= thd->spcont->get_cursor(m_cursor_offset);
|
||||
|
276
sql/item_func.h
276
sql/item_func.h
@ -715,6 +715,12 @@ class Item_num_op :public Item_func_numhybrid
|
||||
class Item_int_func :public Item_func
|
||||
{
|
||||
public:
|
||||
/*
|
||||
QQ: shouldn't 20 characters be enough:
|
||||
Max unsigned = 18,446,744,073,709,551,615 = 20 digits, 20 characters
|
||||
Max signed = 9,223,372,036,854,775,807 = 19 digits, 19 characters
|
||||
Min signed = -9,223,372,036,854,775,808 = 19 digits, 20 characters
|
||||
*/
|
||||
Item_int_func(THD *thd): Item_func(thd)
|
||||
{ collation.set_numeric(); fix_char_length(21); }
|
||||
Item_int_func(THD *thd, Item *a): Item_func(thd, a)
|
||||
@ -737,82 +743,85 @@ public:
|
||||
};
|
||||
|
||||
|
||||
class Item_func_cursor_int_attr: public Item_int_func
|
||||
class Item_long_func: public Item_int_func
|
||||
{
|
||||
public:
|
||||
Item_long_func(THD *thd): Item_int_func(thd) { }
|
||||
Item_long_func(THD *thd, Item *a): Item_int_func(thd, a) {}
|
||||
Item_long_func(THD *thd, Item *a, Item *b): Item_int_func(thd, a, b) {}
|
||||
Item_long_func(THD *thd, Item *a, Item *b, Item *c): Item_int_func(thd, a, b, c) {}
|
||||
Item_long_func(THD *thd, List<Item> &list): Item_int_func(thd, list) { }
|
||||
Item_long_func(THD *thd, Item_long_func *item) :Item_int_func(thd, item) {}
|
||||
const Type_handler *type_handler() const { return &type_handler_long; }
|
||||
Field *create_tmp_field(bool group, TABLE *table)
|
||||
{ return tmp_table_field_from_field_type(table); }
|
||||
Field *create_field_for_create_select(TABLE *table)
|
||||
{ return tmp_table_field_from_field_type(table); }
|
||||
void fix_length_and_dec() { max_length= 11; }
|
||||
};
|
||||
|
||||
|
||||
class Item_longlong_func: public Item_int_func
|
||||
{
|
||||
public:
|
||||
Item_longlong_func(THD *thd): Item_int_func(thd) { }
|
||||
Item_longlong_func(THD *thd, Item *a): Item_int_func(thd, a) {}
|
||||
Item_longlong_func(THD *thd, Item *a, Item *b): Item_int_func(thd, a, b) {}
|
||||
Item_longlong_func(THD *thd, Item *a, Item *b, Item *c): Item_int_func(thd, a, b, c) {}
|
||||
Item_longlong_func(THD *thd, Item *a, Item *b, Item *c, Item *d):
|
||||
Item_int_func(thd, a, b, c, d) {}
|
||||
Item_longlong_func(THD *thd, List<Item> &list): Item_int_func(thd, list) { }
|
||||
Item_longlong_func(THD *thd, Item_longlong_func *item) :Item_int_func(thd, item) {}
|
||||
const Type_handler *type_handler() const { return &type_handler_longlong; }
|
||||
Field *create_tmp_field(bool group, TABLE *table)
|
||||
{ return tmp_table_field_from_field_type(table); }
|
||||
Field *create_field_for_create_select(TABLE *table)
|
||||
{ return tmp_table_field_from_field_type(table); }
|
||||
};
|
||||
|
||||
|
||||
class Cursor_ref
|
||||
{
|
||||
protected:
|
||||
LEX_CSTRING m_cursor_name;
|
||||
uint m_cursor_offset;
|
||||
class sp_cursor *get_open_cursor_or_error();
|
||||
public:
|
||||
Item_func_cursor_int_attr(THD *thd, const LEX_CSTRING *name, uint offset)
|
||||
:Item_int_func(thd), m_cursor_name(*name), m_cursor_offset(offset)
|
||||
Cursor_ref(const LEX_CSTRING *name, uint offset)
|
||||
:m_cursor_name(*name), m_cursor_offset(offset)
|
||||
{ }
|
||||
void print_func(String *str, const char *func_name);
|
||||
};
|
||||
|
||||
|
||||
|
||||
class Item_func_cursor_rowcount: public Item_longlong_func,
|
||||
public Cursor_ref
|
||||
{
|
||||
public:
|
||||
Item_func_cursor_rowcount(THD *thd, const LEX_CSTRING *name, uint offset)
|
||||
:Item_longlong_func(thd), Cursor_ref(name, offset) { maybe_null= true; }
|
||||
const char *func_name() const { return "%ROWCOUNT"; }
|
||||
longlong val_int();
|
||||
bool check_vcol_func_processor(void *arg)
|
||||
{
|
||||
return mark_unsupported_function(func_name(), arg, VCOL_SESSION_FUNC);
|
||||
}
|
||||
void print(String *str, enum_query_type query_type);
|
||||
};
|
||||
|
||||
|
||||
class Item_func_cursor_isopen: public Item_func_cursor_int_attr
|
||||
{
|
||||
public:
|
||||
Item_func_cursor_isopen(THD *thd, const LEX_CSTRING *name, uint offset)
|
||||
:Item_func_cursor_int_attr(thd, name, offset) { }
|
||||
const char *func_name() const { return "%ISOPEN"; }
|
||||
void fix_length_and_dec() { max_length= 1; }
|
||||
longlong val_int();
|
||||
Item *get_copy(THD *thd, MEM_ROOT *mem_root)
|
||||
{ return get_item_copy<Item_func_cursor_isopen>(thd, mem_root, this); }
|
||||
};
|
||||
|
||||
|
||||
class Item_func_cursor_found: public Item_func_cursor_int_attr
|
||||
{
|
||||
public:
|
||||
Item_func_cursor_found(THD *thd, const LEX_CSTRING *name, uint offset)
|
||||
:Item_func_cursor_int_attr(thd, name, offset) { }
|
||||
const char *func_name() const { return "%FOUND"; }
|
||||
void fix_length_and_dec() { max_length= 1; maybe_null= true; }
|
||||
longlong val_int();
|
||||
Item *get_copy(THD *thd, MEM_ROOT *mem_root)
|
||||
{ return get_item_copy<Item_func_cursor_found>(thd, mem_root, this); }
|
||||
};
|
||||
|
||||
|
||||
class Item_func_cursor_notfound: public Item_func_cursor_int_attr
|
||||
{
|
||||
public:
|
||||
Item_func_cursor_notfound(THD *thd, const LEX_CSTRING *name, uint offset)
|
||||
:Item_func_cursor_int_attr(thd, name, offset) { }
|
||||
const char *func_name() const { return "%NOTFOUND"; }
|
||||
void fix_length_and_dec() { max_length= 1; maybe_null= true; }
|
||||
longlong val_int();
|
||||
Item *get_copy(THD *thd, MEM_ROOT *mem_root)
|
||||
{ return get_item_copy<Item_func_cursor_notfound>(thd, mem_root, this); }
|
||||
};
|
||||
|
||||
|
||||
class Item_func_cursor_rowcount: public Item_func_cursor_int_attr
|
||||
{
|
||||
public:
|
||||
Item_func_cursor_rowcount(THD *thd, const LEX_CSTRING *name, uint offset)
|
||||
:Item_func_cursor_int_attr(thd, name, offset) { }
|
||||
const char *func_name() const { return "%ROWCOUNT"; }
|
||||
longlong val_int();
|
||||
void print(String *str, enum_query_type query_type)
|
||||
{
|
||||
return Cursor_ref::print_func(str, func_name());
|
||||
}
|
||||
Item *get_copy(THD *thd, MEM_ROOT *mem_root)
|
||||
{ return get_item_copy<Item_func_cursor_rowcount>(thd, mem_root, this); }
|
||||
};
|
||||
|
||||
|
||||
|
||||
class Item_func_connection_id :public Item_int_func
|
||||
class Item_func_connection_id :public Item_long_func
|
||||
{
|
||||
longlong value;
|
||||
|
||||
public:
|
||||
Item_func_connection_id(THD *thd): Item_int_func(thd) {}
|
||||
Item_func_connection_id(THD *thd): Item_long_func(thd) {}
|
||||
const char *func_name() const { return "connection_id"; }
|
||||
void fix_length_and_dec();
|
||||
bool fix_fields(THD *thd, Item **ref);
|
||||
@ -1405,11 +1414,13 @@ private:
|
||||
};
|
||||
|
||||
|
||||
class Item_func_sign :public Item_int_func
|
||||
class Item_func_sign :public Item_long_func
|
||||
{
|
||||
public:
|
||||
Item_func_sign(THD *thd, Item *a): Item_int_func(thd, a) {}
|
||||
Item_func_sign(THD *thd, Item *a): Item_long_func(thd, a) {}
|
||||
const char *func_name() const { return "sign"; }
|
||||
uint decimal_precision() const { return 1; }
|
||||
void fix_length_and_dec() { fix_char_length(2); }
|
||||
longlong val_int();
|
||||
Item *get_copy(THD *thd, MEM_ROOT *mem_root)
|
||||
{ return get_item_copy<Item_func_sign>(thd, mem_root, this); }
|
||||
@ -1573,11 +1584,11 @@ public:
|
||||
};
|
||||
|
||||
|
||||
class Item_func_octet_length :public Item_int_func
|
||||
class Item_func_octet_length :public Item_long_func
|
||||
{
|
||||
String value;
|
||||
public:
|
||||
Item_func_octet_length(THD *thd, Item *a): Item_int_func(thd, a) {}
|
||||
Item_func_octet_length(THD *thd, Item *a): Item_long_func(thd, a) {}
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "octet_length"; }
|
||||
void fix_length_and_dec() { max_length=10; }
|
||||
@ -1585,22 +1596,26 @@ public:
|
||||
{ return get_item_copy<Item_func_octet_length>(thd, mem_root, this); }
|
||||
};
|
||||
|
||||
class Item_func_bit_length :public Item_func_octet_length
|
||||
class Item_func_bit_length :public Item_longlong_func
|
||||
{
|
||||
String value;
|
||||
public:
|
||||
Item_func_bit_length(THD *thd, Item *a): Item_func_octet_length(thd, a) {}
|
||||
longlong val_int()
|
||||
{ DBUG_ASSERT(fixed == 1); return Item_func_octet_length::val_int()*8; }
|
||||
Item_func_bit_length(THD *thd, Item *a): Item_longlong_func(thd, a) {}
|
||||
void fix_length_and_dec()
|
||||
{
|
||||
max_length= 11; // 0x100000000*8 = 34,359,738,368
|
||||
}
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "bit_length"; }
|
||||
Item *get_copy(THD *thd, MEM_ROOT *mem_root)
|
||||
{ return get_item_copy<Item_func_bit_length>(thd, mem_root, this); }
|
||||
};
|
||||
|
||||
class Item_func_char_length :public Item_int_func
|
||||
class Item_func_char_length :public Item_long_func
|
||||
{
|
||||
String value;
|
||||
public:
|
||||
Item_func_char_length(THD *thd, Item *a): Item_int_func(thd, a) {}
|
||||
Item_func_char_length(THD *thd, Item *a): Item_long_func(thd, a) {}
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "char_length"; }
|
||||
void fix_length_and_dec() { max_length=10; }
|
||||
@ -1608,10 +1623,10 @@ public:
|
||||
{ return get_item_copy<Item_func_char_length>(thd, mem_root, this); }
|
||||
};
|
||||
|
||||
class Item_func_coercibility :public Item_int_func
|
||||
class Item_func_coercibility :public Item_long_func
|
||||
{
|
||||
public:
|
||||
Item_func_coercibility(THD *thd, Item *a): Item_int_func(thd, a) {}
|
||||
Item_func_coercibility(THD *thd, Item *a): Item_long_func(thd, a) {}
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "coercibility"; }
|
||||
void fix_length_and_dec() { max_length=10; maybe_null= 0; }
|
||||
@ -1623,29 +1638,42 @@ public:
|
||||
{ return get_item_copy<Item_func_coercibility>(thd, mem_root, this); }
|
||||
};
|
||||
|
||||
class Item_func_locate :public Item_int_func
|
||||
|
||||
/*
|
||||
In the corner case LOCATE could return (4,294,967,296 + 1),
|
||||
which would not fit into Item_long_func range.
|
||||
But string lengths are limited with max_allowed_packet,
|
||||
which cannot be bigger than 1024*1024*1024.
|
||||
*/
|
||||
class Item_func_locate :public Item_long_func
|
||||
{
|
||||
String value1,value2;
|
||||
DTCollation cmp_collation;
|
||||
public:
|
||||
Item_func_locate(THD *thd, Item *a, Item *b): Item_int_func(thd, a, b) {}
|
||||
Item_func_locate(THD *thd, Item *a, Item *b, Item *c): Item_int_func(thd, a, b, c) {}
|
||||
Item_func_locate(THD *thd, Item *a, Item *b)
|
||||
:Item_long_func(thd, a, b) {}
|
||||
Item_func_locate(THD *thd, Item *a, Item *b, Item *c)
|
||||
:Item_long_func(thd, a, b, c) {}
|
||||
const char *func_name() const { return "locate"; }
|
||||
longlong val_int();
|
||||
void fix_length_and_dec();
|
||||
void fix_length_and_dec()
|
||||
{
|
||||
max_length= MY_INT32_NUM_DECIMAL_DIGITS;
|
||||
agg_arg_charsets_for_comparison(cmp_collation, args, 2);
|
||||
}
|
||||
virtual void print(String *str, enum_query_type query_type);
|
||||
Item *get_copy(THD *thd, MEM_ROOT *mem_root)
|
||||
{ return get_item_copy<Item_func_locate>(thd, mem_root, this); }
|
||||
};
|
||||
|
||||
|
||||
class Item_func_field :public Item_int_func
|
||||
class Item_func_field :public Item_long_func
|
||||
{
|
||||
String value,tmp;
|
||||
Item_result cmp_type;
|
||||
DTCollation cmp_collation;
|
||||
public:
|
||||
Item_func_field(THD *thd, List<Item> &list): Item_int_func(thd, list) {}
|
||||
Item_func_field(THD *thd, List<Item> &list): Item_long_func(thd, list) {}
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "field"; }
|
||||
void fix_length_and_dec();
|
||||
@ -1654,11 +1682,11 @@ public:
|
||||
};
|
||||
|
||||
|
||||
class Item_func_ascii :public Item_int_func
|
||||
class Item_func_ascii :public Item_long_func
|
||||
{
|
||||
String value;
|
||||
public:
|
||||
Item_func_ascii(THD *thd, Item *a): Item_int_func(thd, a) {}
|
||||
Item_func_ascii(THD *thd, Item *a): Item_long_func(thd, a) {}
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "ascii"; }
|
||||
void fix_length_and_dec() { max_length=3; }
|
||||
@ -1666,18 +1694,19 @@ public:
|
||||
{ return get_item_copy<Item_func_ascii>(thd, mem_root, this); }
|
||||
};
|
||||
|
||||
class Item_func_ord :public Item_int_func
|
||||
class Item_func_ord :public Item_long_func
|
||||
{
|
||||
String value;
|
||||
public:
|
||||
Item_func_ord(THD *thd, Item *a): Item_int_func(thd, a) {}
|
||||
Item_func_ord(THD *thd, Item *a): Item_long_func(thd, a) {}
|
||||
void fix_length_and_dec() { fix_char_length(7); }
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "ord"; }
|
||||
Item *get_copy(THD *thd, MEM_ROOT *mem_root)
|
||||
{ return get_item_copy<Item_func_ord>(thd, mem_root, this); }
|
||||
};
|
||||
|
||||
class Item_func_find_in_set :public Item_int_func
|
||||
class Item_func_find_in_set :public Item_long_func
|
||||
{
|
||||
String value,value2;
|
||||
uint enum_value;
|
||||
@ -1685,7 +1714,7 @@ class Item_func_find_in_set :public Item_int_func
|
||||
DTCollation cmp_collation;
|
||||
public:
|
||||
Item_func_find_in_set(THD *thd, Item *a, Item *b):
|
||||
Item_int_func(thd, a, b), enum_value(0) {}
|
||||
Item_long_func(thd, a, b), enum_value(0) {}
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "find_in_set"; }
|
||||
void fix_length_and_dec();
|
||||
@ -1695,11 +1724,11 @@ public:
|
||||
|
||||
/* Base class for all bit functions: '~', '|', '^', '&', '>>', '<<' */
|
||||
|
||||
class Item_func_bit: public Item_int_func
|
||||
class Item_func_bit: public Item_longlong_func
|
||||
{
|
||||
public:
|
||||
Item_func_bit(THD *thd, Item *a, Item *b): Item_int_func(thd, a, b) {}
|
||||
Item_func_bit(THD *thd, Item *a): Item_int_func(thd, a) {}
|
||||
Item_func_bit(THD *thd, Item *a, Item *b): Item_longlong_func(thd, a, b) {}
|
||||
Item_func_bit(THD *thd, Item *a): Item_longlong_func(thd, a) {}
|
||||
void fix_length_and_dec() { unsigned_flag= 1; }
|
||||
|
||||
virtual inline void print(String *str, enum_query_type query_type)
|
||||
@ -1731,10 +1760,10 @@ public:
|
||||
{ return get_item_copy<Item_func_bit_and>(thd, mem_root, this); }
|
||||
};
|
||||
|
||||
class Item_func_bit_count :public Item_int_func
|
||||
class Item_func_bit_count :public Item_long_func
|
||||
{
|
||||
public:
|
||||
Item_func_bit_count(THD *thd, Item *a): Item_int_func(thd, a) {}
|
||||
Item_func_bit_count(THD *thd, Item *a): Item_long_func(thd, a) {}
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "bit_count"; }
|
||||
void fix_length_and_dec() { max_length=2; }
|
||||
@ -1781,19 +1810,18 @@ public:
|
||||
};
|
||||
|
||||
|
||||
class Item_func_last_insert_id :public Item_int_func
|
||||
class Item_func_last_insert_id :public Item_longlong_func
|
||||
{
|
||||
public:
|
||||
Item_func_last_insert_id(THD *thd): Item_int_func(thd) {}
|
||||
Item_func_last_insert_id(THD *thd, Item *a): Item_int_func(thd, a) {}
|
||||
Item_func_last_insert_id(THD *thd): Item_longlong_func(thd) {}
|
||||
Item_func_last_insert_id(THD *thd, Item *a): Item_longlong_func(thd, a) {}
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "last_insert_id"; }
|
||||
void fix_length_and_dec()
|
||||
{
|
||||
unsigned_flag= TRUE;
|
||||
unsigned_flag= true;
|
||||
if (arg_count)
|
||||
max_length= args[0]->max_length;
|
||||
unsigned_flag=1;
|
||||
}
|
||||
bool fix_fields(THD *thd, Item **ref);
|
||||
bool check_vcol_func_processor(void *arg)
|
||||
@ -1805,11 +1833,11 @@ public:
|
||||
};
|
||||
|
||||
|
||||
class Item_func_benchmark :public Item_int_func
|
||||
class Item_func_benchmark :public Item_long_func
|
||||
{
|
||||
public:
|
||||
Item_func_benchmark(THD *thd, Item *count_expr, Item *expr):
|
||||
Item_int_func(thd, count_expr, expr)
|
||||
Item_long_func(thd, count_expr, expr)
|
||||
{}
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "benchmark"; }
|
||||
@ -1827,10 +1855,11 @@ public:
|
||||
void item_func_sleep_init(void);
|
||||
void item_func_sleep_free(void);
|
||||
|
||||
class Item_func_sleep :public Item_int_func
|
||||
class Item_func_sleep :public Item_long_func
|
||||
{
|
||||
public:
|
||||
Item_func_sleep(THD *thd, Item *a): Item_int_func(thd, a) {}
|
||||
Item_func_sleep(THD *thd, Item *a): Item_long_func(thd, a) {}
|
||||
void fix_length_and_dec() { fix_char_length(1); }
|
||||
bool const_item() const { return 0; }
|
||||
const char *func_name() const { return "sleep"; }
|
||||
table_map used_tables() const
|
||||
@ -2100,11 +2129,11 @@ public:
|
||||
void mysql_ull_cleanup(THD *thd);
|
||||
void mysql_ull_set_explicit_lock_duration(THD *thd);
|
||||
|
||||
class Item_func_get_lock :public Item_int_func
|
||||
class Item_func_get_lock :public Item_long_func
|
||||
{
|
||||
String value;
|
||||
public:
|
||||
Item_func_get_lock(THD *thd, Item *a, Item *b) :Item_int_func(thd, a, b) {}
|
||||
Item_func_get_lock(THD *thd, Item *a, Item *b) :Item_long_func(thd, a, b) {}
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "get_lock"; }
|
||||
void fix_length_and_dec() { max_length=1; maybe_null=1;}
|
||||
@ -2122,11 +2151,11 @@ class Item_func_get_lock :public Item_int_func
|
||||
{ return get_item_copy<Item_func_get_lock>(thd, mem_root, this); }
|
||||
};
|
||||
|
||||
class Item_func_release_lock :public Item_int_func
|
||||
class Item_func_release_lock :public Item_long_func
|
||||
{
|
||||
String value;
|
||||
public:
|
||||
Item_func_release_lock(THD *thd, Item *a): Item_int_func(thd, a) {}
|
||||
Item_func_release_lock(THD *thd, Item *a): Item_long_func(thd, a) {}
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "release_lock"; }
|
||||
void fix_length_and_dec() { max_length= 1; maybe_null= 1;}
|
||||
@ -2146,15 +2175,16 @@ public:
|
||||
|
||||
/* replication functions */
|
||||
|
||||
class Item_master_pos_wait :public Item_int_func
|
||||
class Item_master_pos_wait :public Item_longlong_func
|
||||
{
|
||||
String value;
|
||||
public:
|
||||
Item_master_pos_wait(THD *thd, Item *a, Item *b): Item_int_func(thd, a, b) {}
|
||||
Item_master_pos_wait(THD *thd, Item *a, Item *b)
|
||||
:Item_longlong_func(thd, a, b) {}
|
||||
Item_master_pos_wait(THD *thd, Item *a, Item *b, Item *c):
|
||||
Item_int_func(thd, a, b, c) {}
|
||||
Item_longlong_func(thd, a, b, c) {}
|
||||
Item_master_pos_wait(THD *thd, Item *a, Item *b, Item *c, Item *d):
|
||||
Item_int_func(thd, a, b, c, d) {}
|
||||
Item_longlong_func(thd, a, b, c, d) {}
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "master_pos_wait"; }
|
||||
void fix_length_and_dec() { max_length=21; maybe_null=1;}
|
||||
@ -2167,15 +2197,17 @@ public:
|
||||
};
|
||||
|
||||
|
||||
class Item_master_gtid_wait :public Item_int_func
|
||||
class Item_master_gtid_wait :public Item_long_func
|
||||
{
|
||||
String value;
|
||||
public:
|
||||
Item_master_gtid_wait(THD *thd, Item *a): Item_int_func(thd, a) {}
|
||||
Item_master_gtid_wait(THD *thd, Item *a, Item *b): Item_int_func(thd, a, b) {}
|
||||
Item_master_gtid_wait(THD *thd, Item *a)
|
||||
:Item_long_func(thd, a) {}
|
||||
Item_master_gtid_wait(THD *thd, Item *a, Item *b)
|
||||
:Item_long_func(thd, a, b) {}
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "master_gtid_wait"; }
|
||||
void fix_length_and_dec() { max_length=10+1+10+1+20+1; maybe_null=0;}
|
||||
void fix_length_and_dec() { max_length= 2; maybe_null=0;}
|
||||
bool check_vcol_func_processor(void *arg)
|
||||
{
|
||||
return mark_unsupported_function(func_name(), "()", arg, VCOL_IMPOSSIBLE);
|
||||
@ -2527,11 +2559,11 @@ public:
|
||||
{ return get_item_copy<Item_func_bit_xor>(thd, mem_root, this); }
|
||||
};
|
||||
|
||||
class Item_func_is_free_lock :public Item_int_func
|
||||
class Item_func_is_free_lock :public Item_long_func
|
||||
{
|
||||
String value;
|
||||
public:
|
||||
Item_func_is_free_lock(THD *thd, Item *a): Item_int_func(thd, a) {}
|
||||
Item_func_is_free_lock(THD *thd, Item *a): Item_long_func(thd, a) {}
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "is_free_lock"; }
|
||||
void fix_length_and_dec() { decimals=0; max_length=1; maybe_null=1;}
|
||||
@ -2543,11 +2575,11 @@ public:
|
||||
{ return get_item_copy<Item_func_is_free_lock>(thd, mem_root, this); }
|
||||
};
|
||||
|
||||
class Item_func_is_used_lock :public Item_int_func
|
||||
class Item_func_is_used_lock :public Item_long_func
|
||||
{
|
||||
String value;
|
||||
public:
|
||||
Item_func_is_used_lock(THD *thd, Item *a): Item_int_func(thd, a) {}
|
||||
Item_func_is_used_lock(THD *thd, Item *a): Item_long_func(thd, a) {}
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "is_used_lock"; }
|
||||
void fix_length_and_dec() { decimals=0; max_length=10; maybe_null=1;}
|
||||
@ -2596,10 +2628,10 @@ public:
|
||||
};
|
||||
|
||||
|
||||
class Item_func_row_count :public Item_int_func
|
||||
class Item_func_row_count :public Item_longlong_func
|
||||
{
|
||||
public:
|
||||
Item_func_row_count(THD *thd): Item_int_func(thd) {}
|
||||
Item_func_row_count(THD *thd): Item_longlong_func(thd) {}
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "row_count"; }
|
||||
void fix_length_and_dec() { decimals= 0; maybe_null=0; }
|
||||
@ -2755,10 +2787,10 @@ public:
|
||||
};
|
||||
|
||||
|
||||
class Item_func_found_rows :public Item_int_func
|
||||
class Item_func_found_rows :public Item_longlong_func
|
||||
{
|
||||
public:
|
||||
Item_func_found_rows(THD *thd): Item_int_func(thd) {}
|
||||
Item_func_found_rows(THD *thd): Item_longlong_func(thd) {}
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "found_rows"; }
|
||||
void fix_length_and_dec() { decimals= 0; maybe_null=0; }
|
||||
@ -2771,10 +2803,10 @@ public:
|
||||
};
|
||||
|
||||
|
||||
class Item_func_oracle_sql_rowcount :public Item_int_func
|
||||
class Item_func_oracle_sql_rowcount :public Item_longlong_func
|
||||
{
|
||||
public:
|
||||
Item_func_oracle_sql_rowcount(THD *thd): Item_int_func(thd) {}
|
||||
Item_func_oracle_sql_rowcount(THD *thd): Item_longlong_func(thd) {}
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "SQL%ROWCOUNT"; }
|
||||
void print(String *str, enum_query_type query_type)
|
||||
@ -2790,10 +2822,10 @@ public:
|
||||
};
|
||||
|
||||
|
||||
class Item_func_sqlcode: public Item_int_func
|
||||
class Item_func_sqlcode: public Item_long_func
|
||||
{
|
||||
public:
|
||||
Item_func_sqlcode(THD *thd): Item_int_func(thd) { }
|
||||
Item_func_sqlcode(THD *thd): Item_long_func(thd) { }
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "SQLCODE"; }
|
||||
void print(String *str, enum_query_type query_type)
|
||||
@ -2816,10 +2848,10 @@ public:
|
||||
|
||||
void uuid_short_init();
|
||||
|
||||
class Item_func_uuid_short :public Item_int_func
|
||||
class Item_func_uuid_short :public Item_longlong_func
|
||||
{
|
||||
public:
|
||||
Item_func_uuid_short(THD *thd): Item_int_func(thd) {}
|
||||
Item_func_uuid_short(THD *thd): Item_longlong_func(thd) {}
|
||||
const char *func_name() const { return "uuid_short"; }
|
||||
longlong val_int();
|
||||
void fix_length_and_dec()
|
||||
@ -2862,13 +2894,13 @@ public:
|
||||
|
||||
/* Implementation for sequences: NEXT VALUE FOR sequence and NEXTVAL() */
|
||||
|
||||
class Item_func_nextval :public Item_int_func
|
||||
class Item_func_nextval :public Item_longlong_func
|
||||
{
|
||||
protected:
|
||||
TABLE_LIST *table_list;
|
||||
public:
|
||||
Item_func_nextval(THD *thd, TABLE_LIST *table):
|
||||
Item_int_func(thd), table_list(table) {}
|
||||
Item_longlong_func(thd), table_list(table) {}
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "nextval"; }
|
||||
void fix_length_and_dec()
|
||||
|
@ -506,14 +506,14 @@ public:
|
||||
{ return get_item_copy<Item_func_isempty>(thd, mem_root, this); }
|
||||
};
|
||||
|
||||
class Item_func_issimple: public Item_int_func
|
||||
class Item_func_issimple: public Item_long_func
|
||||
{
|
||||
Gcalc_heap collector;
|
||||
Gcalc_function func;
|
||||
Gcalc_scan_iterator scan_it;
|
||||
String tmp;
|
||||
public:
|
||||
Item_func_issimple(THD *thd, Item *a): Item_int_func(thd, a) {}
|
||||
Item_func_issimple(THD *thd, Item *a): Item_long_func(thd, a) {}
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "st_issimple"; }
|
||||
void fix_length_and_dec() { decimals=0; max_length=2; }
|
||||
@ -522,10 +522,10 @@ public:
|
||||
{ return get_item_copy<Item_func_issimple>(thd, mem_root, this); }
|
||||
};
|
||||
|
||||
class Item_func_isclosed: public Item_int_func
|
||||
class Item_func_isclosed: public Item_long_func
|
||||
{
|
||||
public:
|
||||
Item_func_isclosed(THD *thd, Item *a): Item_int_func(thd, a) {}
|
||||
Item_func_isclosed(THD *thd, Item *a): Item_long_func(thd, a) {}
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "st_isclosed"; }
|
||||
void fix_length_and_dec() { decimals=0; max_length=2; }
|
||||
@ -544,11 +544,11 @@ public:
|
||||
{ return get_item_copy<Item_func_isring>(thd, mem_root, this); }
|
||||
};
|
||||
|
||||
class Item_func_dimension: public Item_int_func
|
||||
class Item_func_dimension: public Item_long_func
|
||||
{
|
||||
String value;
|
||||
public:
|
||||
Item_func_dimension(THD *thd, Item *a): Item_int_func(thd, a) {}
|
||||
Item_func_dimension(THD *thd, Item *a): Item_long_func(thd, a) {}
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "st_dimension"; }
|
||||
void fix_length_and_dec() { max_length= 10; maybe_null= 1; }
|
||||
@ -590,11 +590,11 @@ public:
|
||||
};
|
||||
|
||||
|
||||
class Item_func_numgeometries: public Item_int_func
|
||||
class Item_func_numgeometries: public Item_long_func
|
||||
{
|
||||
String value;
|
||||
public:
|
||||
Item_func_numgeometries(THD *thd, Item *a): Item_int_func(thd, a) {}
|
||||
Item_func_numgeometries(THD *thd, Item *a): Item_long_func(thd, a) {}
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "st_numgeometries"; }
|
||||
void fix_length_and_dec() { max_length= 10; maybe_null= 1; }
|
||||
@ -603,11 +603,11 @@ public:
|
||||
};
|
||||
|
||||
|
||||
class Item_func_numinteriorring: public Item_int_func
|
||||
class Item_func_numinteriorring: public Item_long_func
|
||||
{
|
||||
String value;
|
||||
public:
|
||||
Item_func_numinteriorring(THD *thd, Item *a): Item_int_func(thd, a) {}
|
||||
Item_func_numinteriorring(THD *thd, Item *a): Item_long_func(thd, a) {}
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "st_numinteriorrings"; }
|
||||
void fix_length_and_dec() { max_length= 10; maybe_null= 1; }
|
||||
@ -616,11 +616,11 @@ public:
|
||||
};
|
||||
|
||||
|
||||
class Item_func_numpoints: public Item_int_func
|
||||
class Item_func_numpoints: public Item_long_func
|
||||
{
|
||||
String value;
|
||||
public:
|
||||
Item_func_numpoints(THD *thd, Item *a): Item_int_func(thd, a) {}
|
||||
Item_func_numpoints(THD *thd, Item *a): Item_long_func(thd, a) {}
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "st_numpoints"; }
|
||||
void fix_length_and_dec() { max_length= 10; maybe_null= 1; }
|
||||
@ -663,11 +663,11 @@ public:
|
||||
};
|
||||
|
||||
|
||||
class Item_func_srid: public Item_int_func
|
||||
class Item_func_srid: public Item_long_func
|
||||
{
|
||||
String value;
|
||||
public:
|
||||
Item_func_srid(THD *thd, Item *a): Item_int_func(thd, a) {}
|
||||
Item_func_srid(THD *thd, Item *a): Item_long_func(thd, a) {}
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "srid"; }
|
||||
void fix_length_and_dec() { max_length= 10; maybe_null= 1; }
|
||||
@ -709,11 +709,12 @@ public:
|
||||
|
||||
|
||||
#ifndef DBUG_OFF
|
||||
class Item_func_gis_debug: public Item_int_func
|
||||
class Item_func_gis_debug: public Item_long_func
|
||||
{
|
||||
public:
|
||||
Item_func_gis_debug(THD *thd, Item *a): Item_int_func(thd, a)
|
||||
Item_func_gis_debug(THD *thd, Item *a): Item_long_func(thd, a)
|
||||
{ null_value= false; }
|
||||
void fix_length_and_dec() { fix_char_length(10); }
|
||||
const char *func_name() const { return "st_gis_debug"; }
|
||||
longlong val_int();
|
||||
bool check_vcol_func_processor(void *arg)
|
||||
|
@ -24,10 +24,10 @@
|
||||
Item_func_inet_aton implements INET_ATON() SQL-function.
|
||||
*************************************************************************/
|
||||
|
||||
class Item_func_inet_aton : public Item_int_func
|
||||
class Item_func_inet_aton : public Item_longlong_func
|
||||
{
|
||||
public:
|
||||
Item_func_inet_aton(THD *thd, Item *a): Item_int_func(thd, a) {}
|
||||
Item_func_inet_aton(THD *thd, Item *a): Item_longlong_func(thd, a) {}
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "inet_aton"; }
|
||||
void fix_length_and_dec()
|
||||
|
@ -390,7 +390,7 @@ longlong Item_func_json_valid::val_int()
|
||||
|
||||
void Item_func_json_exists::fix_length_and_dec()
|
||||
{
|
||||
Item_int_func::fix_length_and_dec();
|
||||
Item_bool_func::fix_length_and_dec();
|
||||
maybe_null= 1;
|
||||
path.set_constant_flag(args[1]->const_item());
|
||||
}
|
||||
@ -890,7 +890,7 @@ void Item_func_json_contains::fix_length_and_dec()
|
||||
maybe_null= 1;
|
||||
if (arg_count > 2)
|
||||
path.set_constant_flag(args[2]->const_item());
|
||||
Item_int_func::fix_length_and_dec();
|
||||
Item_bool_func::fix_length_and_dec();
|
||||
}
|
||||
|
||||
|
||||
@ -1135,7 +1135,7 @@ void Item_func_json_contains_path::fix_length_and_dec()
|
||||
ooa_parsed= FALSE;
|
||||
maybe_null= 1;
|
||||
mark_constant_paths(paths, args+2, arg_count-2);
|
||||
Item_int_func::fix_length_and_dec();
|
||||
Item_bool_func::fix_length_and_dec();
|
||||
}
|
||||
|
||||
|
||||
@ -2050,6 +2050,7 @@ void Item_func_json_length::fix_length_and_dec()
|
||||
if (arg_count > 1)
|
||||
path.set_constant_flag(args[1]->const_item());
|
||||
maybe_null= 1;
|
||||
max_length= 10;
|
||||
}
|
||||
|
||||
|
||||
|
@ -40,27 +40,26 @@ public:
|
||||
};
|
||||
|
||||
|
||||
class Item_func_json_valid: public Item_int_func
|
||||
class Item_func_json_valid: public Item_bool_func
|
||||
{
|
||||
protected:
|
||||
String tmp_value;
|
||||
|
||||
public:
|
||||
Item_func_json_valid(THD *thd, Item *json) : Item_int_func(thd, json) {}
|
||||
Item_func_json_valid(THD *thd, Item *json) : Item_bool_func(thd, json) {}
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "json_valid"; }
|
||||
void fix_length_and_dec()
|
||||
{
|
||||
Item_int_func::fix_length_and_dec();
|
||||
Item_bool_func::fix_length_and_dec();
|
||||
maybe_null= 1;
|
||||
}
|
||||
bool is_bool_type() { return true; }
|
||||
Item *get_copy(THD *thd, MEM_ROOT *mem_root)
|
||||
{ return get_item_copy<Item_func_json_valid>(thd, mem_root, this); }
|
||||
};
|
||||
|
||||
|
||||
class Item_func_json_exists: public Item_int_func
|
||||
class Item_func_json_exists: public Item_bool_func
|
||||
{
|
||||
protected:
|
||||
json_path_with_flags path;
|
||||
@ -68,9 +67,8 @@ protected:
|
||||
|
||||
public:
|
||||
Item_func_json_exists(THD *thd, Item *js, Item *i_path):
|
||||
Item_int_func(thd, js, i_path) {}
|
||||
Item_bool_func(thd, js, i_path) {}
|
||||
const char *func_name() const { return "json_exists"; }
|
||||
bool is_bool_type() { return true; }
|
||||
void fix_length_and_dec();
|
||||
Item *get_copy(THD *thd, MEM_ROOT *mem_root)
|
||||
{ return get_item_copy<Item_func_json_exists>(thd, mem_root, this); }
|
||||
@ -170,7 +168,7 @@ public:
|
||||
};
|
||||
|
||||
|
||||
class Item_func_json_contains: public Item_int_func
|
||||
class Item_func_json_contains: public Item_bool_func
|
||||
{
|
||||
protected:
|
||||
String tmp_js;
|
||||
@ -180,7 +178,7 @@ protected:
|
||||
String tmp_val, *val;
|
||||
public:
|
||||
Item_func_json_contains(THD *thd, List<Item> &list):
|
||||
Item_int_func(thd, list) {}
|
||||
Item_bool_func(thd, list) {}
|
||||
const char *func_name() const { return "json_contains"; }
|
||||
void fix_length_and_dec();
|
||||
longlong val_int();
|
||||
@ -189,7 +187,7 @@ public:
|
||||
};
|
||||
|
||||
|
||||
class Item_func_json_contains_path: public Item_int_func
|
||||
class Item_func_json_contains_path: public Item_bool_func
|
||||
{
|
||||
protected:
|
||||
String tmp_js;
|
||||
@ -201,7 +199,7 @@ protected:
|
||||
|
||||
public:
|
||||
Item_func_json_contains_path(THD *thd, List<Item> &list):
|
||||
Item_int_func(thd, list), tmp_paths(0) {}
|
||||
Item_bool_func(thd, list), tmp_paths(0) {}
|
||||
const char *func_name() const { return "json_contains_path"; }
|
||||
bool fix_fields(THD *thd, Item **ref);
|
||||
void fix_length_and_dec();
|
||||
@ -290,7 +288,7 @@ public:
|
||||
};
|
||||
|
||||
|
||||
class Item_func_json_length: public Item_int_func
|
||||
class Item_func_json_length: public Item_long_func
|
||||
{
|
||||
protected:
|
||||
json_path_with_flags path;
|
||||
@ -298,7 +296,7 @@ protected:
|
||||
String tmp_path;
|
||||
public:
|
||||
Item_func_json_length(THD *thd, List<Item> &list):
|
||||
Item_int_func(thd, list) {}
|
||||
Item_long_func(thd, list) {}
|
||||
const char *func_name() const { return "json_length"; }
|
||||
void fix_length_and_dec();
|
||||
longlong val_int();
|
||||
@ -307,13 +305,14 @@ public:
|
||||
};
|
||||
|
||||
|
||||
class Item_func_json_depth: public Item_int_func
|
||||
class Item_func_json_depth: public Item_long_func
|
||||
{
|
||||
protected:
|
||||
String tmp_js;
|
||||
public:
|
||||
Item_func_json_depth(THD *thd, Item *js): Item_int_func(thd, js) {}
|
||||
Item_func_json_depth(THD *thd, Item *js): Item_long_func(thd, js) {}
|
||||
const char *func_name() const { return "json_depth"; }
|
||||
void fix_length_and_dec() { max_length= 10; }
|
||||
longlong val_int();
|
||||
Item *get_copy(THD *thd, MEM_ROOT *mem_root)
|
||||
{ return get_item_copy<Item_func_json_depth>(thd, mem_root, this); }
|
||||
|
@ -1444,11 +1444,11 @@ public:
|
||||
{ return get_item_copy<Item_func_weight_string>(thd, mem_root, this); }
|
||||
};
|
||||
|
||||
class Item_func_crc32 :public Item_int_func
|
||||
class Item_func_crc32 :public Item_long_func
|
||||
{
|
||||
String value;
|
||||
public:
|
||||
Item_func_crc32(THD *thd, Item *a): Item_int_func(thd, a)
|
||||
Item_func_crc32(THD *thd, Item *a): Item_long_func(thd, a)
|
||||
{ unsigned_flag= 1; }
|
||||
const char *func_name() const { return "crc32"; }
|
||||
void fix_length_and_dec() { max_length=10; }
|
||||
@ -1457,11 +1457,11 @@ public:
|
||||
{ return get_item_copy<Item_func_crc32>(thd, mem_root, this); }
|
||||
};
|
||||
|
||||
class Item_func_uncompressed_length : public Item_int_func
|
||||
class Item_func_uncompressed_length : public Item_long_func
|
||||
{
|
||||
String value;
|
||||
public:
|
||||
Item_func_uncompressed_length(THD *thd, Item *a): Item_int_func(thd, a) {}
|
||||
Item_func_uncompressed_length(THD *thd, Item *a): Item_long_func(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,10 +33,10 @@ enum date_time_format_types
|
||||
|
||||
bool get_interval_value(Item *args,interval_type int_type, INTERVAL *interval);
|
||||
|
||||
class Item_func_period_add :public Item_int_func
|
||||
class Item_func_period_add :public Item_long_func
|
||||
{
|
||||
public:
|
||||
Item_func_period_add(THD *thd, Item *a, Item *b): Item_int_func(thd, a, b) {}
|
||||
Item_func_period_add(THD *thd, Item *a, Item *b): Item_long_func(thd, a, b) {}
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "period_add"; }
|
||||
void fix_length_and_dec()
|
||||
@ -48,10 +48,10 @@ public:
|
||||
};
|
||||
|
||||
|
||||
class Item_func_period_diff :public Item_int_func
|
||||
class Item_func_period_diff :public Item_long_func
|
||||
{
|
||||
public:
|
||||
Item_func_period_diff(THD *thd, Item *a, Item *b): Item_int_func(thd, a, b) {}
|
||||
Item_func_period_diff(THD *thd, Item *a, Item *b): Item_long_func(thd, a, b) {}
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "period_diff"; }
|
||||
void fix_length_and_dec()
|
||||
@ -64,10 +64,10 @@ public:
|
||||
};
|
||||
|
||||
|
||||
class Item_func_to_days :public Item_int_func
|
||||
class Item_func_to_days :public Item_long_func
|
||||
{
|
||||
public:
|
||||
Item_func_to_days(THD *thd, Item *a): Item_int_func(thd, a) {}
|
||||
Item_func_to_days(THD *thd, Item *a): Item_long_func(thd, a) {}
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "to_days"; }
|
||||
void fix_length_and_dec()
|
||||
@ -89,10 +89,10 @@ public:
|
||||
};
|
||||
|
||||
|
||||
class Item_func_to_seconds :public Item_int_func
|
||||
class Item_func_to_seconds :public Item_long_func
|
||||
{
|
||||
public:
|
||||
Item_func_to_seconds(THD *thd, Item *a): Item_int_func(thd, a) {}
|
||||
Item_func_to_seconds(THD *thd, Item *a): Item_long_func(thd, a) {}
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "to_seconds"; }
|
||||
void fix_length_and_dec()
|
||||
@ -115,10 +115,10 @@ public:
|
||||
};
|
||||
|
||||
|
||||
class Item_func_dayofmonth :public Item_int_func
|
||||
class Item_func_dayofmonth :public Item_long_func
|
||||
{
|
||||
public:
|
||||
Item_func_dayofmonth(THD *thd, Item *a): Item_int_func(thd, a) {}
|
||||
Item_func_dayofmonth(THD *thd, Item *a): Item_long_func(thd, a) {}
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "dayofmonth"; }
|
||||
void fix_length_and_dec()
|
||||
@ -196,10 +196,10 @@ public:
|
||||
};
|
||||
|
||||
|
||||
class Item_func_dayofyear :public Item_int_func
|
||||
class Item_func_dayofyear :public Item_long_func
|
||||
{
|
||||
public:
|
||||
Item_func_dayofyear(THD *thd, Item *a): Item_int_func(thd, a) {}
|
||||
Item_func_dayofyear(THD *thd, Item *a): Item_long_func(thd, a) {}
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "dayofyear"; }
|
||||
void fix_length_and_dec()
|
||||
@ -219,10 +219,10 @@ public:
|
||||
};
|
||||
|
||||
|
||||
class Item_func_hour :public Item_int_func
|
||||
class Item_func_hour :public Item_long_func
|
||||
{
|
||||
public:
|
||||
Item_func_hour(THD *thd, Item *a): Item_int_func(thd, a) {}
|
||||
Item_func_hour(THD *thd, Item *a): Item_long_func(thd, a) {}
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "hour"; }
|
||||
void fix_length_and_dec()
|
||||
@ -242,10 +242,10 @@ public:
|
||||
};
|
||||
|
||||
|
||||
class Item_func_minute :public Item_int_func
|
||||
class Item_func_minute :public Item_long_func
|
||||
{
|
||||
public:
|
||||
Item_func_minute(THD *thd, Item *a): Item_int_func(thd, a) {}
|
||||
Item_func_minute(THD *thd, Item *a): Item_long_func(thd, a) {}
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "minute"; }
|
||||
void fix_length_and_dec()
|
||||
@ -265,10 +265,10 @@ public:
|
||||
};
|
||||
|
||||
|
||||
class Item_func_quarter :public Item_int_func
|
||||
class Item_func_quarter :public Item_long_func
|
||||
{
|
||||
public:
|
||||
Item_func_quarter(THD *thd, Item *a): Item_int_func(thd, a) {}
|
||||
Item_func_quarter(THD *thd, Item *a): Item_long_func(thd, a) {}
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "quarter"; }
|
||||
void fix_length_and_dec()
|
||||
@ -288,10 +288,10 @@ public:
|
||||
};
|
||||
|
||||
|
||||
class Item_func_second :public Item_int_func
|
||||
class Item_func_second :public Item_long_func
|
||||
{
|
||||
public:
|
||||
Item_func_second(THD *thd, Item *a): Item_int_func(thd, a) {}
|
||||
Item_func_second(THD *thd, Item *a): Item_long_func(thd, a) {}
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "second"; }
|
||||
void fix_length_and_dec()
|
||||
@ -311,11 +311,11 @@ public:
|
||||
};
|
||||
|
||||
|
||||
class Item_func_week :public Item_int_func
|
||||
class Item_func_week :public Item_long_func
|
||||
{
|
||||
public:
|
||||
Item_func_week(THD *thd, Item *a): Item_int_func(thd, a) {}
|
||||
Item_func_week(THD *thd, Item *a, Item *b): Item_int_func(thd, a, b) {}
|
||||
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) {}
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "week"; }
|
||||
void fix_length_and_dec()
|
||||
@ -338,10 +338,10 @@ public:
|
||||
{ return get_item_copy<Item_func_week>(thd, mem_root, this); }
|
||||
};
|
||||
|
||||
class Item_func_yearweek :public Item_int_func
|
||||
class Item_func_yearweek :public Item_long_func
|
||||
{
|
||||
public:
|
||||
Item_func_yearweek(THD *thd, Item *a, Item *b): Item_int_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()
|
||||
@ -361,10 +361,10 @@ public:
|
||||
};
|
||||
|
||||
|
||||
class Item_func_year :public Item_int_func
|
||||
class Item_func_year :public Item_long_func
|
||||
{
|
||||
public:
|
||||
Item_func_year(THD *thd, Item *a): Item_int_func(thd, a) {}
|
||||
Item_func_year(THD *thd, Item *a): Item_long_func(thd, a) {}
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "year"; }
|
||||
enum_monotonicity_info get_monotonicity_info() const;
|
||||
@ -404,7 +404,7 @@ public:
|
||||
{
|
||||
return (odbc_type ? "dayofweek" : "weekday");
|
||||
}
|
||||
const Type_handler *type_handler() const { return &type_handler_longlong; }
|
||||
const Type_handler *type_handler() const { return &type_handler_long; }
|
||||
void fix_length_and_dec()
|
||||
{
|
||||
decimals= 0;
|
||||
@ -1012,6 +1012,8 @@ class Item_extract :public Item_int_func
|
||||
}
|
||||
return true;
|
||||
}
|
||||
Field *create_tmp_field(bool group, TABLE *table)
|
||||
{ return tmp_table_field_from_field_type(table); }
|
||||
Field *create_field_for_create_select(TABLE *table)
|
||||
{ return tmp_table_field_from_field_type(table); }
|
||||
|
||||
@ -1177,16 +1179,17 @@ public:
|
||||
};
|
||||
|
||||
|
||||
class Item_func_microsecond :public Item_int_func
|
||||
class Item_func_microsecond :public Item_long_func
|
||||
{
|
||||
public:
|
||||
Item_func_microsecond(THD *thd, Item *a): Item_int_func(thd, a) {}
|
||||
Item_func_microsecond(THD *thd, Item *a): Item_long_func(thd, a) {}
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "microsecond"; }
|
||||
void fix_length_and_dec()
|
||||
{
|
||||
decimals=0;
|
||||
maybe_null=1;
|
||||
fix_char_length(6);
|
||||
}
|
||||
bool check_partition_func_processor(void *int_arg) {return FALSE;}
|
||||
bool check_vcol_func_processor(void *arg) { return FALSE;}
|
||||
@ -1199,12 +1202,12 @@ public:
|
||||
};
|
||||
|
||||
|
||||
class Item_func_timestamp_diff :public Item_int_func
|
||||
class Item_func_timestamp_diff :public Item_longlong_func
|
||||
{
|
||||
const interval_type int_type;
|
||||
public:
|
||||
Item_func_timestamp_diff(THD *thd, Item *a, Item *b, interval_type type_arg):
|
||||
Item_int_func(thd, a, b), int_type(type_arg) {}
|
||||
Item_longlong_func(thd, a, b), int_type(type_arg) {}
|
||||
const char *func_name() const { return "timestampdiff"; }
|
||||
longlong val_int();
|
||||
void fix_length_and_dec()
|
||||
|
Reference in New Issue
Block a user