~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/t/varbinary.test

  • Committer: Jay Pipes
  • Date: 2009-01-30 04:38:21 UTC
  • mto: This revision was merged to the branch mainline in revision 830.
  • Revision ID: jpipes@serialcoder-20090130043821-4d7jg2ftabefamxb
Fixes for the QUARTER() function to use new Temporal system and throw
errors on bad datetime values.

Added test case for QUARTER() function and modified func_time.test existing
test to correctly throw errors and report NULL, not 0 on NULL input.

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 ;
15
14
select 0x31+1,concat(0x31)+1,-0xf;
16
15
select x'31',X'ffff'+0;
17
16
 
19
18
# Test of hex constants in WHERE:
20
19
#
21
20
 
22
 
create table t1 (ID int(8) zerofill not null auto_increment,UNIQ bigint(21) zerofill not null,primary key (ID),unique (UNIQ) );
 
21
create table t1 (ID int not null auto_increment,UNIQ bigint not null,primary key (ID),unique (UNIQ) );
23
22
insert into t1 set UNIQ=0x38afba1d73e6a18a;
24
23
insert into t1 set UNIQ=123; 
25
24
explain extended select * from t1 where UNIQ=0x38afba1d73e6a18a;
46
45
# Bug #19371 VARBINARY() have trailing zeros after upgrade from 4.1
47
46
#
48
47
 
 
48
# MySQL file formats are not compatible with Drizzle
49
49
# Test with a saved table from 4.1
50
50
copy_file std_data/bug19371.frm $MYSQLTEST_VARDIR/master-data/test/t1.frm;
51
51
chmod 0777 $MYSQLTEST_VARDIR/master-data/test/t1.frm;
53
53
chmod 0777 $MYSQLTEST_VARDIR/master-data/test/t1.MYD;
54
54
copy_file std_data/bug19371.MYI $MYSQLTEST_VARDIR/master-data/test/t1.MYI;
55
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
 
 
 
56
--error 1033
 
57
show create table t1;
78
58
drop table t1;
79
59
 
80
60
# Check that the fix does not affect table created with current version