diff options
Diffstat (limited to 'sql/sql_cache.h')
-rw-r--r-- | sql/sql_cache.h | 42 |
1 files changed, 25 insertions, 17 deletions
diff --git a/sql/sql_cache.h b/sql/sql_cache.h index 854937d0158..b0a045a8aad 100644 --- a/sql/sql_cache.h +++ b/sql/sql_cache.h @@ -53,10 +53,6 @@ of list of free blocks */ #define QUERY_CACHE_MEM_BIN_TRY 5 -/* query flags masks */ -#define QUERY_CACHE_CLIENT_LONG_FLAG_MASK 0x80 -#define QUERY_CACHE_CHARSET_CONVERT_MASK 0x7F - /* packing parameters */ #define QUERY_CACHE_PACK_ITERATION 2 #define QUERY_CACHE_PACK_LIMIT (512*1024L) @@ -115,18 +111,21 @@ struct Query_cache_query Query_cache_block *res; NET *wri; ulong len; + uint8 tbls_type; inline void init_n_lock(); void unlock_n_destroy(); inline ulonglong found_rows() { return limit_found_rows; } - inline void found_rows(ulonglong rows) { limit_found_rows = rows; } + inline void found_rows(ulonglong rows) { limit_found_rows= rows; } inline Query_cache_block *result() { return res; } - inline void result(Query_cache_block *p) { res=p; } + inline void result(Query_cache_block *p) { res= p; } inline NET *writer() { return wri; } - inline void writer(NET *p) { wri=p; } + inline void writer(NET *p) { wri= p; } + inline uint8 tables_type() { return tbls_type; } + inline void tables_type(uint8 type) { tbls_type= type; } inline ulong length() { return len; } - inline ulong add(ulong packet_len) { return(len += packet_len); } - inline void length(ulong length) { len = length; } + inline ulong add(ulong packet_len) { return(len+= packet_len); } + inline void length(ulong length) { len= length; } inline gptr query() { return (gptr)(((byte*)this)+ @@ -144,13 +143,16 @@ struct Query_cache_query struct Query_cache_table { char *tbl; - uint32 key_length; + uint32 key_len; + uint8 table_type; inline char *db() { return (char *) data(); } inline char *table() { return tbl; } - inline void table(char *table) { tbl = table; } - inline uint32 key_len() { return key_length; } - inline void key_len(uint32 len) { key_length= len; } + inline void table(char *table) { tbl= table; } + inline uint32 key_length() { return key_len; } + inline void key_length(uint32 len) { key_len= len; } + inline uint8 type() { return table_type; } + inline void type(uint8 t) { table_type= t; } inline gptr data() { return (gptr)(((byte*)this)+ @@ -279,7 +281,7 @@ protected: TABLE_COUNTER_TYPE tables); my_bool insert_table(uint key_len, char *key, Query_cache_block_table *node, - uint32 db_length); + uint32 db_length, uint8 cache_type); void unlink_table(Query_cache_block_table *node); Query_cache_block *get_free_block (ulong len, my_bool not_less, ulong min); @@ -336,7 +338,10 @@ protected: (query without tables not cached) */ TABLE_COUNTER_TYPE is_cacheable(THD *thd, uint32 query_len, char *query, - LEX *lex, TABLE_LIST *tables_used); + LEX *lex, TABLE_LIST *tables_used, + uint8 *tables_type); + + static my_bool ask_handler_allowance(THD *thd, TABLE_LIST *tables_used); public: Query_cache(ulong query_cache_limit = ULONG_MAX, @@ -349,7 +354,10 @@ protected: void init(); /* resize query cache (return real query size, 0 if disabled) */ ulong resize(ulong query_cache_size); + /* set limit on result size */ inline void result_size_limit(ulong limit){query_cache_limit=limit;} + /* set minimal result data allocation unit size */ + ulong set_min_res_unit(ulong size); /* register query in cache */ void store_query(THD *thd, TABLE_LIST *used_tables); @@ -382,7 +390,7 @@ protected: void destroy(); friend void query_cache_insert(NET *net, const char *packet, ulong length); - friend void query_cache_end_of_result(NET *net); + friend void query_cache_end_of_result(THD *thd); friend void query_cache_abort(NET *net); /* @@ -406,7 +414,7 @@ protected: extern Query_cache query_cache; extern TYPELIB query_cache_type_typelib; -void query_cache_end_of_result(NET *net); +void query_cache_end_of_result(THD *thd); void query_cache_abort(NET *net); #endif |