hi sergei
with last patch, i think the job on 
https://mariadb.atlassian.net/browse/MDEV-4581
could be reviewed, and maybe considered to include in mariadb
todo: better flags values (sql_mode is int, should be converted to string, connection charsets too, and add flag timezone informations)

well that's all , i will focus on some qc features:

===============================================================
QUERY CACHE
1) Query cache SQL interface (MDEV-4584)
QUERY CACHE LOCK <TIMEOUT>
QUERY CACHE UNLOCK
QUERY CACHE REMOVE <ID>
QUERY CACHE REMOVE TABLE LIKE <TABLE>

internally add a query_cache.lock_current_connection with connection id
show in processlist who have QUERY_CACHE_OWNER and FLUSH_TABLES_WITH_READ_LOCK
obs:                here i don't know how to change parser to understand the new command "QUERY CACHE"

2) Query cache prunes (MDEV-4582)
session_var:
query_cache_min_expend_time
query_cache_min_result_rows 
query_cache_min_read_rows 
obs:   i think it's the easiest feature to include (maybe i will start here)

3) Per table max queries in cache (MDEV-4588)
ALTER TABLE xxxx query_cache_max_queries=99999
obs:               here in don't know how to change .frm file to include this information
                           and i don't know how to change parser to understand 
                           query_cache_max_queries as a parameter like COMMENT='some comment'
4) Cleanup, Remove unused query cache (MDEV-4589)
add query_cache_query.total_qc_search_time
add session_var: query_cache_cleanup_stats_hits
when FLUSH QUERY CACHE: (or maybe when low mem, i will think about where to put this automatic remove procedure)
remove queries with:
((total_qc_search_time/hits)>(result_expend_time) &&
hits>query_cache_cleanup_stats_hits)
                        there's some others prune methods i will consider when implementing this

5) Cleanup, mode (MDEV-4583)
internal, user procedure (in mysql schema)

obs:     i don't know how to call a user procedure inside mariadb code
===============================================================

if i have some doubts could i ask here?