diff options
author | unknown <thek@adventure.(none)> | 2007-08-17 16:59:20 +0200 |
---|---|---|
committer | unknown <thek@adventure.(none)> | 2007-08-17 16:59:20 +0200 |
commit | 392f558985d1ebbf0f51c4677ab2948d72a64ba2 (patch) | |
tree | 198a36726eb3b24b0e494e2d46e65c45b6b765a1 /sql | |
parent | 303cd79297a9396b6091b347ed8a7792e49929ee (diff) | |
parent | 28233c1f27c01116b38ff670c0227b631c57253d (diff) | |
download | mariadb-git-392f558985d1ebbf0f51c4677ab2948d72a64ba2.tar.gz |
Merge adventure.(none):/home/thek/Development/cpp/bug30269/my50-bug30269
into adventure.(none):/home/thek/Development/cpp/bug30269/my51-bug30269
mysql-test/r/query_cache.result:
Auto merged
sql/sql_cache.cc:
Auto merged
sql/sql_cache.h:
Auto merged
mysql-test/t/query_cache.test:
Manual merge
Diffstat (limited to 'sql')
-rw-r--r-- | sql/sql_cache.cc | 24 | ||||
-rw-r--r-- | sql/sql_cache.h | 8 |
2 files changed, 26 insertions, 6 deletions
diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc index cab9ef94d6d..09e628610ef 100644 --- a/sql/sql_cache.cc +++ b/sql/sql_cache.cc @@ -3221,14 +3221,31 @@ void Query_cache::double_linked_list_join(Query_cache_block *head_tail, >0 number of tables */ -static TABLE_COUNTER_TYPE process_and_count_tables(TABLE_LIST *tables_used, - uint8 *tables_type) +TABLE_COUNTER_TYPE +Query_cache::process_and_count_tables(THD *thd, TABLE_LIST *tables_used, + uint8 *tables_type) { DBUG_ENTER("process_and_count_tables"); TABLE_COUNTER_TYPE table_count = 0; for (; tables_used; tables_used= tables_used->next_global) { table_count++; +#ifdef HAVE_QUERY_CACHE + /* + Disable any attempt to store this statement if there are + column level grants on any referenced tables. + The grant.want_privileges flag was set to 1 in the + check_grant() function earlier if the TABLE_LIST object + had any associated column privileges. + */ + if (tables_used->grant.want_privilege) + { + DBUG_PRINT("qcache", ("Don't cache statement as it refers to " + "tables with column privileges.")); + thd->lex->safe_to_cache_query= 0; + DBUG_RETURN(0); + } +#endif if (tables_used->view) { DBUG_PRINT("qcache", ("view: %s db: %s", @@ -3306,7 +3323,8 @@ Query_cache::is_cacheable(THD *thd, uint32 query_len, char *query, LEX *lex, (long) lex->select_lex.options, (int) thd->variables.query_cache_type)); - if (!(table_count= process_and_count_tables(tables_used, tables_type))) + if (!(table_count= process_and_count_tables(thd, tables_used, + tables_type))) DBUG_RETURN(0); if ((thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) && diff --git a/sql/sql_cache.h b/sql/sql_cache.h index c4c7e1dbc5e..4f7fb317e70 100644 --- a/sql/sql_cache.h +++ b/sql/sql_cache.h @@ -408,10 +408,12 @@ protected: If query is cacheable return number tables in query (query without tables not cached) */ - static TABLE_COUNTER_TYPE is_cacheable(THD *thd, uint32 query_len, char *query, - LEX *lex, TABLE_LIST *tables_used, - uint8 *tables_type); + LEX *lex, TABLE_LIST *tables_used, + uint8 *tables_type); + TABLE_COUNTER_TYPE process_and_count_tables(THD *thd, + TABLE_LIST *tables_used, + uint8 *tables_type); static my_bool ask_handler_allowance(THD *thd, TABLE_LIST *tables_used); public: |