~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/t/varbinary.test

  • Committer: Lee
  • Date: 2008-12-20 04:00:36 UTC
  • mto: (754.1.1 devel) (758.1.3 devel)
  • mto: This revision was merged to the branch mainline in revision 732.
  • Revision ID: lbieber@lbieber-desktop-20081220040036-5e3m8i52ye8cd3w3
add varbinary test

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
# varbinary as string and number
12
12
#
13
13
 
14
 
select 0x41,0x41+0,0x41 | 0x7fffffffffffffff | 0,0xffffffffffffffff | 0 ;
 
14
# Drizzle Bug 309895
 
15
#select 0x41,0x41+0,0x41 | 0x7fffffffffffffff | 0,0xffffffffffffffff | 0 ;
15
16
select 0x31+1,concat(0x31)+1,-0xf;
16
17
select x'31',X'ffff'+0;
17
18
 
19
20
# Test of hex constants in WHERE:
20
21
#
21
22
 
22
 
create table t1 (ID int(8) zerofill not null auto_increment,UNIQ bigint(21) zerofill not null,primary key (ID),unique (UNIQ) );
 
23
create table t1 (ID int not null auto_increment,UNIQ bigint not null,primary key (ID),unique (UNIQ) );
23
24
insert into t1 set UNIQ=0x38afba1d73e6a18a;
24
25
insert into t1 set UNIQ=123; 
25
26
explain extended select * from t1 where UNIQ=0x38afba1d73e6a18a;
46
47
# Bug #19371 VARBINARY() have trailing zeros after upgrade from 4.1
47
48
#
48
49
 
 
50
# REMOVING THIS TEST FOR DRIZZLE SINCE FILE FORMATS ARE NOT COMPATIBLE
49
51
# 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
 
 
 
52
#copy_file std_data/bug19371.frm $MYSQLTEST_VARDIR/master-data/test/t1.frm;
 
53
#chmod 0777 $MYSQLTEST_VARDIR/master-data/test/t1.frm;
 
54
#copy_file std_data/bug19371.MYD $MYSQLTEST_VARDIR/master-data/test/t1.MYD;
 
55
#chmod 0777 $MYSQLTEST_VARDIR/master-data/test/t1.MYD;
 
56
#copy_file std_data/bug19371.MYI $MYSQLTEST_VARDIR/master-data/test/t1.MYI;
 
57
#chmod 0777 $MYSQLTEST_VARDIR/master-data/test/t1.MYI;
57
58
# Everything _looks_ fine
58
 
show create table t1;
59
 
 
 
59
#show create table t1;
60
60
# But the length of the varbinary columns are too long
61
 
select length(a), length(b) from t1;
62
 
 
 
61
#select length(a), length(b) from t1;
63
62
# Run CHECK TABLE, it should indicate table need a REPAIR TABLE
64
 
CHECK TABLE t1 FOR UPGRADE;
65
 
 
 
63
#CHECK TABLE t1 FOR UPGRADE;
66
64
# Run REPAIR TABLE to alter the table and repair
67
65
# the varbinary fields
68
 
REPAIR TABLE t1;
69
 
 
 
66
#REPAIR TABLE t1;
70
67
# 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;
 
68
#show create table t1;
 
69
#select length(a), length(b) from t1;
 
70
#insert into t1 values("ccc", "ddd");
 
71
#select length(a), length(b) from t1;
 
72
#select hex(a), hex(b) from t1;
 
73
#select concat("'", a, "'"), concat("'", b, "'") from t1;
79
74
 
80
75
# Check that the fix does not affect table created with current version
81
76
create table t1(a varbinary(255));