diff options
Diffstat (limited to 'sql/sql_cache.h')
-rw-r--r-- | sql/sql_cache.h | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/sql/sql_cache.h b/sql/sql_cache.h index 9d1f32d6ef1..4fbd372d643 100644 --- a/sql/sql_cache.h +++ b/sql/sql_cache.h @@ -16,6 +16,16 @@ #ifndef _SQL_CACHE_H #define _SQL_CACHE_H +#include "hash.h" +#include "my_base.h" /* ha_rows */ + +class MY_LOCALE; +class TABLE_LIST; +class Time_zone; +struct LEX; +struct TABLE; +typedef struct st_changed_table_list CHANGED_TABLE_LIST; + /* Query cache */ /* @@ -66,6 +76,11 @@ struct Query_cache_result; class Query_cache; struct Query_cache_tls; struct LEX; +class THD; + +typedef my_bool (*qc_engine_callback)(THD *thd, char *table_key, + uint key_length, + ulonglong *engine_data); /** This class represents a node in the linked chain of queries @@ -502,5 +517,68 @@ protected: void unlock(void); }; +#ifdef HAVE_QUERY_CACHE +struct Query_cache_query_flags +{ + unsigned int client_long_flag:1; + unsigned int client_protocol_41:1; + unsigned int protocol_type:2; + unsigned int more_results_exists:1; + unsigned int in_trans:1; + unsigned int autocommit:1; + unsigned int pkt_nr; + uint character_set_client_num; + uint character_set_results_num; + uint collation_connection_num; + ha_rows limit; + Time_zone *time_zone; + ulong sql_mode; + ulong max_sort_length; + ulong group_concat_max_len; + ulong default_week_format; + ulong div_precision_increment; + MY_LOCALE *lc_time_names; +}; +#define QUERY_CACHE_FLAGS_SIZE sizeof(Query_cache_query_flags) +#include "sql_cache.h" +#define query_cache_abort(A) query_cache.abort(A) +#define query_cache_end_of_result(A) query_cache.end_of_result(A) +#define query_cache_store_query(A, B) query_cache.store_query(A, B) +#define query_cache_destroy() query_cache.destroy() +#define query_cache_result_size_limit(A) query_cache.result_size_limit(A) +#define query_cache_init() query_cache.init() +#define query_cache_resize(A) query_cache.resize(A) +#define query_cache_set_min_res_unit(A) query_cache.set_min_res_unit(A) +#define query_cache_invalidate3(A, B, C) query_cache.invalidate(A, B, C) +#define query_cache_invalidate1(A) query_cache.invalidate(A) +#define query_cache_send_result_to_client(A, B, C) \ + query_cache.send_result_to_client(A, B, C) +#define query_cache_invalidate_by_MyISAM_filename_ref \ + &query_cache_invalidate_by_MyISAM_filename +/* note the "maybe": it's a read without mutex */ +#define query_cache_maybe_disabled(T) \ + (T->variables.query_cache_type == 0 || query_cache.query_cache_size == 0) +#define query_cache_is_cacheable_query(L) \ + (((L)->sql_command == SQLCOM_SELECT) && (L)->safe_to_cache_query) +#else +#define QUERY_CACHE_FLAGS_SIZE 0 +#define query_cache_store_query(A, B) +#define query_cache_destroy() +#define query_cache_result_size_limit(A) +#define query_cache_init() +#define query_cache_resize(A) +#define query_cache_set_min_res_unit(A) +#define query_cache_invalidate3(A, B, C) +#define query_cache_invalidate1(A) +#define query_cache_send_result_to_client(A, B, C) 0 +#define query_cache_invalidate_by_MyISAM_filename_ref NULL + +#define query_cache_abort(A) +#define query_cache_end_of_result(A) +#define query_cache_invalidate_by_MyISAM_filename_ref NULL +#define query_cache_maybe_disabled(T) 1 +#define query_cache_is_cacheable_query(L) 0 +#endif /*HAVE_QUERY_CACHE*/ + extern Query_cache query_cache; #endif |