summaryrefslogtreecommitdiff
path: root/sql/sql_expression_cache.cc
diff options
context:
space:
mode:
authorOleksandr Byelkin <sanja@mariadb.com>2015-03-25 18:27:10 +0100
committerSergei Petrunia <psergey@askmonty.org>2015-06-30 23:07:14 +0300
commitc6aee27b73232fc6ba3e8b55adbb0abba4f0171b (patch)
treec996b7f96ff4d063b2112e8b863825a2cff906b2 /sql/sql_expression_cache.cc
parent498a264d19f041c36d71e41a32c16ac40a014a3e (diff)
downloadmariadb-git-c6aee27b73232fc6ba3e8b55adbb0abba4f0171b.tar.gz
MDEV-7811: EXPLAIN/ANALYZE FORMAT=JSON should show subquery cache
Diffstat (limited to 'sql/sql_expression_cache.cc')
-rw-r--r--sql/sql_expression_cache.cc15
1 files changed, 14 insertions, 1 deletions
diff --git a/sql/sql_expression_cache.cc b/sql/sql_expression_cache.cc
index 824d21eea20..bda0aaafebe 100644
--- a/sql/sql_expression_cache.cc
+++ b/sql/sql_expression_cache.cc
@@ -43,7 +43,7 @@ ulong subquery_cache_miss, subquery_cache_hit;
Expression_cache_tmptable::Expression_cache_tmptable(THD *thd,
List<Item> &dependants,
Item *value)
- :cache_table(NULL), table_thd(thd), items(dependants), val(value),
+ :cache_table(NULL), table_thd(thd), stat(NULL), items(dependants), val(value),
hit(0), miss(0), inited (0)
{
DBUG_ENTER("Expression_cache_tmptable::Expression_cache_tmptable");
@@ -61,6 +61,9 @@ void Expression_cache_tmptable::disable_cache()
cache_table->file->ha_index_end();
free_tmp_table(table_thd, cache_table);
cache_table= NULL;
+ flush_stat();
+ if (stat)
+ stat->cache= NULL;
}
@@ -164,6 +167,7 @@ void Expression_cache_tmptable::init()
goto error;
}
+ flush_stat();
DBUG_VOID_RETURN;
error:
@@ -180,6 +184,11 @@ Expression_cache_tmptable::~Expression_cache_tmptable()
if (cache_table)
disable_cache();
+ else
+ {
+ flush_stat();
+ stat= NULL;
+ }
}
@@ -323,3 +332,7 @@ void Expression_cache_tmptable::print(String *str, enum_query_type query_type)
}
str->append('>');
}
+
+
+const char *Expression_cache_stat::state_str[3]=
+{"UNINITIALYZED", "DISABLED", "ENABLED"};