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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
|
drop table if exists t1;
set sql_mode="";
flush status;
show status like "feature%";
Variable_name Value
Feature_application_time_periods 0
Feature_check_constraint 0
Feature_custom_aggregate_functions 0
Feature_delay_key_write 0
Feature_dynamic_columns 0
Feature_fulltext 0
Feature_gis 0
Feature_invisible_columns 0
Feature_json 0
Feature_locale 0
Feature_subquery 0
Feature_system_versioning 0
Feature_timezone 0
Feature_trigger 0
Feature_window_functions 0
Feature_xml 0
#
# Feature GIS
#
CREATE TABLE t1 (g POINT);
SHOW FIELDS FROM t1;
Field Type Null Key Default Extra
g point YES NULL
INSERT INTO t1 VALUES
(PointFromText('POINT(10 10)')),
(PointFromText('POINT(20 10)')),
(PointFromText('POINT(20 20)')),
(PointFromWKB(AsWKB(PointFromText('POINT(10 20)'))));
drop table t1;
show status like "feature_gis";
Variable_name Value
Feature_gis 3
#
# Feature dynamic columns
#
set @a= COLUMN_CREATE(1, 1212 AS int);
set @b= column_add(@a, 2, 1212 as integer);
select column_get(@b, 2 as integer);
column_get(@b, 2 as integer)
1212
show status like "feature_dynamic_columns";
Variable_name Value
Feature_dynamic_columns 2
#
# Feature fulltext
#
CREATE TABLE t1 (a VARCHAR(200), b TEXT, FULLTEXT (a,b)) engine=myisam;
INSERT INTO t1 VALUES('MySQL has now support', 'for full-text search'),
('Full-text indexes', 'are called collections'),
('Only MyISAM tables','support collections'),
('Function MATCH ... AGAINST()','is used to do a search'),
('Full-text search in MySQL', 'implements vector space model');
select * from t1 where MATCH(a,b) AGAINST ("collections");
a b
Only MyISAM tables support collections
Full-text indexes are called collections
select * from t1 where MATCH(a,b) AGAINST ("indexes");
a b
Full-text indexes are called collections
drop table t1;
show status like "feature_fulltext";
Variable_name Value
Feature_fulltext 2
#
# Feature locale
#
SET lc_messages=sr_RS;
SET lc_messages=en_US;
show status like "feature_locale";
Variable_name Value
Feature_locale 2
#
# Feature subquery
#
select (select 2);
(select 2)
2
SELECT (SELECT 1) UNION SELECT (SELECT 2);
(SELECT 1)
1
2
create table t1 (a int);
insert into t1 values (2);
select (select a from t1 where t1.a=t2.a), a from t1 as t2;
(select a from t1 where t1.a=t2.a) a
2 2
drop table t1;
show status like "feature_subquery";
Variable_name Value
Feature_subquery 4
#
# Feature timezone
#
SELECT FROM_UNIXTIME(unix_timestamp()) > "1970-01-01";
FROM_UNIXTIME(unix_timestamp()) > "1970-01-01"
1
set time_zone="+03:00";
SELECT FROM_UNIXTIME(unix_timestamp()) > "1970-01-01";
FROM_UNIXTIME(unix_timestamp()) > "1970-01-01"
1
set time_zone= @@global.time_zone;
show status like "feature_timezone";
Variable_name Value
Feature_timezone 1
#
# Feature triggers
#
create table t1 (i int);
# let us test some very simple trigger
create trigger trg before insert on t1 for each row set @a:=1;
set @a:=0;
select @a;
@a
0
insert into t1 values (1),(2);
select @a;
@a
1
SHOW TRIGGERS IN test like 't1';
Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation
trg INSERT t1 set @a:=1 BEFORE # root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
drop trigger trg;
drop table t1;
show status like "%trigger%";
Variable_name Value
Binlog_group_commit_trigger_count 0
Binlog_group_commit_trigger_lock_wait 0
Binlog_group_commit_trigger_timeout 0
Com_create_trigger 1
Com_drop_trigger 1
Com_show_create_trigger 0
Com_show_triggers 1
Executed_triggers 2
Feature_trigger 2
#
# Feature xml
#
SET @xml='<a aa1="aa1" aa2="aa2">a1<b ba1="ba1">b1<c>c1</c>b2</b>a2</a>';
SELECT extractValue(@xml,'/a');
extractValue(@xml,'/a')
a1 a2
select updatexml('<div><div><span>1</span><span>2</span></div></div>',
'/','<tr><td>1</td><td>2</td></tr>') as upd1;
upd1
<tr><td>1</td><td>2</td></tr>
show status like "feature_xml";
Variable_name Value
Feature_xml 2
#
# Feature delayed_keys
#
create table t1 (a int, key(a)) engine=myisam delay_key_write=1;
insert into t1 values(1);
insert into t1 values(2);
drop table t1;
create table t1 (a int, key(a)) engine=aria delay_key_write=1;
insert into t1 values(1);
insert into t1 values(2);
drop table t1;
show status like "feature_delay_key_write";
Variable_name Value
Feature_delay_key_write 2
create table t1 (a int check (a > 5));
create table t2 (b int, constraint foo check (b < 10));
drop table t1, t2;
show status like "feature_check_constraint";
Variable_name Value
Feature_check_constraint 2
|