1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
drop table if exists t1;
select hex(weight_string(0x010203));
hex(weight_string(0x010203))
010203
select hex(weight_string('aa' as char(3)));
hex(weight_string('aa' as char(3)))
004100410020
select hex(weight_string('a' as char(-1)));
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your Drizzle server version for the right syntax to use near '-1)))' at line 1
select hex(weight_string('a' as char(0)));
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your Drizzle server version for the right syntax to use near '0)))' at line 1
select hex(weight_string('a' as char(1)));
hex(weight_string('a' as char(1)))
0041
select hex(weight_string('ab' as char(1)));
hex(weight_string('ab' as char(1)))
0041
select hex(weight_string('ab'));
hex(weight_string('ab'))
00410042
select hex(weight_string('aa' as binary(3)));
hex(weight_string('aa' as binary(3)))
616100
select hex(weight_string(cast('aa' as binary(3))));
hex(weight_string(cast('aa' as binary(3))))
616100
select hex(weight_string('ab' level 1-1 ASC));
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your Drizzle server version for the right syntax to use near 'ASC))' at line 1
select hex(weight_string('ab' level 1-1 DESC));
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your Drizzle server version for the right syntax to use near 'DESC))' at line 1
select hex(weight_string('ab' level 1-1 REVERSE));
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your Drizzle server version for the right syntax to use near 'REVERSE))' at line 1
select hex(weight_string('ab' level 1 ASC));
hex(weight_string('ab' level 1 ASC))
00410042
select hex(weight_string('ab' level 1 DESC));
hex(weight_string('ab' level 1 DESC))
FFBEFFBD
select hex(weight_string('ab' level 1 REVERSE));
hex(weight_string('ab' level 1 REVERSE))
42004100
select hex(weight_string('ab' level 1 DESC REVERSE));
hex(weight_string('ab' level 1 DESC REVERSE))
BDFFBEFF
create table t1 select weight_string('test') as w;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`w` varbinary(64) DEFAULT NULL
) ENGINE=DEFAULT
drop table t1;
create table t1 select weight_string(repeat('t',66000)) as w;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`w` blob
) ENGINE=DEFAULT
drop table t1;
select weight_string(NULL);
weight_string(NULL)
NULL
select 1 as weight_string, 2 as reverse;
weight_string reverse
1 2
select coercibility(weight_string('test'));
coercibility(weight_string('test'))
4
create table t1 (s1 varchar(5));
insert into t1 values ('a'),(null);
select hex(weight_string(s1)) from t1 order by s1;
hex(weight_string(s1))
NULL
0041
drop table t1;
|