1086.10.2
by Devananda
added test case |
1 |
CREATE TABLE t1 (a int auto_increment primary key, v varchar(255)); |
2 |
INSERT INTO t1 (v) VALUES |
|
3 |
(NULL), |
|
4 |
(''), |
|
5 |
(0), |
|
6 |
('abc'), |
|
7 |
('你好'), |
|
8 |
('☃'); |
|
9 |
||
10 |
#
|
|
11 |
# Verify LENGTH, OCTET_LENGTH
|
|
12 |
#
|
|
13 |
SELECT LENGTH(NULL), OCTET_LENGTH(NULL); |
|
14 |
SELECT LENGTH(''), OCTET_LENGTH(''); |
|
15 |
SELECT LENGTH('0'), OCTET_LENGTH('0'); |
|
16 |
SELECT LENGTH('abc'), OCTET_LENGTH('abc'); |
|
17 |
SELECT LENGTH('你好'), OCTET_LENGTH('你好'); |
|
18 |
SELECT LENGTH('☃'), OCTET_LENGTH('☃'); |
|
19 |
SELECT a, v, LENGTH(v), OCTET_LENGTH(v) FROM t1; |
|
20 |
||
21 |
#
|
|
22 |
# Verify CHAR_LENGTH, CHARACTER_LENGTH
|
|
23 |
#
|
|
24 |
SELECT CHAR_LENGTH(NULL), CHARACTER_LENGTH(NULL); |
|
25 |
SELECT CHAR_LENGTH(''), CHARACTER_LENGTH(''); |
|
26 |
SELECT CHAR_LENGTH('0'), CHARACTER_LENGTH('0'); |
|
27 |
SELECT CHAR_LENGTH('abc'), CHARACTER_LENGTH('abc'); |
|
28 |
SELECT CHAR_LENGTH('你好'), CHARACTER_LENGTH('你好'); |
|
29 |
SELECT CHAR_LENGTH('☃'), CHARACTER_LENGTH('☃'); |
|
30 |
SELECT A, V, CHAR_LENGTH(V), CHARACTER_LENGTH(v) from t1; |
|
31 |
||
32 |
DROP TABLE IF EXISTS t1; |