Commit 46716503 authored by cmiller@zippy.(none)'s avatar cmiller@zippy.(none)

Merge zippy.(none):/home/cmiller/work/mysql/merge/tmp_merge

into  zippy.(none):/home/cmiller/work/mysql/merge/mysql-5.1-new

(With hand-merged tests.)
parents b532fca0 62b85c13
This diff is collapsed.
......@@ -1141,6 +1141,40 @@ show create table t2;
drop table t2, t1;
#
# Let us test binlog_cache_use and binlog_cache_disk_use status vars.
# Actually this test has nothing to do with innodb per se, it just requires
# transactional table.
#
show status like "binlog_cache_use";
show status like "binlog_cache_disk_use";
create table t1 (a int) engine=innodb;
# Now we are going to create transaction which is long enough so its
# transaction binlog will be flushed to disk...
let $1=2000;
disable_query_log;
begin;
while ($1)
{
eval insert into t1 values( $1 );
dec $1;
}
commit;
enable_query_log;
show status like "binlog_cache_use";
show status like "binlog_cache_disk_use";
# Transaction which should not be flushed to disk and so should not
# increase binlog_cache_disk_use.
begin;
delete from t1;
commit;
show status like "binlog_cache_use";
show status like "binlog_cache_disk_use";
drop table t1;
#
# Bug #6126: Duplicate columns in keys gives misleading error message
#
......@@ -1255,6 +1289,15 @@ select * from t1 where x > -16;
select count(*) from t1 where x = 18446744073709551601;
drop table t1;
# Test for testable InnoDB status variables. This test
# uses previous ones(pages_created, rows_deleted, ...).
show status like "Innodb_buffer_pool_pages_total";
show status like "Innodb_page_size";
show status like "Innodb_rows_deleted";
show status like "Innodb_rows_inserted";
show status like "Innodb_rows_updated";
# Test for row locks InnoDB status variables.
show status like "Innodb_row_lock_waits";
show status like "Innodb_row_lock_current_waits";
......@@ -2086,55 +2129,13 @@ disconnect a;
disconnect b;
#
# Test that cascading updates leading to duplicate keys give the correct
# error message (bug #9680)
# Bug #14360: problem with intervals
#
CREATE TABLE t1 (
field1 varchar(8) NOT NULL DEFAULT '',
field2 varchar(8) NOT NULL DEFAULT '',
PRIMARY KEY (field1, field2)
) ENGINE=InnoDB;
CREATE TABLE t2 (
field1 varchar(8) NOT NULL DEFAULT '' PRIMARY KEY,
FOREIGN KEY (field1) REFERENCES t1 (field1)
ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB;
INSERT INTO t1 VALUES ('old', 'somevalu');
INSERT INTO t1 VALUES ('other', 'anyvalue');
INSERT INTO t2 VALUES ('old');
INSERT INTO t2 VALUES ('other');
--error ER_FOREIGN_DUPLICATE_KEY
UPDATE t1 SET field1 = 'other' WHERE field2 = 'somevalu';
DROP TABLE t2;
DROP TABLE t1;
#
# Bug#18477 - MySQL/InnoDB Ignoring Foreign Keys in ALTER TABLE
#
create table t1 (
c1 bigint not null,
c2 bigint not null,
primary key (c1),
unique key (c2)
) engine=innodb;
#
create table t2 (
c1 bigint not null,
primary key (c1)
) engine=innodb;
#
alter table t1 add constraint c2_fk foreign key (c2)
references t2(c1) on delete cascade;
show create table t1;
#
alter table t1 drop foreign key c2_fk;
show create table t1;
#
create table t1(a date) engine=innodb;
create table t2(a date, key(a)) engine=innodb;
insert into t1 values('2005-10-01');
insert into t2 values('2005-10-01');
select * from t1, t2
where t2.a between t1.a - interval 2 day and t1.a + interval 2 day;
drop table t1, t2;
......@@ -2002,6 +2002,41 @@ longlong Item_date_add_interval::val_int()
((date*100L + ltime.hour)*100L+ ltime.minute)*100L + ltime.second;
}
bool Item_date_add_interval::eq(const Item *item, bool binary_cmp) const
{
INTERVAL interval, other_interval;
String val= value; // Because of const
if (this == item)
return TRUE;
if ((item->type() != FUNC_ITEM) ||
(arg_count != ((Item_func*) item)->arg_count) ||
(func_name() != ((Item_func*) item)->func_name()))
return FALSE;
Item_date_add_interval *other= (Item_date_add_interval*) item;
if ((int_type != other->int_type) ||
(!args[0]->eq(other->args[0], binary_cmp)) ||
(get_interval_value(args[1], int_type, &val, &interval)))
return FALSE;
val= other->value;
if ((get_interval_value(other->args[1], other->int_type, &val,
&other_interval)) ||
((date_sub_interval ^ interval.neg) ^
(other->date_sub_interval ^ other_interval.neg)))
return FALSE;
// Assume comparing same types here due to earlier check
return memcmp(&interval, &other_interval, sizeof(INTERVAL)) == 0;
}
static const char *interval_names[]=
{
"year", "quarter", "month", "day", "hour",
......
......@@ -647,6 +647,7 @@ public:
double val_real() { DBUG_ASSERT(fixed == 1); return (double) val_int(); }
longlong val_int();
bool get_date(TIME *res, uint fuzzy_date);
bool eq(const Item *item, bool binary_cmp) const;
void print(String *str);
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment