~stewart/drizzle/embedded-innodb-create-select-transaction-arrgh

« back to all changes in this revision

Viewing changes to mysql-test/r/func_misc.result

  • Committer: brian
  • Date: 2008-06-25 05:29:13 UTC
  • Revision ID: brian@localhost.localdomain-20080625052913-6upwo0jsrl4lnapl
clean slate

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
DROP TABLE IF EXISTS t1, t2;
 
2
select format(1.5555,0),format(123.5555,1),format(1234.5555,2),format(12345.55555,3),format(123456.5555,4),format(1234567.5555,5),format("12345.2399",2);
 
3
format(1.5555,0)        format(123.5555,1)      format(1234.5555,2)     format(12345.55555,3)   format(123456.5555,4)   format(1234567.5555,5)  format("12345.2399",2)
 
4
2       123.6   1,234.56        12,345.556      123,456.5555    1,234,567.55550 12,345.24
 
5
select inet_ntoa(inet_aton("255.255.255.255.255.255.255.255"));
 
6
inet_ntoa(inet_aton("255.255.255.255.255.255.255.255"))
 
7
NULL
 
8
select inet_aton("255.255.255.255.255"),inet_aton("255.255.1.255"),inet_aton("0.1.255");
 
9
inet_aton("255.255.255.255.255")        inet_aton("255.255.1.255")      inet_aton("0.1.255")
 
10
1099511627775   4294902271      65791
 
11
select inet_ntoa(1099511627775),inet_ntoa(4294902271),inet_ntoa(511);
 
12
inet_ntoa(1099511627775)        inet_ntoa(4294902271)   inet_ntoa(511)
 
13
NULL    255.255.1.255   0.0.1.255
 
14
select hex(inet_aton('127'));
 
15
hex(inet_aton('127'))
 
16
7F
 
17
select hex(inet_aton('127.1'));
 
18
hex(inet_aton('127.1'))
 
19
7F000001
 
20
select hex(inet_aton('127.1.1'));
 
21
hex(inet_aton('127.1.1'))
 
22
7F010001
 
23
select length(uuid()), charset(uuid()), length(unhex(replace(uuid(),_utf8'-',_utf8'')));
 
24
length(uuid())  charset(uuid()) length(unhex(replace(uuid(),_utf8'-',_utf8'')))
 
25
36      utf8    16
 
26
set @a= uuid_short();
 
27
set @b= uuid_short();
 
28
select cast(@a - @b as signed);
 
29
cast(@a - @b as signed)
 
30
-1
 
31
select length(format('nan', 2)) > 0;
 
32
length(format('nan', 2)) > 0
 
33
1
 
34
Warnings:
 
35
Warning 1292    Truncated incorrect DOUBLE value: 'nan'
 
36
select concat("$",format(2500,2));
 
37
concat("$",format(2500,2))
 
38
$2,500.00
 
39
create table t1 ( a timestamp );
 
40
insert into t1 values ( '2004-01-06 12:34' );
 
41
select a from t1 where left(a+0,6) in ( left(20040106,6) );
 
42
a
 
43
2004-01-06 12:34:00
 
44
select a from t1 where left(a+0,6) = ( left(20040106,6) );
 
45
a
 
46
2004-01-06 12:34:00
 
47
select a from t1 where right(a+0,6) in ( right(20040106123400,6) );
 
48
a
 
49
2004-01-06 12:34:00
 
50
select a from t1 where right(a+0,6) = ( right(20040106123400,6) );
 
51
a
 
52
2004-01-06 12:34:00
 
53
select a from t1 where mid(a+0,6,3) in ( mid(20040106123400,6,3) );
 
54
a
 
55
2004-01-06 12:34:00
 
56
select a from t1 where mid(a+0,6,3) = ( mid(20040106123400,6,3) );
 
57
a
 
58
2004-01-06 12:34:00
 
59
drop table t1;
 
60
CREATE TABLE t1 (conn CHAR(7), connection_id INT);
 
61
INSERT INTO t1 VALUES ('default', CONNECTION_ID());
 
62
SELECT GET_LOCK('bug16501',600);
 
63
GET_LOCK('bug16501',600)
 
64
1
 
65
INSERT INTO t1 VALUES ('con1', CONNECTION_ID());
 
66
SELECT IS_USED_LOCK('bug16501') = connection_id
 
67
FROM t1
 
68
WHERE conn = 'default';
 
69
IS_USED_LOCK('bug16501') = connection_id
 
70
1
 
71
SELECT GET_LOCK('bug16501',600);
 
72
SELECT IS_USED_LOCK('bug16501') = CONNECTION_ID();
 
73
IS_USED_LOCK('bug16501') = CONNECTION_ID()
 
74
1
 
75
SELECT RELEASE_LOCK('bug16501');
 
76
RELEASE_LOCK('bug16501')
 
77
1
 
78
GET_LOCK('bug16501',600)
 
79
1
 
80
SELECT IS_USED_LOCK('bug16501') = connection_id
 
81
FROM t1
 
82
WHERE conn = 'con1';
 
83
IS_USED_LOCK('bug16501') = connection_id
 
84
1
 
85
SELECT IS_USED_LOCK('bug16501') = CONNECTION_ID();
 
86
IS_USED_LOCK('bug16501') = CONNECTION_ID()
 
87
1
 
88
SELECT RELEASE_LOCK('bug16501');
 
89
RELEASE_LOCK('bug16501')
 
90
1
 
91
SELECT IS_USED_LOCK('bug16501');
 
92
IS_USED_LOCK('bug16501')
 
93
NULL
 
94
DROP TABLE t1;
 
95
select export_set(3, _latin1'foo', _utf8'bar', ',', 4);
 
96
export_set(3, _latin1'foo', _utf8'bar', ',', 4)
 
97
foo,foo,bar,bar
 
98
End of 4.1 tests
 
99
create table t1 as select uuid(), length(uuid());
 
100
show create table t1;
 
101
Table   Create Table
 
102
t1      CREATE TABLE `t1` (
 
103
  `uuid()` varchar(36) CHARACTER SET utf8 NOT NULL DEFAULT '',
 
104
  `length(uuid())` int(10) NOT NULL DEFAULT '0'
 
105
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
106
drop table t1;
 
107
create table t1 (a timestamp default '2005-05-05 01:01:01',
 
108
b timestamp default '2005-05-05 01:01:01');
 
109
insert into t1 set a = now();
 
110
select sleep(3);
 
111
sleep(3)
 
112
0
 
113
update t1 set b = now();
 
114
select timediff(b, a) >= '00:00:03' from t1;
 
115
timediff(b, a) >= '00:00:03'
 
116
1
 
117
drop table t1;
 
118
set global query_cache_size=1355776;
 
119
create table t1 (a int);
 
120
insert into t1 values (1),(1),(1);
 
121
create table t2 (a datetime default null, b datetime default null);
 
122
insert into t2 set a = now();
 
123
select a from t1 where sleep(1);
 
124
a
 
125
update t2 set b = now() where b is null;
 
126
insert into t2 set a = now();
 
127
select a from t1 where sleep(a);
 
128
a
 
129
update t2 set b = now() where b is null;
 
130
insert into t2 set a = now();
 
131
select a from t1 where sleep(1);
 
132
a
 
133
update t2 set b = now() where b is null;
 
134
select timediff(b, a) >= '00:00:03' from t2;
 
135
timediff(b, a) >= '00:00:03'
 
136
1
 
137
1
 
138
1
 
139
drop table t2;
 
140
drop table t1;
 
141
set global query_cache_size=default;
 
142
create table t1 select INET_ATON('255.255.0.1') as `a`;
 
143
show create table t1;
 
144
Table   Create Table
 
145
t1      CREATE TABLE `t1` (
 
146
  `a` bigint(21) unsigned DEFAULT NULL
 
147
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 
148
drop table t1;
 
149
drop table if exists table_26093;
 
150
drop function if exists func_26093_a;
 
151
drop function if exists func_26093_b;
 
152
create table table_26093(a int);
 
153
insert into table_26093 values
 
154
(1), (2), (3), (4), (5),
 
155
(6), (7), (8), (9), (10);
 
156
create function func_26093_a(x int) returns int
 
157
begin
 
158
set @invoked := @invoked + 1;
 
159
return x;
 
160
end//
 
161
create function func_26093_b(x int, y int) returns int
 
162
begin
 
163
set @invoked := @invoked + 1;
 
164
return x;
 
165
end//
 
166
select avg(a) from table_26093;
 
167
avg(a)
 
168
5.5000
 
169
select benchmark(100, (select avg(a) from table_26093));
 
170
benchmark(100, (select avg(a) from table_26093))
 
171
0
 
172
set @invoked := 0;
 
173
select benchmark(100, (select avg(func_26093_a(a)) from table_26093));
 
174
benchmark(100, (select avg(func_26093_a(a)) from table_26093))
 
175
0
 
176
select @invoked;
 
177
@invoked
 
178
10
 
179
set @invoked := 0;
 
180
select benchmark(100, (select avg(func_26093_b(a, rand())) from table_26093));
 
181
benchmark(100, (select avg(func_26093_b(a, rand())) from table_26093))
 
182
0
 
183
select @invoked;
 
184
@invoked
 
185
1000
 
186
select benchmark(100, (select (a) from table_26093));
 
187
ERROR 21000: Subquery returns more than 1 row
 
188
select benchmark(100, (select 1, 1));
 
189
ERROR 21000: Operand should contain 1 column(s)
 
190
drop table table_26093;
 
191
drop function func_26093_a;
 
192
drop function func_26093_b;
 
193
SELECT NAME_CONST('test', NOW());
 
194
ERROR HY000: Incorrect arguments to NAME_CONST
 
195
SELECT NAME_CONST('test', UPPER('test'));
 
196
ERROR HY000: Incorrect arguments to NAME_CONST
 
197
SELECT NAME_CONST('test', NULL);
 
198
test
 
199
NULL
 
200
SELECT NAME_CONST('test', 1);
 
201
test
 
202
1
 
203
SELECT NAME_CONST('test', -1);
 
204
test
 
205
-1
 
206
SELECT NAME_CONST('test', 1.0);
 
207
test
 
208
1.0
 
209
SELECT NAME_CONST('test', -1.0);
 
210
test
 
211
-1.0
 
212
SELECT NAME_CONST('test', 'test');
 
213
test
 
214
test
 
215
CREATE TABLE t1 (a INT);
 
216
INSERT INTO t1 VALUES (1),(2),(3);
 
217
SELECT NAME_CONST('flag',1)    * MAX(a) FROM t1;
 
218
NAME_CONST('flag',1)    * MAX(a)
 
219
3
 
220
SELECT NAME_CONST('flag',1.5)  * MAX(a) FROM t1;
 
221
NAME_CONST('flag',1.5)  * MAX(a)
 
222
4.5
 
223
SELECT NAME_CONST('flag',-1)   * MAX(a) FROM t1;
 
224
NAME_CONST('flag',-1)   * MAX(a)
 
225
-3
 
226
SELECT NAME_CONST('flag',-1.5) * MAX(a) FROM t1;
 
227
NAME_CONST('flag',-1.5) * MAX(a)
 
228
-4.5
 
229
SELECT NAME_CONST('flag', SQRT(4)) * MAX(a) FROM t1;
 
230
ERROR HY000: Incorrect arguments to NAME_CONST
 
231
SELECT NAME_CONST('flag',-SQRT(4)) * MAX(a) FROM t1;
 
232
ERROR HY000: Incorrect arguments to NAME_CONST
 
233
DROP TABLE t1;
 
234
CREATE TABLE t1 (a int);
 
235
INSERT INTO t1 VALUES (5), (2);
 
236
SELECT NAME_CONST(x,2) FROM (SELECT a x FROM t1) t;
 
237
ERROR HY000: Incorrect arguments to NAME_CONST
 
238
DROP TABLE t1;
 
239
CREATE TABLE t1(a INT);
 
240
INSERT INTO t1 VALUES (), (), ();
 
241
SELECT NAME_CONST(a, '1') FROM t1;
 
242
ERROR HY000: Incorrect arguments to NAME_CONST
 
243
SET INSERT_ID= NAME_CONST(a, a);
 
244
ERROR HY000: Incorrect arguments to NAME_CONST
 
245
DROP TABLE t1;
 
246
create table t1 (a int not null);
 
247
insert into t1 values (-1), (-2);
 
248
select min(a) from t1 group by inet_ntoa(a);
 
249
min(a)
 
250
-2
 
251
drop table t1;
 
252
SELECT NAME_CONST('var', 'value') COLLATE latin1_general_cs;
 
253
NAME_CONST('var', 'value') COLLATE latin1_general_cs
 
254
value
 
255
End of 5.0 tests
 
256
select connection_id() > 0;
 
257
connection_id() > 0
 
258
1
 
259
End of tests