~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/t/varbinary.test

Replace MAX_(DATE|TIME).*_WIDTH defines in definitions.h with real (and correct) static const members to Temporal types.

This fixes the buffer overflow in https://bugs.launchpad.net/drizzle/+bug/373468

It also removes a handwritten snprintf in field/datetime.cc
However... this caused us to have to change Temporal to have a way to not
"convert" the int64_t value (so 20090101 becomes 20090101000000 etc) as it
has already been converted and we just want the Temporal type to do the
to_string conversion.

This still causes a failure in 'metadata' test due to size of timestamp type. I need feedback from Jay on when the usecond code comes into play to know the correct fix for this.

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
-- source include/not_as_root.inc
 
3
 
 
4
 
1
5
# Initialise
2
6
--disable_warnings
3
7
drop table if exists t1;
37
41
 
38
42
# End of 4.1 tests
39
43
 
 
44
#
 
45
# Bug #19371 VARBINARY() have trailing zeros after upgrade from 4.1
 
46
#
 
47
 
 
48
# MySQL file formats are not compatible with Drizzle
 
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
--error ER_NO_SUCH_TABLE
 
57
show create table t1;
 
58
--error ER_BAD_TABLE_ERROR
 
59
drop table t1;
 
60
--remove_file $MYSQLTEST_VARDIR/master-data/test/t1.frm
 
61
--remove_file $MYSQLTEST_VARDIR/master-data/test/t1.MYD
 
62
--remove_file $MYSQLTEST_VARDIR/master-data/test/t1.MYI 
40
63
 
41
64
# Check that the fix does not affect table created with current version
42
65
create table t1(a varbinary(255));