~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/t/varbinary.test

  • Committer: Brian Aker
  • Date: 2008-09-04 19:31:00 UTC
  • Revision ID: brian@tangent.org-20080904193100-l849hgghfy4urj43
Changing default character set from this point on.

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