⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 func_str.test

📁 视频监控网络部分的协议ddns,的模块的实现代码,请大家大胆指正.
💻 TEST
📖 第 1 页 / 共 3 页
字号:
#create table t1 (c varchar(40));insert into t1 values ('y,abc'),('y,abc');select c, substring_index(lcase(c), @q:=',', -1) as res from t1;drop table t1;## Bug #17043: Casting trimmed string to decimal loses precision#select cast(rtrim('  20.06 ') as decimal(19,2));select cast(ltrim('  20.06 ') as decimal(19,2));select cast(rtrim(ltrim('  20.06 ')) as decimal(19,2));## Bug #13975: "same string" + 0 has 2 different results#select conv("18383815659218730760",10,10) + 0;select "18383815659218730760" + 0;## Bug #21698: substitution of a string field for a constant under a function #CREATE TABLE t1 (code varchar(10));INSERT INTO t1 VALUES ('a12'), ('A12'), ('a13');SELECT ASCII(code), code FROM t1 WHERE code='A12';SELECT ASCII(code), code FROM t1 WHERE code='A12' AND ASCII(code)=65;INSERT INTO t1 VALUES ('a12 '), ('A12  ');SELECT LENGTH(code), code FROM t1 WHERE code='A12';SELECT LENGTH(code), code FROM t1 WHERE code='A12' AND LENGTH(code)=5;ALTER TABLE t1 ADD INDEX (code);CREATE TABLE t2 (id varchar(10) PRIMARY KEY);INSERT INTO t2 VALUES ('a11'), ('a12'), ('a13'), ('a14');SELECT * FROM t1 INNER JOIN t2 ON t1.code=t2.id   WHERE t2.id='a12' AND (LENGTH(code)=5 OR code < 'a00');EXPLAIN EXTENDED SELECT * FROM t1 INNER JOIN t2 ON code=id   WHERE id='a12' AND (LENGTH(code)=5 OR code < 'a00');DROP TABLE t1,t2;## Bug #10963# 4294967296 18446744073709551616select locate('he','hello',-2);select locate('lo','hello',-4294967295);select locate('lo','hello',4294967295);select locate('lo','hello',-4294967296);select locate('lo','hello',4294967296);select locate('lo','hello',-4294967297);select locate('lo','hello',4294967297);select locate('lo','hello',-18446744073709551615);select locate('lo','hello',18446744073709551615);select locate('lo','hello',-18446744073709551616);select locate('lo','hello',18446744073709551616);select locate('lo','hello',-18446744073709551617);select locate('lo','hello',18446744073709551617);select left('hello', 10);select left('hello', 0);select left('hello', -1);select left('hello', -4294967295);select left('hello', 4294967295);select left('hello', -4294967296);select left('hello', 4294967296);select left('hello', -4294967297);select left('hello', 4294967297);select left('hello', -18446744073709551615);select left('hello', 18446744073709551615);select left('hello', -18446744073709551616);select left('hello', 18446744073709551616);select left('hello', -18446744073709551617);select left('hello', 18446744073709551617);select right('hello', 10);select right('hello', 0);select right('hello', -1);select right('hello', -4294967295);select right('hello', 4294967295);select right('hello', -4294967296);select right('hello', 4294967296);select right('hello', -4294967297);select right('hello', 4294967297);select right('hello', -18446744073709551615);select right('hello', 18446744073709551615);select right('hello', -18446744073709551616);select right('hello', 18446744073709551616);select right('hello', -18446744073709551617);select right('hello', 18446744073709551617);select substring('hello', 2, -1);select substring('hello', -1, 1);select substring('hello', -2, 1);select substring('hello', -4294967295, 1);select substring('hello', 4294967295, 1);select substring('hello', -4294967296, 1);select substring('hello', 4294967296, 1);select substring('hello', -4294967297, 1);select substring('hello', 4294967297, 1);select substring('hello', -18446744073709551615, 1);select substring('hello', 18446744073709551615, 1);select substring('hello', -18446744073709551616, 1);select substring('hello', 18446744073709551616, 1);select substring('hello', -18446744073709551617, 1);select substring('hello', 18446744073709551617, 1);select substring('hello', 1, -1);select substring('hello', 1, -4294967295);select substring('hello', 1, 4294967295);select substring('hello', 1, -4294967296);select substring('hello', 1, 4294967296);select substring('hello', 1, -4294967297);select substring('hello', 1, 4294967297);select substring('hello', 1, -18446744073709551615);select substring('hello', 1, 18446744073709551615);select substring('hello', 1, -18446744073709551616);select substring('hello', 1, 18446744073709551616);select substring('hello', 1, -18446744073709551617);select substring('hello', 1, 18446744073709551617);select substring('hello', -1, -1);select substring('hello', -4294967295, -4294967295);select substring('hello', 4294967295, 4294967295);select substring('hello', -4294967296, -4294967296);select substring('hello', 4294967296, 4294967296);select substring('hello', -4294967297, -4294967297);select substring('hello', 4294967297, 4294967297);select substring('hello', -18446744073709551615, -18446744073709551615);select substring('hello', 18446744073709551615, 18446744073709551615);select substring('hello', -18446744073709551616, -18446744073709551616);select substring('hello', 18446744073709551616, 18446744073709551616);select substring('hello', -18446744073709551617, -18446744073709551617);select substring('hello', 18446744073709551617, 18446744073709551617);select insert('hello', -1, 1, 'hi');select insert('hello', -4294967295, 1, 'hi');select insert('hello', 4294967295, 1, 'hi');select insert('hello', -4294967296, 1, 'hi');select insert('hello', 4294967296, 1, 'hi');select insert('hello', -4294967297, 1, 'hi');select insert('hello', 4294967297, 1, 'hi');select insert('hello', -18446744073709551615, 1, 'hi');select insert('hello', 18446744073709551615, 1, 'hi');select insert('hello', -18446744073709551616, 1, 'hi');select insert('hello', 18446744073709551616, 1, 'hi');select insert('hello', -18446744073709551617, 1, 'hi');select insert('hello', 18446744073709551617, 1, 'hi');select insert('hello', 1, -1, 'hi');select insert('hello', 1, -4294967295, 'hi');select insert('hello', 1, 4294967295, 'hi');select insert('hello', 1, -4294967296, 'hi');select insert('hello', 1, 4294967296, 'hi');select insert('hello', 1, -4294967297, 'hi');select insert('hello', 1, 4294967297, 'hi');select insert('hello', 1, -18446744073709551615, 'hi');select insert('hello', 1, 18446744073709551615, 'hi');select insert('hello', 1, -18446744073709551616, 'hi');select insert('hello', 1, 18446744073709551616, 'hi');select insert('hello', 1, -18446744073709551617, 'hi');select insert('hello', 1, 18446744073709551617, 'hi');select insert('hello', -1, -1, 'hi');select insert('hello', -4294967295, -4294967295, 'hi');select insert('hello', 4294967295, 4294967295, 'hi');select insert('hello', -4294967296, -4294967296, 'hi');select insert('hello', 4294967296, 4294967296, 'hi');select insert('hello', -4294967297, -4294967297, 'hi');select insert('hello', 4294967297, 4294967297, 'hi');select insert('hello', -18446744073709551615, -18446744073709551615, 'hi');select insert('hello', 18446744073709551615, 18446744073709551615, 'hi');select insert('hello', -18446744073709551616, -18446744073709551616, 'hi');select insert('hello', 18446744073709551616, 18446744073709551616, 'hi');select insert('hello', -18446744073709551617, -18446744073709551617, 'hi');select insert('hello', 18446744073709551617, 18446744073709551617, 'hi');select repeat('hello', -1);select repeat('hello', -4294967295);select repeat('hello', 4294967295);select repeat('hello', -4294967296);select repeat('hello', 4294967296);select repeat('hello', -4294967297);select repeat('hello', 4294967297);select repeat('hello', -18446744073709551615);select repeat('hello', 18446744073709551615);select repeat('hello', -18446744073709551616);select repeat('hello', 18446744073709551616);select repeat('hello', -18446744073709551617);select repeat('hello', 18446744073709551617);select space(-1);select space(-4294967295);select space(4294967295);select space(-4294967296);select space(4294967296);select space(-4294967297);select space(4294967297);select space(-18446744073709551615);select space(18446744073709551615);select space(-18446744073709551616);select space(18446744073709551616);select space(-18446744073709551617);select space(18446744073709551617);select rpad('hello', -1, '1');select rpad('hello', -4294967295, '1');select rpad('hello', 4294967295, '1');select rpad('hello', -4294967296, '1');select rpad('hello', 4294967296, '1');select rpad('hello', -4294967297, '1');select rpad('hello', 4294967297, '1');select rpad('hello', -18446744073709551615, '1');select rpad('hello', 18446744073709551615, '1');select rpad('hello', -18446744073709551616, '1');select rpad('hello', 18446744073709551616, '1');select rpad('hello', -18446744073709551617, '1');select rpad('hello', 18446744073709551617, '1');select lpad('hello', -1, '1');select lpad('hello', -4294967295, '1');select lpad('hello', 4294967295, '1');select lpad('hello', -4294967296, '1');select lpad('hello', 4294967296, '1');select lpad('hello', -4294967297, '1');select lpad('hello', 4294967297, '1');select lpad('hello', -18446744073709551615, '1');select lpad('hello', 18446744073709551615, '1');select lpad('hello', -18446744073709551616, '1');select lpad('hello', 18446744073709551616, '1');select lpad('hello', -18446744073709551617, '1');select lpad('hello', 18446744073709551617, '1');## BUG#17047: CHAR() and IN() can return NULL without signaling NULL# result#SET @orig_sql_mode = @@SQL_MODE;SET SQL_MODE=traditional;SELECT CHAR(0xff,0x8f USING utf8);SELECT CHAR(0xff,0x8f USING utf8) IS NULL;SET SQL_MODE=@orig_sql_mode;## Bug #24947: problem with some string function with unsigned int parameters#select substring('abc', cast(2 as unsigned int));select repeat('a', cast(2 as unsigned int));select rpad('abc', cast(5 as unsigned integer), 'x');select lpad('abc', cast(5 as unsigned integer), 'x');## Bug#15757: Wrong SUBSTRING() result when a tmp table was employed.#create table t1(f1 longtext);insert into t1 values ("123"),("456");select substring(f1,1,1) from t1 group by 1;create table t2(f1 varchar(3));insert into t1 values ("123"),("456");select substring(f1,4,1), substring(f1,-4,1) from t2;drop table t1,t2;## Bug #25197 :repeat function returns null when using table field directly as count#--disable_warningsDROP TABLE IF EXISTS t1;--enable_warningsCREATE TABLE `t1` (  `id` varchar(20) NOT NULL,  `tire` tinyint(3) unsigned NOT NULL,  PRIMARY KEY (`id`));INSERT INTO `t1` (`id`, `tire`) VALUES ('A', 0), ('B', 1),('C', 2);SELECT REPEAT( '#', tire ) AS A,       REPEAT( '#', tire % 999 ) AS B, tire FROM `t1`;SELECT REPEAT('0', CAST(0 AS UNSIGNED));SELECT REPEAT('0', -2);SELECT REPEAT('0', 2);DROP TABLE t1;## Bug #26537: UNHEX() IS NULL comparison fails#SELECT UNHEX('G');SELECT UNHEX('G') IS NULL;## Bug #26281: INSERT() function mishandles NUL on boundary condition#SELECT INSERT('abc', 3, 3, '1234');SELECT INSERT('abc', 4, 3, '1234');SELECT INSERT('abc', 5, 3, '1234');SELECT INSERT('abc', 6, 3, '1234');## Bug #27530: Grouping on crc32, or create table select crc32#CREATE TABLE t1 (a INT);CREATE VIEW v1 AS SELECT CRC32(a) AS C FROM t1;INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);SELECT CRC32(a), COUNT(*) FROM t1 GROUP BY 1;SELECT CRC32(a), COUNT(*) FROM t1 GROUP BY 1 ORDER BY 1;SELECT * FROM (SELECT CRC32(a) FROM t1) t2;CREATE TABLE t2 SELECT CRC32(a) FROM t1;desc t2;SELECT * FROM v1;SELECT * FROM (SELECT * FROM v1) x;DROP TABLE t1, t2;DROP VIEW v1;## Bug #27932: LOCATE with argument evaluated to NULL#SELECT LOCATE('foo', NULL) FROM DUAL;SELECT LOCATE(NULL, 'o') FROM DUAL;SELECT LOCATE(NULL, NULL) FROM DUAL;SELECT LOCATE('foo', NULL) IS NULL FROM DUAL;SELECT LOCATE(NULL, 'o') IS NULL FROM DUAL;SELECT LOCATE(NULL, NULL) IS NULL FROM DUAL;SELECT ISNULL(LOCATE('foo', NULL)) FROM DUAL;SELECT ISNULL(LOCATE(NULL, 'o')) FROM DUAL;SELECT ISNULL(LOCATE(NULL, NULL)) FROM DUAL;SELECT LOCATE('foo', NULL) <=> NULL FROM DUAL;SELECT LOCATE(NULL, 'o') <=> NULL FROM DUAL;SELECT LOCATE(NULL, NULL) <=> NULL FROM DUAL;CREATE TABLE t1 (id int NOT NULL PRIMARY KEY, a varchar(10), p varchar(10));INSERT INTO t1 VALUES (1, 'foo', 'o');INSERT INTO t1 VALUES (2, 'foo', NULL);INSERT INTO t1 VALUES (3, NULL, 'o');INSERT INTO t1 VALUES (4, NULL, NULL);SELECT id, LOCATE(a,p) FROM t1;SELECT id, LOCATE(a,p) IS NULL FROM t1;SELECT id, ISNULL(LOCATE(a,p)) FROM t1;SELECT id, LOCATE(a,p) <=> NULL FROM t1;SELECT id FROM t1 WHERE LOCATE(a,p) IS NULL;SELECT id FROM t1 WHERE LOCATE(a,p) <=> NULL; DROP TABLE t1;## Bug #27130: SUBSTR with UNSIGNED 0 as the last argument#SELECT SUBSTR('foo',1,0) FROM DUAL;SELECT SUBSTR('foo',1,CAST(0 AS SIGNED)) FROM DUAL;SELECT SUBSTR('foo',1,CAST(0 AS UNSIGNED)) FROM DUAL;CREATE TABLE t1 (a varchar(10), len int unsigned);INSERT INTO t1 VALUES ('bar', 2), ('foo', 0);SELECT SUBSTR(a,1,len) FROM t1;DROP TABLE t1; --echo End of 5.0 tests

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -