~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/include/varchar.inc

  • Committer: Jay Pipes
  • Date: 2008-12-18 15:55:03 UTC
  • mto: This revision was merged to the branch mainline in revision 717.
  • Revision ID: jpipes@serialcoder-20081218155503-u45ygyunrdyyvquq
Fix for Bug#308457.  Gave UTF8 enclosure and escape character on LOAD DATA INFILE and changed the error message to be more descriptive

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
# Simple basic test that endspace is saved
12
12
#
13
13
 
14
 
eval create $temp table t1 (v varchar(10), c char(10), t text);
 
14
create table t1 (v varchar(10), c char(10), t text);
15
15
insert into t1 values('+ ', '+ ', '+ ');
16
16
set @a=repeat(' ',20);
17
 
--error ER_DATA_TOO_LONG
18
 
insert into t1 values (concat('+',@a),concat('+',@a),concat('+',@a));
19
 
set @a=repeat(' ',10);
20
 
--error ER_DATA_TOO_LONG
21
 
insert into t1 values (concat('+',@a),concat('+',@a),concat('+',@a));
22
 
set @a=repeat(' ',9);
23
17
insert into t1 values (concat('+',@a),concat('+',@a),concat('+',@a));
24
18
select concat('*',v,'*',c,'*',t,'*') from t1;
25
19
 
26
20
# Check how columns are copied
27
21
show create table t1;
28
 
eval create $temp table t2 like t1;
 
22
create table t2 like t1;
29
23
show create table t2;
30
 
eval create $temp table t3 select * from t1;
 
24
create table t3 select * from t1;
31
25
show create table t3;
32
26
alter table t1 modify c varchar(10);
33
27
show create table t1;
41
35
#
42
36
# Testing of keys
43
37
#
44
 
eval create $temp table t1 (v varchar(10), c char(10), t text, key(v), key(c), key(t(10)));
 
38
create table t1 (v varchar(10), c char(10), t text, key(v), key(c), key(t(10)));
45
39
show create table t1;
46
40
disable_query_log;
47
 
begin;
48
41
let $1=10;
49
42
while ($1)
50
43
{
58
51
  }
59
52
  dec $1;
60
53
}
61
 
commit;
62
54
enable_query_log;
63
55
select count(*) from t1;
64
56
insert into t1 values(concat('a',char(1)),concat('a',char(1)),concat('a',char(1)));
185
177
# Test unique keys
186
178
#
187
179
 
188
 
eval create $temp table t1 (a char(10), unique (a));
 
180
create table t1 (a char(10), unique (a));
189
181
insert into t1 values ('a   ');
190
182
--error ER_DUP_ENTRY
191
183
insert into t1 values ('a ');
195
187
insert into t1 values ('a '),('a  '),('a   '),('a         ');
196
188
--error ER_DUP_ENTRY
197
189
insert into t1 values ('a     ');
198
 
--error ER_DATA_TOO_LONG
 
190
--error ER_DUP_ENTRY
199
191
insert into t1 values ('a          ');
200
192
--error ER_DUP_ENTRY
201
193
insert into t1 values ('a ');
213
205
# test show create table
214
206
#
215
207
 
216
 
eval create $temp table t1 (v varchar(10), c char(10), t text, key(v(5)), key(c(5)), key(t(5)));
 
208
create table t1 (v varchar(10), c char(10), t text, key(v(5)), key(c(5)), key(t(5)));
217
209
show create table t1;
218
210
drop table t1;
219
 
eval create $temp table t1 (v char(10));
 
211
create table t1 (v char(10));
220
212
show create table t1;
221
213
drop table t1;
222
214
 
223
 
eval create $temp table t1 (v varchar(10), c char(10));
 
215
create table t1 (v varchar(10), c char(10)) row_format=fixed;
224
216
show create table t1;
225
217
insert into t1 values('a','a'),('a ','a ');
226
218
select concat('*',v,'*',c,'*') from t1;
232
224
# @TODO The below fails because it assumes latin1
233
225
# as the charset.  Possibly re-enable a similar test
234
226
# for UTF8-only in future
235
 
#create $temp table t1 (v varchar(65530), key(v(10)));
 
227
#create table t1 (v varchar(65530), key(v(10)));
236
228
#insert into t1 values(repeat('a',65530));
237
229
#select length(v) from t1 where v=repeat('a',65530);
238
230
#drop table t1;
242
234
# Bug #10802: Index is not used if table using BDB engine on HP-UX
243
235
#
244
236
 
245
 
eval create $temp table t1(a int, b varchar(12), key ba(b, a));
 
237
create table t1(a int, b varchar(12), key ba(b, a));
246
238
insert into t1 values (1, 'A'), (20, NULL);
247
239
explain select * from t1 where a=20 and b is null;
248
240
select * from t1 where a=20 and b is null;