diff options
author | unknown <bell@sanja.is.com.ua> | 2005-12-01 14:38:29 +0200 |
---|---|---|
committer | unknown <bell@sanja.is.com.ua> | 2005-12-01 14:38:29 +0200 |
commit | f0b33dd9e452565634e98aeeea23ff312b46d1f6 (patch) | |
tree | 2fdb203e8cc312708738a9c8aab02d81cd9ac837 /sql/sql_cache.cc | |
parent | 483e04b2d616953b8e02b1017fc6fcfaa1fc93ac (diff) | |
parent | a050707b61d29dec3f39ef89f3102c6a72edb90a (diff) | |
download | mariadb-git-f0b33dd9e452565634e98aeeea23ff312b46d1f6.tar.gz |
Merge sanja.is.com.ua:/home/bell/mysql/bk/mysql-4.1
into sanja.is.com.ua:/home/bell/mysql/bk/work-merge1-5.0
configure.in:
merge
mysql-test/r/query_cache.result:
merge
mysql-test/t/query_cache.test:
merge
sql/sql_cache.cc:
merge
Diffstat (limited to 'sql/sql_cache.cc')
-rw-r--r-- | sql/sql_cache.cc | 38 |
1 files changed, 24 insertions, 14 deletions
diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc index 24ab27c587d..0a01832bb39 100644 --- a/sql/sql_cache.cc +++ b/sql/sql_cache.cc @@ -977,21 +977,31 @@ Query_cache::send_result_to_client(THD *thd, char *sql, uint query_length) goto err; } - /* - Test if the query is a SELECT - (pre-space is removed in dispatch_command). - - First '/' looks like comment before command it is not - 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') && - sql[0] != '/') { - DBUG_PRINT("qcache", ("The statement is not a SELECT; Not cached")); - 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) + + First '/' looks like comment before command it is not + frequently appeared in real lihe, consequently we can + check all such queries, too. + */ + 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[i] != '/') + { + DBUG_PRINT("qcache", ("The statement is not a SELECT; Not cached")); + goto err; + } } STRUCT_LOCK(&structure_guard_mutex); |