Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00044 #include <config.h>
00045
00046 #include "query_cache_service.h"
00047 #include "data_dictionary_schema.h"
00048
00049 #include <fcntl.h>
00050 #include <sys/stat.h>
00051
00052 using namespace std;
00053 using namespace drizzled;
00054
00055
00056
00057
00058
00059
00060
00061 QueryCacheTool::QueryCacheTool() :
00062 plugin::TableFunction("DATA_DICTIONARY", "QUERY_CACHE_ENTRIES")
00063 {
00064 add_field("key");
00065 add_field("schema");
00066 add_field("sql");
00067 }
00068
00069 QueryCacheTool::Generator::Generator(Field **arg) :
00070 plugin::TableFunction::Generator(arg)
00071 {
00072 it= QueryCacheService::cache.begin();
00073 end= QueryCacheService::cache.end();
00074 }
00075
00076 bool QueryCacheTool::Generator::populate()
00077 {
00078 if (it == end)
00079 {
00080 return false;
00081 }
00082
00083 QueryCacheService::CacheEntry &entry= *it;
00084
00085 push(entry.first);
00086 push(entry.second.schema());
00087 push(entry.second.sql());
00088
00089 it++;
00090
00091 return true;
00092 }
00093
00094
00095
00096
00097
00098
00099
00100 CachedTables::CachedTables() :
00101 plugin::TableFunction("DATA_DICTIONARY", "QUERY_CACHED_TABLES")
00102 {
00103 add_field("Table");
00104 add_field("Cache_Keys");
00105 }
00106
00107 CachedTables::Generator::Generator(Field **arg) :
00108 plugin::TableFunction::Generator(arg)
00109 {
00110 it= QueryCacheService::cachedTables.begin();
00111 end= QueryCacheService::cachedTables.end();
00112 }
00113
00114 bool CachedTables::Generator::populate()
00115 {
00116 if (it == end)
00117 {
00118 return false;
00119 }
00120
00121 QueryCacheService::CachedTablesEntry &entry= *it;
00122
00123 push(entry.first);
00124 string list_keys;
00125 vector<string>::iterator tmp;
00126 for(tmp= entry.second.begin(); tmp != entry.second.end(); tmp++)
00127 {
00128 list_keys+= "::"+ *tmp;
00129 }
00130 push(list_keys);
00131 it++;
00132 return true;
00133 }