Commit 93e597c1 authored by unknown's avatar unknown
Browse files

Merge moonbone.local:/work/15028-bug-5.0-mysql

into moonbone.local:/work/15028-bug-5.1-new-mysql


configure.in:
  Auto merged
mysql-test/r/query_cache.result:
  Auto merged
mysql-test/t/query_cache.test:
  Auto merged
sql/sql_cache.cc:
  Auto merged
sql/sql_update.cc:
  Auto merged
storage/ndb/src/kernel/blocks/backup/Backup.cpp:
  Auto merged
storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp:
  Auto merged
parents 176f36fa 04ea656d
Loading
Loading
Loading
Loading
+25 −0
Original line number Diff line number Diff line
@@ -1024,6 +1024,31 @@ Variable_name Value
Qcache_hits	1
drop table t1;
create table t1 (a int);
flush status;
(select a from t1) union (select a from t1);
a
show status like "Qcache_queries_in_cache";
Variable_name	Value
Qcache_queries_in_cache	1
show status like "Qcache_inserts";
Variable_name	Value
Qcache_inserts	1
show status like "Qcache_hits";
Variable_name	Value
Qcache_hits	0
(select a from t1) union (select a from t1);
a
show status like "Qcache_queries_in_cache";
Variable_name	Value
Qcache_queries_in_cache	1
show status like "Qcache_inserts";
Variable_name	Value
Qcache_inserts	1
show status like "Qcache_hits";
Variable_name	Value
Qcache_hits	1
drop table t1;
create table t1 (a int);
insert into t1 values (1),(2);
CREATE PROCEDURE `p1`()
begin
+13 −0
Original line number Diff line number Diff line
@@ -345,3 +345,16 @@ f1
2000-01-01
2002-02-02
drop table t1;
create table t1 (f1 int);
create table t2 (f2 int);
insert into t1 values(1),(2);
insert into t2 values(1),(1);
update t1,t2 set f1=3,f2=3 where f1=f2 and f1=1;
affected rows: 3
info: Rows matched: 3  Changed: 3  Warnings: 0
update t2 set f2=1;
update t1 set f1=1 where f1=3;
update t2,t1 set f1=3,f2=3 where f1=f2 and f1=1;
affected rows: 3
info: Rows matched: 3  Changed: 3  Warnings: 0
drop table t1,t2;
+14 −0
Original line number Diff line number Diff line
@@ -747,6 +747,20 @@ show status like "Qcache_hits";
drop table t1;

#
# BUG#14652: Queries with leading '(' characters.
#
create table t1 (a int);
flush status;
(select a from t1) union (select a from t1);
show status like "Qcache_queries_in_cache";
show status like "Qcache_inserts";
show status like "Qcache_hits";
(select a from t1) union (select a from t1);
show status like "Qcache_queries_in_cache";
show status like "Qcache_inserts";
show status like "Qcache_hits";
drop table t1;

# SP cursors and selects with query cache (BUG#9715)
#
create table t1 (a int);
+17 −0
Original line number Diff line number Diff line
@@ -270,4 +270,21 @@ insert into t1 values('2000-01-01'),('0000-00-00');
update t1 set f1='2002-02-02' where f1 is null;
select * from t1;
drop table t1;

#
# Bug#15028 Multitable update returns different numbers of matched rows
#           depending on table order
create table t1 (f1 int);
create table t2 (f2 int);
insert into t1 values(1),(2);
insert into t2 values(1),(1);
--enable_info
update t1,t2 set f1=3,f2=3 where f1=f2 and f1=1;
--disable_info
update t2 set f2=1;
update t1 set f1=1 where f1=3;
--enable_info
update t2,t1 set f1=3,f2=3 where f1=f2 and f1=1;
--disable_info
drop table t1,t2;
# End of 4.1 tests
+24 −13
Original line number Diff line number Diff line
@@ -977,6 +977,16 @@ Query_cache::send_result_to_client(THD *thd, char *sql, uint query_length)
    goto err;
  }

  {
    uint i= 0;
    /*
      Skip '(' characters in queries like following:
      (select a from t1) union (select a from t1);
    */
    while (sql[i]=='(')
      i++;


    /*
      Test if the query is a SELECT
      (pre-space is removed in dispatch_command).
@@ -985,14 +995,15 @@ Query_cache::send_result_to_client(THD *thd, char *sql, uint query_length)
      frequently appeared in real lihe, consequently we can
      check all such queries, too.
    */
  if ((my_toupper(system_charset_info, sql[0]) != 'S' || 
       my_toupper(system_charset_info, sql[1]) != 'E' ||
       my_toupper(system_charset_info,sql[2]) !='L') &&
    if ((my_toupper(system_charset_info, sql[i])     != 'S' ||
        my_toupper(system_charset_info, sql[i + 1]) != 'E' ||
        my_toupper(system_charset_info, sql[i + 2]) != 'L') &&
      sql[0] != '/')
    {
      DBUG_PRINT("qcache", ("The statement is not a SELECT; Not cached"));
      goto err;
    }
  }

  STRUCT_LOCK(&structure_guard_mutex);
  if (query_cache_size == 0)
Loading