~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/t/varbinary.test

  • Committer: Monty Taylor
  • Date: 2010-12-24 02:13:05 UTC
  • mto: This revision was merged to the branch mainline in revision 2038.
  • Revision ID: mordred@inaugust.com-20101224021305-e3slv1cyjczqorij
Changed the bzrignore file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# This test uses chmod, can't be run with root permissions
2
 
 
3
 
 
4
1
# Initialise
5
2
--disable_warnings
6
3
drop table if exists t1;
11
7
# varbinary as string and number
12
8
#
13
9
 
14
 
select 0x41,0x41+0,0x41 | 0x7fffffffffffffff | 0,0xffffffffffffffff | 0 ;
15
10
select 0x31+1,concat(0x31)+1,-0xf;
16
11
select x'31',X'ffff'+0;
17
12
 
19
14
# Test of hex constants in WHERE:
20
15
#
21
16
 
22
 
create table t1 (ID int(8) zerofill not null auto_increment,UNIQ bigint(21) zerofill not null,primary key (ID),unique (UNIQ) );
 
17
create table t1 (ID int not null auto_increment,UNIQ bigint not null,primary key (ID),unique (UNIQ) );
23
18
insert into t1 set UNIQ=0x38afba1d73e6a18a;
24
19
insert into t1 set UNIQ=123; 
25
20
explain extended select * from t1 where UNIQ=0x38afba1d73e6a18a;
28
23
#
29
24
# Test error conditions
30
25
#
31
 
--error 1064
 
26
--error ER_PARSE_ERROR
32
27
select x'hello';
33
 
--error 1054
 
28
--error ER_BAD_FIELD_ERROR
34
29
select 0xfg;
35
30
 
36
31
#
42
37
 
43
38
# End of 4.1 tests
44
39
 
45
 
#
46
 
# Bug #19371 VARBINARY() have trailing zeros after upgrade from 4.1
47
 
#
48
 
 
49
 
# Test with a saved table from 4.1
50
 
copy_file std_data/bug19371.frm $MYSQLTEST_VARDIR/master-data/test/t1.frm;
51
 
chmod 0777 $MYSQLTEST_VARDIR/master-data/test/t1.frm;
52
 
copy_file std_data/bug19371.MYD $MYSQLTEST_VARDIR/master-data/test/t1.MYD;
53
 
chmod 0777 $MYSQLTEST_VARDIR/master-data/test/t1.MYD;
54
 
copy_file std_data/bug19371.MYI $MYSQLTEST_VARDIR/master-data/test/t1.MYI;
55
 
chmod 0777 $MYSQLTEST_VARDIR/master-data/test/t1.MYI;
56
 
 
57
 
# Everything _looks_ fine
58
 
show create table t1;
59
 
 
60
 
# But the length of the varbinary columns are too long
61
 
select length(a), length(b) from t1;
62
 
 
63
 
# Run CHECK TABLE, it should indicate table need a REPAIR TABLE
64
 
CHECK TABLE t1 FOR UPGRADE;
65
 
 
66
 
# Run REPAIR TABLE to alter the table and repair
67
 
# the varbinary fields
68
 
REPAIR TABLE t1;
69
 
 
70
 
# Now check it's back to normal
71
 
show create table t1;
72
 
select length(a), length(b) from t1;
73
 
insert into t1 values("ccc", "ddd");
74
 
select length(a), length(b) from t1;
75
 
select hex(a), hex(b) from t1;
76
 
select concat("'", a, "'"), concat("'", b, "'") from t1;
77
 
 
78
 
drop table t1;
79
40
 
80
41
# Check that the fix does not affect table created with current version
81
42
create table t1(a varbinary(255));
96
57
--enable_warnings
97
58
 
98
59
create table table_28127_a(0b02 int);
 
60
--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
99
61
show create table table_28127_a;
100
62
 
101
63
create table table_28127_b(0b2 int);
 
64
--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
102
65
show create table table_28127_b;
103
66
 
104
67
drop table table_28127_a;